Class Regressor.DimensionTuple

java.lang.Object
org.tribuo.regression.Regressor
org.tribuo.regression.Regressor.DimensionTuple
All Implemented Interfaces:
Serializable, Iterable<Regressor.DimensionTuple>, Output<Regressor>
Enclosing class:
Regressor

public static final class Regressor.DimensionTuple extends Regressor
A Regressor which contains a single dimension, used internally when the model implementation doesn't natively support multi-dimensional regression outputs.
See Also:
  • Constructor Details

    • DimensionTuple

      public DimensionTuple(String name, double value, double variance)
      Creates a dimension tuple from the supplied name, value and variance.
      Parameters:
      name - The dimension name.
      value - The dimension value.
      variance - The variance of the value, if known. Otherwise Double.NaN.
    • DimensionTuple

      public DimensionTuple(String name, double value)
      Creates a dimension tuple from the supplied name and value. Sets the variance to Double.NaN.
      Parameters:
      name - The dimension name.
      value - The dimension value.
  • Method Details

    • size

      public int size()
      Description copied from class: Regressor
      Returns the number of dimensions in this regressor.
      Overrides:
      size in class Regressor
      Returns:
      The number of dimensions.
    • toString

      public String toString()
      Overrides:
      toString in class Regressor
    • getDimension

      public Optional<Regressor.DimensionTuple> getDimension(String name)
      Description copied from class: Regressor
      Returns a dimension tuple for the requested dimension, or optional empty if it's not valid.
      Overrides:
      getDimension in class Regressor
      Parameters:
      name - The dimension name.
      Returns:
      A tuple representing that dimension.
    • iterator

      public Iterator<Regressor.DimensionTuple> iterator()
      Specified by:
      iterator in interface Iterable<Regressor.DimensionTuple>
      Overrides:
      iterator in class Regressor
    • copy

      public Regressor.DimensionTuple copy()
      Description copied from interface: Output
      Deep copy of the output up to it's immutable state.
      Specified by:
      copy in interface Output<Regressor>
      Overrides:
      copy in class Regressor
      Returns:
      A copy of the output.
    • getName

      public String getName()
      Returns the name.
      Returns:
      The name.
    • getValue

      public double getValue()
      Returns the value.
      Returns:
      The value.
    • getVariance

      public double getVariance()
      Returns the variance.
      Returns:
      The variance.
    • getSerializableForm

      public String getSerializableForm(boolean includeConfidence)
      Description copied from interface: Output
      Generates a String suitable for writing to a csv or json file.
      Specified by:
      getSerializableForm in interface Output<Regressor>
      Overrides:
      getSerializableForm in class Regressor
      Parameters:
      includeConfidence - Include whatever confidence score the label contains, if known.
      Returns:
      A String representation of this Output.
    • fullEquals

      public boolean fullEquals(Regressor other)
      Description copied from interface: Output
      Compares other to this output. Uses all score values and the strings.
      Specified by:
      fullEquals in interface Output<Regressor>
      Overrides:
      fullEquals in class Regressor
      Parameters:
      other - Another output instance.
      Returns:
      True if the other instance has value equality to this instance. False otherwise.
    • equals

      public boolean equals(Object o)
      Description copied from class: Regressor
      Regressors are equal if they have the same number of dimensions and equal dimension names.
      Overrides:
      equals in class Regressor
      Parameters:
      o - An object.
      Returns:
      True if Object is a Regressor with the same dimension names, false otherwise.
    • hashCode

      public int hashCode()
      All regressors have a hashcode based on only the dimension names.
      Overrides:
      hashCode in class Regressor
      Returns:
      A hashcode.
    • getDimensionNamesString

      public String getDimensionNamesString()
      Description copied from class: Regressor
      Returns a comma separated list of the dimension names.
      Overrides:
      getDimensionNamesString in class Regressor
      Returns:
      The dimension names comma separated.