|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.udo.cs.yale.operator.AbstractIOObject
edu.udo.cs.yale.operator.ResultObjectAdapter
edu.udo.cs.yale.operator.AbstractModel
edu.udo.cs.yale.operator.IOModel
edu.udo.cs.yale.operator.learner.PredictionModel
public abstract class PredictionModel
PredictionModel is the superclass for all objects generated by learners, i.e. it can be used to create a prediction for a given example set. Please note that each subclass must provide a zero-argument constructor in order to allow model creation by reflection.
| Field Summary | |
|---|---|
private Attribute |
label
We remember the target attribute in order to be able to create predicted label attributes based on this type. |
| Constructor Summary | |
|---|---|
protected |
PredictionModel()
Invokes the super constructor. |
protected |
PredictionModel(Attribute label)
|
| Method Summary | |
|---|---|
void |
apply(ExampleSet exampleSet)
Applies the model by creating a predicted label attribue and setting the predicted label values. |
protected Attribute |
createPredictedLabel(ExampleSet exampleSet)
Creates a predicted label for the given example set based on the label attribute defined for this prediction model. |
Attribute |
getLabel()
Returns the label attribute. |
abstract void |
performPrediction(ExampleSet exampleSet,
Attribute predictedLabel)
Subclasses should iterated through the given example set and set the prediction for each example. |
void |
readData(java.io.ObjectInputStream in)
Reads the label information and creates a label attribute. |
abstract void |
readPredictionModelData(java.io.ObjectInputStream in)
Reads the model data (without label). |
static void |
removePredictedLabel(ExampleSet exampleSet)
Helper method in order to lower memory consumption. |
void |
setLabel(Attribute label)
Sets the label attribute. |
java.lang.String |
toString()
|
void |
writeData(java.io.ObjectOutputStream out)
Writes the label information. |
abstract void |
writePredictionModelData(java.io.ObjectOutputStream out)
Writes the model data (without label). |
| Methods inherited from class edu.udo.cs.yale.operator.AbstractModel |
|---|
equals, getExtension, getFileDescription, readModel, readModel, save, setParameter, writeModel, writeModel |
| Methods inherited from class edu.udo.cs.yale.operator.ResultObjectAdapter |
|---|
addAction, getActions, getName, getVisualisationComponent, toHTML, toResultString |
| Methods inherited from class edu.udo.cs.yale.operator.AbstractIOObject |
|---|
copy, read, read, read, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface edu.udo.cs.yale.operator.ResultObject |
|---|
getActions, getName, getVisualisationComponent, toResultString |
| Methods inherited from interface edu.udo.cs.yale.operator.IOObject |
|---|
copy, write, write |
| Field Detail |
|---|
private transient Attribute label
| Constructor Detail |
|---|
protected PredictionModel()
protected PredictionModel(Attribute label)
| Method Detail |
|---|
public abstract void performPrediction(ExampleSet exampleSet,
Attribute predictedLabel)
throws OperatorException
OperatorException
public abstract void readPredictionModelData(java.io.ObjectInputStream in)
throws java.io.IOException
java.io.IOException
public abstract void writePredictionModelData(java.io.ObjectOutputStream out)
throws java.io.IOException
java.io.IOException
public void readData(java.io.ObjectInputStream in)
throws java.io.IOException
readPredictionModelData(ObjectInputStream).
readData in class IOModeljava.io.IOException
public void writeData(java.io.ObjectOutputStream out)
throws java.io.IOException
writePredictionModelData(ObjectOutputStream).
writeData in class AbstractModeljava.io.IOException
public void apply(ExampleSet exampleSet)
throws OperatorException
OperatorExceptionpublic void setLabel(Attribute label)
public Attribute getLabel()
protected Attribute createPredictedLabel(ExampleSet exampleSet)
exampleSet.replaceAttribute(predictedLabel, AttributeFactory.changeValueType(predictedLabel, Ontology.REAL)); .
This might be usefull in cases where a crisp nominal prediction should be
replace by confidence predictions.
public java.lang.String toString()
toString in class java.lang.Objectpublic static void removePredictedLabel(ExampleSet exampleSet)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||