|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.io.BaseStorable
de.fu_berlin.ties.classify.Prediction
public class Prediction
A prediction, wrapping the predicted class and the probability of the prediction.
Instances of this class are not thread-safe and must be synchronized externally, if required.
Field Summary | |
---|---|
static String |
KEY_PR
Serialization key for the pR. |
static String |
KEY_PROB
Serialization key for the probability. |
static String |
KEY_SOURCE
Serialization key for the source identifier. |
static String |
KEY_TYPE
Serialization key for the predicted class. |
Constructor Summary | |
---|---|
Prediction(FieldMap fieldMap)
Creates a new instance from a field map, fulfilling the Storable contract. |
|
Prediction(String predicted,
Probability prob)
Creates a new instance, setting the evaluation status to EvalStatus.UNKNOWN . |
|
Prediction(String predicted,
Probability prob,
EvalStatus status)
Creates a new instance. |
|
Prediction(String predicted,
String sourceID,
Probability prob,
EvalStatus status)
Creates a new instance. |
Method Summary | |
---|---|
protected void |
addProb(Probability prob,
boolean atEnd)
Adds a new probability for the prediction. |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one, fulfulling the Object.equals(java.lang.Object) contract. |
EvalStatus |
getEvalStatus()
Returns the evaluation status of this instance. |
Probability |
getProbability()
Calculates and returns the average probability. |
String |
getSource()
Returns the identifier of the source of this prediction (e.g., the file name). |
String |
getType()
Returns the predicted type (class). |
int |
hashCode()
Returns a hash code value for this object, fulfulling the Object.hashCode() contract. |
protected int |
probCount()
Returns the number of probabilities combined in this prediction. |
protected Probability |
removeProb(boolean atEnd)
Deletes one of the probabilities used for the prediction. |
void |
setEvalStatus(EvalStatus newEvalStatus)
Modifies the evaluation status of this instance. |
void |
setSource(String newSource)
Sets the identifier of the source of this prediction (e.g., the file name). |
FieldMap |
storeFields()
Stores all relevant fields of this object in a field map for serialization. |
Methods inherited from class de.fu_berlin.ties.io.BaseStorable |
---|
toString, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String KEY_TYPE
public static final String KEY_SOURCE
public static final String KEY_PROB
public static final String KEY_PR
Constructor Detail |
---|
public Prediction(FieldMap fieldMap)
Storable
contract.
fieldMap
- map containing the serialized fieldspublic Prediction(String predicted, Probability prob)
EvalStatus.UNKNOWN
.
predicted
- the predicted typeprob
- the probability of the predictionpublic Prediction(String predicted, Probability prob, EvalStatus status)
predicted
- the predicted typeprob
- the probability of the predictionstatus
- the evaluation status of this
instancepublic Prediction(String predicted, String sourceID, Probability prob, EvalStatus status)
predicted
- the predicted typesourceID
- an identifier of the source of this prediction (e.g., the
file name), might be null
prob
- the probability of the predictionstatus
- the evaluation status of this
instanceMethod Detail |
---|
protected void addProb(Probability prob, boolean atEnd)
prob
- the new probability; might be null
if the overall probability of the extraction should not be changedatEnd
- whether to add the new probability at the end or at the
startpublic boolean equals(Object obj)
Object.equals(java.lang.Object)
contract.
Evaluation status and
probability
are ignored when checking equality, only type
and source are compared.
equals
in class Object
obj
- the reference object with which to compare
true
iff the specified object is a
Prediction
equal to this instancepublic EvalStatus getEvalStatus()
public Probability getProbability()
public String getSource()
null
if none
specifiedpublic String getType()
public int hashCode()
Object.hashCode()
contract.
hashCode
in class Object
protected int probCount()
protected Probability removeProb(boolean atEnd) throws IllegalStateException
probCount()
must be 2 or
more prior to calling this method.
atEnd
- whether to delete the first or the last probability
IllegalStateException
- if there is only one probability leftpublic void setEvalStatus(EvalStatus newEvalStatus)
newEvalStatus
- the new value of the attributepublic void setSource(String newSource)
newSource
- the new value of the attribute; or null
to
delete the current valuepublic FieldMap storeFields()
FieldMap.createObject(Class)
on the created
field map.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |