Package org.pepstock.charba.client.ml
Class RegressionDatasetBuilder
- java.lang.Object
-
- org.pepstock.charba.client.ml.RegressionDatasetBuilder
-
public final class RegressionDatasetBuilder extends Object
Builds regressions datasets instances.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RegressionDataset
build(RegressionDataset dataset)
Creates new regression dataset cloning the passed dataset.
The options and the data are NOT cloned.RegressionDataset
buildExponentialRegression()
Creates a regression dataset, to add to a chart.RegressionDataset
buildLinearRegression()
Creates a regression dataset, to add to a chart.RegressionDataset
buildPolynomialRegression()
Creates a regression dataset, to add to a chart.
It uses the default degree, 2.RegressionDataset
buildPolynomialRegression(int degree)
Creates a regression dataset, to add to a chart, using the passed maximum degree.RegressionDataset
buildPowerRegression()
Creates a regression dataset, to add to a chart.RegressionDataset
buildRobustPolynomialRegression()
Creates a regression dataset, to add to a chart.
It uses the default degree, 2.RegressionDataset
buildRobustPolynomialRegression(int degree)
Creates a regression dataset, to add to a chart, using the passed maximum degree.RegressionDataset
buildTheilSenRegression()
Creates a regression dataset, to add to a chart.static RegressionDatasetBuilder
create()
Creates new regression dataset builder, without any sample.static RegressionDatasetBuilder
create(List<Double> x, List<Double> y)
Creates new regression dataset builder, using the passed data as samples.RegressionDatasetBuilder
setHidden(boolean hidden)
Setstrue
if the dataset will be created in hidden status.RegressionDatasetBuilder
setLoadData(boolean loadData)
Setstrue
if the samples will be loaded as dataset data.T
setSamples(List<Double> y)
Sets samples, using the passed Y values.
X values are creating starting from 0 with increment of 1.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.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.RegressionDatasetBuilder
setSamples(List<Double> x, List<Double> y)
Creates a simple linear regression, using the passed X and Y values.RegressionDatasetBuilder
setSamples(HasDataPoints dataset)
Sets the samples by the passed dataset,DataPoint
based, data as source.RegressionDatasetBuilder
setSamples(HasTimeSeriesItems dataset)
Sets the samples by the passed time series dataset,TimeSeriesItem
based, data as source.RegressionDatasetBuilder
setSamplesByDataPoints(List<DataPoint> dataPoints)
Sets the samples by the passedDataPoint
s.RegressionDatasetBuilder
setSamplesByDates(List<Date> x, List<Double> y)
Sets the samples by the passed X and Y values.RegressionDatasetBuilder
setSamplesByTimeSeriesItems(List<TimeSeriesItem> items)
Sets the samples by the passedTimeSeriesItem
s.
-
-
-
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 regressiony
- 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)
Setstrue
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)
Setstrue
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 regressionstarting
- starting value to create X valuesincrement
- 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 passedDataPoint
s.- 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 passedTimeSeriesItem
s.- 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 regressiony
- 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 regressiony
- 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 regressionstarting
- starting value to create X values- Returns:
- regression builder instance
-
-