Class RegressionDatasetBuilder


  • public final class RegressionDatasetBuilder
    extends Object
    Builds regressions datasets instances.
    Author:
    Andrea "Stock" Stocchero
    • Method Detail

      • create

        public static RegressionDatasetBuilder create()
        Creates new regression dataset builder, without any sample.
        Returns:
        new regression dataset builder, without any sample
      • create

        public static RegressionDatasetBuilder create​(List<Double> x,
                                                      List<Double> y)
        Creates new regression dataset builder, using the passed data as samples.
        Parameters:
        x - X values to use to create the regression
        y - Y values to use to create the regression
        Returns:
        new regression dataset builder
      • build

        public static RegressionDataset build​(RegressionDataset dataset)
        Creates new regression dataset cloning the passed dataset.
        The options and the data are NOT cloned.
        Parameters:
        dataset - dataset to clone.
        Returns:
        new regression dataset instance
      • setLoadData

        public RegressionDatasetBuilder setLoadData​(boolean loadData)
        Sets true if the samples will be loaded as dataset data.
        Parameters:
        loadData - true if the samples will be loaded as dataset data
        Returns:
        new regression dataset builder
      • setHidden

        public RegressionDatasetBuilder setHidden​(boolean hidden)
        Sets true if the dataset will be created in hidden status.
        Parameters:
        hidden - true if the dataset will be created in hidden status
        Returns:
        new regression dataset builder
      • setSamples

        public RegressionDatasetBuilder setSamples​(List<Double> y,
                                                   double starting,
                                                   double increment)
        Sets samples, using the passed Y values.
        X values are creating starting from passed argument with increment of passed argument.
        Parameters:
        y - Y values to use to create the regression
        starting - starting value to create X values
        increment - increment to apply to the starting value
        Returns:
        regression builder instance
      • setSamples

        public RegressionDatasetBuilder setSamples​(HasDataPoints dataset)
        Sets the samples by the passed dataset, DataPoint based, data as source.
        Parameters:
        dataset - dataset instance to use getting data as source
        Returns:
        new regression dataset builder
      • setSamplesByDataPoints

        public RegressionDatasetBuilder setSamplesByDataPoints​(List<DataPoint> dataPoints)
        Sets the samples by the passed DataPoints.
        Parameters:
        dataPoints - data points list to use for creating the regression
        Returns:
        new regression dataset builder
      • setSamples

        public RegressionDatasetBuilder setSamples​(HasTimeSeriesItems dataset)
        Sets the samples by the passed time series dataset, TimeSeriesItem based, data as source.
        Parameters:
        dataset - dataset instance to use getting data as source
        Returns:
        new regression dataset builder
      • setSamplesByTimeSeriesItems

        public RegressionDatasetBuilder setSamplesByTimeSeriesItems​(List<TimeSeriesItem> items)
        Sets the samples by the passed TimeSeriesItems.
        Parameters:
        items - time series items list to use for creating the regression
        Returns:
        new regression dataset builder
      • setSamples

        public RegressionDatasetBuilder setSamples​(List<Double> x,
                                                   List<Double> y)
        Creates a simple linear regression, using the passed X and Y values.
        Parameters:
        x - X values to use to create the regression
        y - Y values to use to create the regression
        Returns:
        regression builder instance
      • setSamplesByDates

        public RegressionDatasetBuilder setSamplesByDates​(List<Date> x,
                                                          List<Double> y)
        Sets the samples by the passed X and Y values.
        Parameters:
        x - X values to use to create the regression
        y - Y values to use to create the regression
        Returns:
        new regression dataset builder
      • buildLinearRegression

        public RegressionDataset buildLinearRegression()
        Creates a regression dataset, to add to a chart.
        Returns:
        regression dataset to add to a chart
      • buildPolynomialRegression

        public RegressionDataset buildPolynomialRegression()
        Creates a regression dataset, to add to a chart.
        It uses the default degree, 2.
        Returns:
        regression dataset to add to a chart
      • buildPolynomialRegression

        public RegressionDataset buildPolynomialRegression​(int degree)
        Creates a regression dataset, to add to a chart, using the passed maximum degree.
        Parameters:
        degree - the maximum degree of the polynomial
        Returns:
        regression dataset to add to a chart
      • buildPowerRegression

        public RegressionDataset buildPowerRegression()
        Creates a regression dataset, to add to a chart.
        Returns:
        regression dataset to add to a chart
      • buildExponentialRegression

        public RegressionDataset buildExponentialRegression()
        Creates a regression dataset, to add to a chart.
        Returns:
        regression dataset to add to a chart
      • buildTheilSenRegression

        public RegressionDataset buildTheilSenRegression()
        Creates a regression dataset, to add to a chart.
        Returns:
        regression dataset to add to a chart
      • buildRobustPolynomialRegression

        public RegressionDataset buildRobustPolynomialRegression()
        Creates a regression dataset, to add to a chart.
        It uses the default degree, 2.
        Returns:
        regression dataset to add to a chart
      • buildRobustPolynomialRegression

        public RegressionDataset buildRobustPolynomialRegression​(int degree)
        Creates a regression dataset, to add to a chart, using the passed maximum degree.
        Parameters:
        degree - the maximum degree of the robust polynomial
        Returns:
        regression dataset to add to a chart
      • setSamples

        public final T setSamples​(List<Double> y)
        Sets samples, using the passed Y values.
        X values are creating starting from 0 with increment of 1.
        Parameters:
        y - Y values to use to create the regression
        Returns:
        regression builder
      • setSamples

        public final T setSamples​(List<Double> y,
                                  double starting)
        Sets samples, using the passed Y values.
        X values are creating starting from passed argument with increment of 1.
        Parameters:
        y - Y values to use to create the regression
        starting - starting value to create X values
        Returns:
        regression builder instance