Package com.yahoo.labs.samoa.instances
Class MultiLabelPrediction
- java.lang.Object
-
- com.yahoo.labs.samoa.instances.MultiLabelPrediction
-
- All Implemented Interfaces:
Prediction
,Serializable
public class MultiLabelPrediction extends Object implements Prediction, Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected DoubleVector[]
prediction
-
Constructor Summary
Constructors Constructor Description MultiLabelPrediction()
MultiLabelPrediction(int numOutputAttributes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getVote(int outputAttributeIndex, int classIndex)
The vote assigned to a class of an output attributedouble[]
getVotes()
The votes for the first output attributedouble[]
getVotes(int outputAttributeIndex)
The votes for a given output attributeboolean
hasVotesForAttribute(int outputAttributeIndex)
Checks if there are votes for a given output attributeint
numClasses(int outputAttributeIndex)
Different output attributes may have different number of classes.int
numOutputAttributes()
Number of output attributes.void
setVote(int outputAttributeIndex, int classIndex, double vote)
Sets the vote for class of a given output attributevoid
setVotes(double[] votes)
Sets the votes for the first output attributevoid
setVotes(int outputAttributeIndex, double[] votes)
Sets the votes for a given output attributeint
size()
The size of the prediction, that is the number of output attributesString
toString()
The text of the prediction, that is the description of the values of the prediction
-
-
-
Field Detail
-
prediction
protected DoubleVector[] prediction
-
-
Method Detail
-
numOutputAttributes
public int numOutputAttributes()
Description copied from interface:Prediction
Number of output attributes.- Specified by:
numOutputAttributes
in interfacePrediction
- Returns:
- the number of output attributes
-
numClasses
public int numClasses(int outputAttributeIndex)
Description copied from interface:Prediction
Different output attributes may have different number of classes. Regressors have one class per output attribute.- Specified by:
numClasses
in interfacePrediction
- Returns:
- the number of classes for attribute attributeIndex
-
getVotes
public double[] getVotes(int outputAttributeIndex)
Description copied from interface:Prediction
The votes for a given output attribute- Specified by:
getVotes
in interfacePrediction
- Returns:
- the votes for a given output attribute outputAttributeIndex.
-
getVotes
public double[] getVotes()
Description copied from interface:Prediction
The votes for the first output attribute- Specified by:
getVotes
in interfacePrediction
- Returns:
- the votes for the first output attribute outputAttributeIndex.
-
getVote
public double getVote(int outputAttributeIndex, int classIndex)
Description copied from interface:Prediction
The vote assigned to a class of an output attribute- Specified by:
getVote
in interfacePrediction
- Returns:
- the vote for an output attribute outputAttributeIndex and a class classIndex.
-
setVotes
public void setVotes(int outputAttributeIndex, double[] votes)
Description copied from interface:Prediction
Sets the votes for a given output attribute- Specified by:
setVotes
in interfacePrediction
-
setVotes
public void setVotes(double[] votes)
Description copied from interface:Prediction
Sets the votes for the first output attribute- Specified by:
setVotes
in interfacePrediction
-
setVote
public void setVote(int outputAttributeIndex, int classIndex, double vote)
Description copied from interface:Prediction
Sets the vote for class of a given output attribute- Specified by:
setVote
in interfacePrediction
-
toString
public String toString()
Description copied from interface:Prediction
The text of the prediction, that is the description of the values of the prediction- Specified by:
toString
in interfacePrediction
- Overrides:
toString
in classObject
- Returns:
- the text
-
hasVotesForAttribute
public boolean hasVotesForAttribute(int outputAttributeIndex)
Description copied from interface:Prediction
Checks if there are votes for a given output attribute- Specified by:
hasVotesForAttribute
in interfacePrediction
- Returns:
- the votes for the first output attribute outputAttributeIndex.
-
size
public int size()
Description copied from interface:Prediction
The size of the prediction, that is the number of output attributes- Specified by:
size
in interfacePrediction
- Returns:
- the votes for the first output attribute outputAttributeIndex.
-
-