Package org.tribuo.regression.example
Class GaussianDataSource
java.lang.Object
org.tribuo.regression.example.GaussianDataSource
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<DataSourceProvenance>
,Iterable<Example<Regressor>>
,ConfigurableDataSource<Regressor>
,DataSource<Regressor>
Generates a single dimensional output drawn from N(slope*x + intercept,variance).
The single feature is drawn from a uniform distribution over the range.
Set slope to zero to draw from a gaussian.
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionGaussianDataSource
(int numSamples, float slope, float intercept, float variance, float xMin, float xMax, long seed) Generates a single dimensional output drawn from N(slope*x + intercept,variance). -
Method Summary
Modifier and TypeMethodDescriptionstatic MutableDataset<Regressor>
generateDataset
(int numSamples, float slope, float intercept, float variance, float xMin, float xMax, long seed) Generates a single dimensional output drawn from N(slope*x + intercept,variance).Returns the OutputFactory associated with this Output subclass.iterator()
void
Used by the OLCUT configuration system, and should not be called by external code.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
GaussianDataSource
public GaussianDataSource(int numSamples, float slope, float intercept, float variance, float xMin, float xMax, long seed) Generates a single dimensional output drawn from N(slope*x + intercept,variance).The single feature is drawn from a uniform distribution over the range.
Set slope to zero to draw from a gaussian.
- Parameters:
numSamples
- The size of the output dataset.slope
- The slope of the line.intercept
- The y intercept of the line.variance
- The variance of the gaussian.xMin
- The minimum x value (inclusive).xMax
- The maximum x value (exclusive).seed
- The rng seed to use.
-
-
Method Details
-
postConfig
public void postConfig()Used by the OLCUT configuration system, and should not be called by external code.- Specified by:
postConfig
in interfacecom.oracle.labs.mlrg.olcut.config.Configurable
-
getOutputFactory
Description copied from interface:DataSource
Returns the OutputFactory associated with this Output subclass.- Specified by:
getOutputFactory
in interfaceDataSource<Regressor>
- Returns:
- The output factory.
-
getProvenance
- Specified by:
getProvenance
in interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<DataSourceProvenance>
-
iterator
-
generateDataset
public static MutableDataset<Regressor> generateDataset(int numSamples, float slope, float intercept, float variance, float xMin, float xMax, long seed) Generates a single dimensional output drawn from N(slope*x + intercept,variance).The single feature is drawn from a uniform distribution over the range.
Set slope to zero to draw from a gaussian.
- Parameters:
numSamples
- The size of the output dataset.slope
- The slope of the line.intercept
- The y intercept of the line.variance
- The variance of the gaussian.xMin
- The minimum x value (inclusive).xMax
- The maximum x value (exclusive).seed
- The rng seed to use.- Returns:
- A dataset drawn from a gaussian.
-