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>

public class GaussianDataSource extends Object implements ConfigurableDataSource<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.

  • 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 interface com.oracle.labs.mlrg.olcut.config.Configurable
    • getOutputFactory

      public OutputFactory<Regressor> getOutputFactory()
      Description copied from interface: DataSource
      Returns the OutputFactory associated with this Output subclass.
      Specified by:
      getOutputFactory in interface DataSource<Regressor>
      Returns:
      The output factory.
    • getProvenance

      public DataSourceProvenance getProvenance()
      Specified by:
      getProvenance in interface com.oracle.labs.mlrg.olcut.provenance.Provenancable<DataSourceProvenance>
    • iterator

      public Iterator<Example<Regressor>> iterator()
      Specified by:
      iterator in interface Iterable<Example<Regressor>>
    • 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.