Package org.tribuo.interop.tensorflow
Class RegressorConverter
java.lang.Object
org.tribuo.interop.tensorflow.RegressorConverter
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
,Serializable
,OutputConverter<Regressor>
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionconvertToBatchOutput
(org.tensorflow.Tensor tensor, ImmutableOutputInfo<Regressor> outputIDInfo) Converts aTensor
containing multiple outputs into a list ofOutput
s.convertToBatchPrediction
(org.tensorflow.Tensor tensor, ImmutableOutputInfo<Regressor> outputIDInfo, int[] numValidFeatures, List<Example<Regressor>> examples) Converts aTensor
containing multiple outputs into a list ofPrediction
s.convertToOutput
(org.tensorflow.Tensor tensor, ImmutableOutputInfo<Regressor> outputIDInfo) Converts aTensor
into the specified output type.convertToPrediction
(org.tensorflow.Tensor tensor, ImmutableOutputInfo<Regressor> outputIDInfo, int numValidFeatures, Example<Regressor> example) Converts aTensor
into aPrediction
.org.tensorflow.Tensor
convertToTensor
(List<Example<Regressor>> examples, ImmutableOutputInfo<Regressor> outputIDInfo) Converts a list ofExample
into aTensor
representing all the outputs in the list.org.tensorflow.Tensor
convertToTensor
(Regressor example, ImmutableOutputInfo<Regressor> outputIDInfo) Converts anOutput
into aTensor
representing it's output.boolean
Does this OutputConverter generate probabilities.com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance
BiFunction<org.tensorflow.op.Ops,
com.oracle.labs.mlrg.olcut.util.Pair<org.tensorflow.op.core.Placeholder<? extends org.tensorflow.types.family.TNumber>, org.tensorflow.Operand<org.tensorflow.types.family.TNumber>>, org.tensorflow.Operand<org.tensorflow.types.family.TNumber>> loss()
Returns a mean squared error loss.<U extends org.tensorflow.types.family.TNumber>
BiFunction<org.tensorflow.op.Ops,org.tensorflow.Operand<U>, org.tensorflow.op.Op> Applies the identity functiontoString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
-
Constructor Details
-
RegressorConverter
public RegressorConverter()Constructs a RegressorConverter.
-
-
Method Details
-
loss
public BiFunction<org.tensorflow.op.Ops,com.oracle.labs.mlrg.olcut.util.Pair<org.tensorflow.op.core.Placeholder<? extends org.tensorflow.types.family.TNumber>, loss()org.tensorflow.Operand<org.tensorflow.types.family.TNumber>>, org.tensorflow.Operand<org.tensorflow.types.family.TNumber>> Returns a mean squared error loss.- Specified by:
loss
in interfaceOutputConverter<Regressor>
- Returns:
- The mse loss.
-
outputTransformFunction
public <U extends org.tensorflow.types.family.TNumber> BiFunction<org.tensorflow.op.Ops,org.tensorflow.Operand<U>, outputTransformFunction()org.tensorflow.op.Op> Applies the identity function- Specified by:
outputTransformFunction
in interfaceOutputConverter<Regressor>
- Type Parameters:
U
- The input type (should be TFloat32).- Returns:
- A function which applies the identity function.
-
convertToPrediction
public Prediction<Regressor> convertToPrediction(org.tensorflow.Tensor tensor, ImmutableOutputInfo<Regressor> outputIDInfo, int numValidFeatures, Example<Regressor> example) Description copied from interface:OutputConverter
Converts aTensor
into aPrediction
.- Specified by:
convertToPrediction
in interfaceOutputConverter<Regressor>
- Parameters:
tensor
- The tensor to convert.outputIDInfo
- The output info to use to identify the outputs.numValidFeatures
- The number of valid features used by the prediction.example
- The example to insert into the prediction.- Returns:
- A prediction object.
-
convertToOutput
public Regressor convertToOutput(org.tensorflow.Tensor tensor, ImmutableOutputInfo<Regressor> outputIDInfo) Description copied from interface:OutputConverter
Converts aTensor
into the specified output type.- Specified by:
convertToOutput
in interfaceOutputConverter<Regressor>
- Parameters:
tensor
- The tensor to convert.outputIDInfo
- The output info to use to identify the outputs.- Returns:
- A output.
-
convertToBatchPrediction
public List<Prediction<Regressor>> convertToBatchPrediction(org.tensorflow.Tensor tensor, ImmutableOutputInfo<Regressor> outputIDInfo, int[] numValidFeatures, List<Example<Regressor>> examples) Description copied from interface:OutputConverter
Converts aTensor
containing multiple outputs into a list ofPrediction
s.- Specified by:
convertToBatchPrediction
in interfaceOutputConverter<Regressor>
- Parameters:
tensor
- The tensor to convert.outputIDInfo
- The output info to use to identify the outputs.numValidFeatures
- The number of valid features used by the prediction.examples
- The example to insert into the prediction.- Returns:
- A list of predictions.
-
convertToBatchOutput
public List<Regressor> convertToBatchOutput(org.tensorflow.Tensor tensor, ImmutableOutputInfo<Regressor> outputIDInfo) Description copied from interface:OutputConverter
Converts aTensor
containing multiple outputs into a list ofOutput
s.- Specified by:
convertToBatchOutput
in interfaceOutputConverter<Regressor>
- Parameters:
tensor
- The tensor to convert.outputIDInfo
- The output info to use to identify the outputs.- Returns:
- A list of outputs.
-
convertToTensor
public org.tensorflow.Tensor convertToTensor(Regressor example, ImmutableOutputInfo<Regressor> outputIDInfo) Description copied from interface:OutputConverter
Converts anOutput
into aTensor
representing it's output.- Specified by:
convertToTensor
in interfaceOutputConverter<Regressor>
- Parameters:
example
- The output to convert.outputIDInfo
- The output info to use to identify the outputs.- Returns:
- A Tensor representing this output.
-
convertToTensor
public org.tensorflow.Tensor convertToTensor(List<Example<Regressor>> examples, ImmutableOutputInfo<Regressor> outputIDInfo) Description copied from interface:OutputConverter
Converts a list ofExample
into aTensor
representing all the outputs in the list. It accepts a list of Example rather than a list of Output for efficiency reasons.- Specified by:
convertToTensor
in interfaceOutputConverter<Regressor>
- Parameters:
examples
- The examples to convert.outputIDInfo
- The output info to use to identify the outputs.- Returns:
- A Tensor representing all the supplied Outputs.
-
generatesProbabilities
public boolean generatesProbabilities()Description copied from interface:OutputConverter
Does this OutputConverter generate probabilities.- Specified by:
generatesProbabilities
in interfaceOutputConverter<Regressor>
- Returns:
- True if it produces a probability distribution in the
Prediction
.
-
toString
-
getProvenance
public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()- Specified by:
getProvenance
in interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
-