Package org.tribuo.regression
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
A
Regressor
which contains a single dimension, used internally
when the model implementation doesn't natively support multi-dimensional
regression outputs.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.tribuo.regression.Regressor
Regressor.DimensionTuple
-
Field Summary
Fields inherited from class org.tribuo.regression.Regressor
DEFAULT_NAME, TOLERANCE
-
Constructor Summary
ConstructorDescriptionDimensionTuple
(String name, double value) Creates a dimension tuple from the supplied name and value.DimensionTuple
(String name, double value, double variance) Creates a dimension tuple from the supplied name, value and variance. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Deep copy of the output up to it's immutable state.boolean
Regressors are equal if they have the same number of dimensions and equal dimension names.boolean
fullEquals
(Regressor other) Compares other to this output.getDimension
(String name) Returns a dimension tuple for the requested dimension, or optional empty if it's not valid.Returns a comma separated list of the dimension names.getName()
Returns the name.getSerializableForm
(boolean includeConfidence) Generates a String suitable for writing to a csv or json file.double
getValue()
Returns the value.double
Returns the variance.int
hashCode()
All regressors have a hashcode based on only the dimension names.iterator()
int
size()
Returns the number of dimensions in this regressor.toString()
Methods inherited from class org.tribuo.regression.Regressor
createFromPairList, extractNames, getDimension, getDimensionNamesString, getNames, getValues, getVariances, parseElement, parseString, parseString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DimensionTuple
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. OtherwiseDouble.NaN
.
-
DimensionTuple
Creates a dimension tuple from the supplied name and value. Sets the variance toDouble.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. -
toString
-
getDimension
Description copied from class:Regressor
Returns a dimension tuple for the requested dimension, or optional empty if it's not valid.- Overrides:
getDimension
in classRegressor
- Parameters:
name
- The dimension name.- Returns:
- A tuple representing that dimension.
-
iterator
- Specified by:
iterator
in interfaceIterable<Regressor.DimensionTuple>
- Overrides:
iterator
in classRegressor
-
copy
Description copied from interface:Output
Deep copy of the output up to it's immutable state. -
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
Description copied from interface:Output
Generates a String suitable for writing to a csv or json file.- Specified by:
getSerializableForm
in interfaceOutput<Regressor>
- Overrides:
getSerializableForm
in classRegressor
- Parameters:
includeConfidence
- Include whatever confidence score the label contains, if known.- Returns:
- A String representation of this Output.
-
fullEquals
Description copied from interface:Output
Compares other to this output. Uses all score values and the strings.- Specified by:
fullEquals
in interfaceOutput<Regressor>
- Overrides:
fullEquals
in classRegressor
- Parameters:
other
- Another output instance.- Returns:
- True if the other instance has value equality to this instance. False otherwise.
-
equals
Description copied from class:Regressor
Regressors are equal if they have the same number of dimensions and equal dimension names. -
hashCode
public int hashCode()All regressors have a hashcode based on only the dimension names. -
getDimensionNamesString
Description copied from class:Regressor
Returns a comma separated list of the dimension names.- Overrides:
getDimensionNamesString
in classRegressor
- Returns:
- The dimension names comma separated.
-