|
|||||||||||
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
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,
double prob,
double pr)
Creates a new instance, setting the evaluation status to EvalStatus.UNKNOWN . |
|
Prediction(String predicted,
double prob,
double pr,
EvalStatus status)
Creates a new instance. |
|
Prediction(String predicted,
String sourceID,
double prob,
double pr,
EvalStatus status)
Creates a new instance. |
Method Summary | |
protected void |
addProb(double newProb,
double newPR)
Adds a new probability/pR of 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. |
double |
getPR()
Returns the pR of the prediction: pR = log(p / (1-p)). |
double |
getProbability()
Returns the 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. |
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, double prob, double pr)
EvalStatus.UNKNOWN
.
predicted
- the predicted typeprob
- the probability of the prediction (must be in the range from
0.0 to 1.0; or -1 if this is a confirmed prediction or an answer key)pr
- the pR of the prediction;
or Double.NaN
if not knownpublic Prediction(String predicted, double prob, double pr, EvalStatus status)
predicted
- the predicted typeprob
- the probability of the prediction (must be in the range from
0.0 to 1.0; or -1 if this is a confirmed prediction or an answer key)pr
- the pR of the prediction;
or Double.NaN
if not knownstatus
- the evaluation status of this
instancepublic Prediction(String predicted, String sourceID, double prob, double pr, 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 prediction (must be in the range from
0.0 to 1.0; or -1 if this is a confirmed prediction or an answer key)pr
- the pR of the prediction;
or Double.NaN
if not knownstatus
- the evaluation status of this
instanceMethod Detail |
protected void addProb(double newProb, double newPR) throws IllegalArgumentException
newProb
- the new probability (should be in the range from 0.0
to 1.0)newPR
- the new pR; or Double.NaN
if not used
IllegalArgumentException
- if this is an answer key; if
newProb
is not a valid probability; or if either the old or
the new pR is not-a-number, but not bothpublic boolean equals(Object obj)
Object.equals(java.lang.Object)
contract.
Evaluation status,
probability and pR
are ignored when checking equality, only type
and source are compared.
obj
- the reference object with which to compare
true
iff the specified object is a
Prediction
equal to this instancepublic EvalStatus getEvalStatus()
public double getPR()
Double.NaN
if not knownpublic double getProbability()
public String getSource()
null
if none
specifiedpublic String getType()
public int hashCode()
Object.hashCode()
contract.
public 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 |