Class NonlinearGaussianDataSource

java.lang.Object
org.tribuo.regression.example.NonlinearGaussianDataSource
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 NonlinearGaussianDataSource extends Object implements ConfigurableDataSource<Regressor>
Generates a single dimensional output drawn from N(w_0*x_0 + w_1*x_1 + w_2*x_1*x_0 + w_3*x_1*x_1*x_1 + intercept,variance).

The features are drawn from a uniform distribution over the range.

  • Constructor Details

    • NonlinearGaussianDataSource

      public NonlinearGaussianDataSource(int numSamples, long seed)
      Generates a single dimensional output drawn from N(w_0*x_0 + w_1*x_1 + w_2*x_1*x_0 + w_3*x_1*x_1*x_1 + intercept,variance).

      The weights are [1,1,1,1], the intercept is 0, and the variance is 1.0. The features are drawn from a uniform distribution over the range [-2,2].

      Parameters:
      numSamples - The size of the created datasource.
      seed - The rng seed to use.
    • NonlinearGaussianDataSource

      public NonlinearGaussianDataSource(int numSamples, float[] weights, float intercept, float variance, float xZeroMin, float xZeroMax, float xOneMin, float xOneMax, long seed)
      Generates a single dimensional output drawn from N(w_0*x_0 + w_1*x_1 + w_2*x_1*x_0 + w_3*x_1*x_1*x_1 + intercept,variance).

      The features are drawn from a uniform distribution over the range.

      Parameters:
      numSamples - The size of the created datasource.
      weights - The feature weights.
      intercept - The y intercept of the line.
      variance - The variance of the gaussian.
      xZeroMin - The minimum x_0 value (inclusive).
      xZeroMax - The maximum x_0 value (exclusive).
      xOneMin - The minimum x_1 value (inclusive).
      xOneMax - The maximum x_1 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[] weights, float intercept, float variance, float xZeroMin, float xZeroMax, float xOneMin, float xOneMax, long seed)
      Generates a single dimensional output drawn from N(w_0*x_0 + w_1*x_1 + w_2*x_1*x_0 + w_3*x_1*x_1*x_1 + intercept,variance).

      The features are drawn from a uniform distribution over the range.

      Parameters:
      numSamples - The size of the output dataset.
      weights - The feature weights.
      intercept - The y intercept of the line.
      variance - The variance of the gaussian.
      xZeroMin - The minimum x_0 value (inclusive).
      xZeroMax - The maximum x_0 value (exclusive).
      xOneMin - The minimum x_1 value (inclusive).
      xOneMax - The maximum x_1 value (exclusive).
      seed - The rng seed to use.
      Returns:
      A dataset drawn from a gaussian.