public class MultiLabelConverter extends Object implements OutputConverter<MultiLabel>
MultiLabel
into a Tensor
containing a binary encoding of the label vector and
can convert a TFloat16
or TFloat32
into a Prediction
or a MultiLabel
.
Predictions are thresholded at THRESHOLD
, probabilities above this are considered to be present in the
output.
Modifier and Type | Field and Description |
---|---|
static double |
THRESHOLD |
Constructor and Description |
---|
MultiLabelConverter()
Constructs a MultiLabelConverter.
|
Modifier and Type | Method and Description |
---|---|
List<MultiLabel> |
convertToBatchOutput(org.tensorflow.Tensor tensor,
ImmutableOutputInfo<MultiLabel> outputIDInfo)
Converts a
Tensor containing multiple outputs into a list of Output s. |
List<Prediction<MultiLabel>> |
convertToBatchPrediction(org.tensorflow.Tensor tensor,
ImmutableOutputInfo<MultiLabel> outputIDInfo,
int[] numValidFeatures,
List<Example<MultiLabel>> examples)
Converts a
Tensor containing multiple outputs into a list of Prediction s. |
MultiLabel |
convertToOutput(org.tensorflow.Tensor tensor,
ImmutableOutputInfo<MultiLabel> outputIDInfo)
Converts a
Tensor into the specified output type. |
Prediction<MultiLabel> |
convertToPrediction(org.tensorflow.Tensor tensor,
ImmutableOutputInfo<MultiLabel> outputIDInfo,
int numValidFeatures,
Example<MultiLabel> example)
Converts a
Tensor into a Prediction . |
org.tensorflow.Tensor |
convertToTensor(List<Example<MultiLabel>> examples,
ImmutableOutputInfo<MultiLabel> outputIDInfo)
Converts a list of
Example into a Tensor representing all the outputs
in the list. |
org.tensorflow.Tensor |
convertToTensor(MultiLabel example,
ImmutableOutputInfo<MultiLabel> outputIDInfo)
Converts an
Output into a Tensor representing it's output. |
boolean |
generatesProbabilities()
Does this OutputConverter generate probabilities.
|
com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance |
getProvenance() |
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 sigmoid cross-entropy loss.
|
<V extends org.tensorflow.types.family.TNumber> |
outputTransformFunction()
Applies a softmax.
|
String |
toString() |
public static final double THRESHOLD
public MultiLabelConverter()
public 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()
loss
in interface OutputConverter<MultiLabel>
public <V extends org.tensorflow.types.family.TNumber> BiFunction<org.tensorflow.op.Ops,org.tensorflow.Operand<V>,org.tensorflow.op.Op> outputTransformFunction()
outputTransformFunction
in interface OutputConverter<MultiLabel>
V
- The softmax input type (should be TFloat32).public Prediction<MultiLabel> convertToPrediction(org.tensorflow.Tensor tensor, ImmutableOutputInfo<MultiLabel> outputIDInfo, int numValidFeatures, Example<MultiLabel> example)
OutputConverter
Tensor
into a Prediction
.convertToPrediction
in interface OutputConverter<MultiLabel>
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.public MultiLabel convertToOutput(org.tensorflow.Tensor tensor, ImmutableOutputInfo<MultiLabel> outputIDInfo)
OutputConverter
Tensor
into the specified output type.convertToOutput
in interface OutputConverter<MultiLabel>
tensor
- The tensor to convert.outputIDInfo
- The output info to use to identify the outputs.public List<Prediction<MultiLabel>> convertToBatchPrediction(org.tensorflow.Tensor tensor, ImmutableOutputInfo<MultiLabel> outputIDInfo, int[] numValidFeatures, List<Example<MultiLabel>> examples)
OutputConverter
Tensor
containing multiple outputs into a list of Prediction
s.convertToBatchPrediction
in interface OutputConverter<MultiLabel>
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.public List<MultiLabel> convertToBatchOutput(org.tensorflow.Tensor tensor, ImmutableOutputInfo<MultiLabel> outputIDInfo)
OutputConverter
Tensor
containing multiple outputs into a list of Output
s.convertToBatchOutput
in interface OutputConverter<MultiLabel>
tensor
- The tensor to convert.outputIDInfo
- The output info to use to identify the outputs.public org.tensorflow.Tensor convertToTensor(MultiLabel example, ImmutableOutputInfo<MultiLabel> outputIDInfo)
OutputConverter
Output
into a Tensor
representing it's output.convertToTensor
in interface OutputConverter<MultiLabel>
example
- The output to convert.outputIDInfo
- The output info to use to identify the outputs.public org.tensorflow.Tensor convertToTensor(List<Example<MultiLabel>> examples, ImmutableOutputInfo<MultiLabel> outputIDInfo)
OutputConverter
Example
into a Tensor
representing all the outputs
in the list. It accepts a list of Example rather than a list of Output for efficiency reasons.convertToTensor
in interface OutputConverter<MultiLabel>
examples
- The examples to convert.outputIDInfo
- The output info to use to identify the outputs.public boolean generatesProbabilities()
OutputConverter
generatesProbabilities
in interface OutputConverter<MultiLabel>
Prediction
.public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()
getProvenance
in interface com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.