Class ImmutableRegressionInfo
java.lang.Object
org.tribuo.regression.RegressionInfo
org.tribuo.regression.ImmutableRegressionInfo
- All Implemented Interfaces:
Serializable
,Iterable<com.oracle.labs.mlrg.olcut.util.Pair<Integer, Regressor>>
,ImmutableOutputInfo<Regressor>
,OutputInfo<Regressor>
public class ImmutableRegressionInfo
extends RegressionInfo
implements ImmutableOutputInfo<Regressor>
A
ImmutableOutputInfo
for Regressor
s.- See Also:
-
Field Summary
Fields inherited from class org.tribuo.regression.RegressionInfo
countMap, maxMap, meanMap, minMap, overallCount, sumSquaresMap, unknownCount
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
Generates a copy of this OutputInfo, including it's mutability.Returns a set containing a Regressor for each dimension with the minimum value observed.int
Return the id number associated with this output, or -1 if the output is unknown.int[]
Computes the mapping between ID numbers and regressor dimension indices.int[]
Computes the mapping between regressor dimension indices and ID numbers.getOutput
(int id) Returns the output associated with this id, or null if the id is unknown.long
Returns the total number of observed outputs seen by this ImmutableOutputInfo.iterator()
Generates a String form of this OutputInfo.toString()
boolean
Returns true if the id numbers correspond to a lexicographic ordering of the dimension names starting from zero, false otherwise.Methods inherited from class org.tribuo.regression.RegressionInfo
generateImmutableOutputInfo, generateMutableOutputInfo, getMax, getMean, getMin, getUnknownCount, getVariance, outputCountsIterable, size
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.tribuo.OutputInfo
generateImmutableOutputInfo, generateMutableOutputInfo, getUnknownCount, outputCountsIterable, size
-
Method Details
-
getDomain
Description copied from class:RegressionInfo
Returns a set containing a Regressor for each dimension with the minimum value observed.- Specified by:
getDomain
in interfaceOutputInfo<Regressor>
- Overrides:
getDomain
in classRegressionInfo
- Returns:
- A set of Regressors, each with one active dimension.
-
getID
Description copied from interface:ImmutableOutputInfo
Return the id number associated with this output, or -1 if the output is unknown.- Specified by:
getID
in interfaceImmutableOutputInfo<Regressor>
- Parameters:
output
- An output- Returns:
- A non-negative integer if the output is known, or -1 if the output is unknown.
-
getOutput
Description copied from interface:ImmutableOutputInfo
Returns the output associated with this id, or null if the id is unknown.- Specified by:
getOutput
in interfaceImmutableOutputInfo<Regressor>
- Parameters:
id
- A non-negative integer.- Returns:
- An output object or null if it's unknown.
-
getTotalObservations
public long getTotalObservations()Description copied from interface:ImmutableOutputInfo
Returns the total number of observed outputs seen by this ImmutableOutputInfo.- Specified by:
getTotalObservations
in interfaceImmutableOutputInfo<Regressor>
- Returns:
- The number of observed outputs.
-
copy
Description copied from interface:OutputInfo
Generates a copy of this OutputInfo, including it's mutability.- Specified by:
copy
in interfaceOutputInfo<Regressor>
- Specified by:
copy
in classRegressionInfo
- Returns:
- A copy of the OutputInfo.
-
toString
-
validateMapping
public boolean validateMapping()Returns true if the id numbers correspond to a lexicographic ordering of the dimension names starting from zero, false otherwise.- Returns:
- True if the id mapping corresponds to lexicographic ordering of the names.
-
getIDtoNaturalOrderMapping
public int[] getIDtoNaturalOrderMapping()Computes the mapping between ID numbers and regressor dimension indices.In some situations the regressor dimension ID numbers may not use the natural ordering (i.e., the lexicographic order of the dimension names). This method computes the mapping from the id numbers to the natural ordering.
- Returns:
- An array where arr[id] = natural_idx.
-
getNaturalOrderToIDMapping
public int[] getNaturalOrderToIDMapping()Computes the mapping between regressor dimension indices and ID numbers.In some situations the regressor dimension ID numbers may not use the natural ordering (i.e., the lexicographic order of the dimension names). This method computes the mapping from the natural ordering to the id numbers.
- Returns:
- An array where arr[natural_idx] = id.
-
toReadableString
Description copied from interface:OutputInfo
Generates a String form of this OutputInfo.This String can contain newlines, tabs and other formatting.
- Specified by:
toReadableString
in interfaceOutputInfo<Regressor>
- Returns:
- A formatted String representing this OutputInfo.
-
iterator
-