Package org.pepstock.charba.client.ml
Class RegressionDatasetBuilder
- java.lang.Object
-
- org.pepstock.charba.client.ml.AbstractBuilder<RegressionDatasetBuilder>
-
- org.pepstock.charba.client.ml.RegressionDatasetBuilder
-
public final class RegressionDatasetBuilder extends AbstractBuilder<RegressionDatasetBuilder>
Builds regressions datasets instances.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RegressionDatasetbuild(RegressionDataset dataset)Creates new regression dataset cloning the passed dataset.
The options and the data are NOT cloned.RegressionDatasetbuildExponentialRegression()Creates a regression dataset, to add to a chart.RegressionDatasetbuildLinearRegression()Creates a regression dataset, to add to a chart.RegressionDatasetbuildPolynomialRegression()Creates a regression dataset, to add to a chart.
It uses the default degree, 2.RegressionDatasetbuildPolynomialRegression(int degree)Creates a regression dataset, to add to a chart, using the passed maximum degree.RegressionDatasetbuildPowerRegression()Creates a regression dataset, to add to a chart.RegressionDatasetbuildRobustPolynomialRegression()Creates a regression dataset, to add to a chart.
It uses the default degree, 2.RegressionDatasetbuildRobustPolynomialRegression(int degree)Creates a regression dataset, to add to a chart, using the passed maximum degree.RegressionDatasetbuildTheilSenRegression()Creates a regression dataset, to add to a chart.static RegressionDatasetBuildercreate()Creates new regression dataset builder, without any sample.static RegressionDatasetBuildercreate(List<Double> x, List<Double> y)Creates new regression dataset builder, using the passed data as samples.RegressionDatasetBuildersetHidden(boolean hidden)Setstrueif the dataset will be created in hidden status.RegressionDatasetBuildersetLoadData(boolean loadData)Setstrueif the samples will be loaded as dataset data.RegressionDatasetBuildersetSamples(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.RegressionDatasetBuildersetSamples(List<Double> x, List<Double> y)Creates a simple linear regression, using the passed X and Y values.RegressionDatasetBuildersetSamples(HasDataPoints dataset)Sets the samples by the passed dataset,DataPointbased, data as source.RegressionDatasetBuildersetSamples(HasTimeSeriesItems dataset)Sets the samples by the passed time series dataset,TimeSeriesItembased, data as source.RegressionDatasetBuildersetSamplesByDataPoints(List<DataPoint> dataPoints)Sets the samples by the passedDataPoints.RegressionDatasetBuildersetSamplesByDates(List<Date> x, List<Double> y)Sets the samples by the passed X and Y values.RegressionDatasetBuildersetSamplesByTimeSeriesItems(List<TimeSeriesItem> items)Sets the samples by the passedTimeSeriesItems.-
Methods inherited from class org.pepstock.charba.client.ml.AbstractBuilder
setSamples, setSamples
-
-
-
-
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)
Setstrueif the samples will be loaded as dataset data.- Parameters:
loadData-trueif the samples will be loaded as dataset data- Returns:
- new regression dataset builder
-
setHidden
public RegressionDatasetBuilder setHidden(boolean hidden)
Setstrueif the dataset will be created in hidden status.- Parameters:
hidden-trueif the dataset will be created in hidden status- Returns:
- new regression dataset builder
-
setSamples
public RegressionDatasetBuilder setSamples(List<Double> y, double starting, double increment)
Description copied from class:AbstractBuilderSets samples, using the passed Y values.
X values are creating starting from passed argument with increment of passed argument.- Overrides:
setSamplesin classAbstractBuilder<RegressionDatasetBuilder>- 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,DataPointbased, 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 passedDataPoints.- Overrides:
setSamplesByDataPointsin classAbstractBuilder<RegressionDatasetBuilder>- 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,TimeSeriesItembased, 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 passedTimeSeriesItems.- Overrides:
setSamplesByTimeSeriesItemsin classAbstractBuilder<RegressionDatasetBuilder>- 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)
Description copied from class:AbstractBuilderCreates a simple linear regression, using the passed X and Y values.- Overrides:
setSamplesin classAbstractBuilder<RegressionDatasetBuilder>- 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.- Overrides:
setSamplesByDatesin classAbstractBuilder<RegressionDatasetBuilder>- 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
-
-