public class MultiPropertyEntry extends BaseEntry
Users of entries that extend this class can designate a property as the class
variable using setTargetProperty(int)
. Often, this is performed through various
commands from the MultiPropertyDataset
. You may notice that names of
properties are not stored in this class, and they are actually stored in MultiPropertyDataset.
This is to reminder users that they should access properties through the Dataset.
If the "target" property is set to "-1", this class functions as a normal BaseEntry.
MultiPropertyDataset
,
Serialized FormConstructor and Description |
---|
MultiPropertyEntry() |
MultiPropertyEntry(double[] attributes)
Create a new entry, given attributes
|
Modifier and Type | Method and Description |
---|---|
void |
addProperty()
Add a new property to this entry.
|
void |
addProperty(double measuredValue)
Add a new property and define measured property.
|
void |
addProperty(double measuredValue,
double predictedValue)
Add a new property to this entry, set measured and predicted values
|
void |
clearPropertyData()
Remove all information about properties
|
MultiPropertyEntry |
clone()
Generates a clone of an entry.
|
void |
deleteMeasuredClass()
Delete measured class variable.
|
void |
deletePredictedClass()
Delete predicted class variable.
|
double[] |
getClassProbilities()
Get the probability of an entry existing in each class.
|
double |
getMeasuredClass()
Get the measured class variable
|
double[] |
getMeasuredProperties()
Get copy all measured properties.
|
double |
getMeasuredProperty(int index)
Get a single measured property.
|
double |
getPredictedClass()
Get the predicted class variable
|
double |
getPredictedProperty(int index)
Get the predicted properties for an instance.
|
double[] |
getPropertyClassProbabilties(int index)
Get the predicted class probabilities for a certain property.
|
int |
getTargetProperty()
Look up which property is being used as the class variable.
|
boolean |
hasClassProbabilities()
Whether this entry has predicted probabilities
|
boolean |
hasMeasuredProperty(int index)
Whether a specific property of this entry has been measured
|
boolean |
hasMeasurement() |
boolean |
hasPredictedProperty(int index)
Whether an specific property has any predicted value
|
boolean |
hasPrediction() |
boolean |
hasPropertyClassProbabilities(int index)
Check whether a property has predicted class probabilities
|
int |
NProperties() |
void |
setClassProbabilities(double[] probabilites)
Set the predicted probability of a entry existing in each class
|
void |
setMeasuredClass(double x)
Set the measured class variable
|
void |
setMeasuredProperties(double[] newValues)
Define the values of all measured properties of this entry.
|
void |
setMeasuredProperty(int index,
double newValue)
Set the measured value of a specific property of this entry.
|
void |
setNProperties(int N)
Define the number of properties this entry can support.
|
void |
setPredictedClass(double x)
Set the predicted class variable
|
void |
setPredictedProperty(int index,
double newValue)
Directly set the predicted value of a property.
|
void |
setPredictedProperty(int index,
double[] newValues)
Directly set the probabilities of an entry existing in one of several classes.
|
void |
setTargetProperty(int index)
Define which property to use as the class variable.
|
org.json.JSONObject |
toJSON()
Print entry as a JSON object
|
boolean |
usingPropertyAsClass() |
addAttribute, addAttributes, clearAttributes, compare, compareTo, equals, getAttribute, getAttributes, hashCode, NAttributes, reduceMemoryFootprint, setAttribute, setAttributes, toHTMLString, toString
public MultiPropertyEntry()
public MultiPropertyEntry(double[] attributes)
attributes
- Attribute valuespublic MultiPropertyEntry clone()
BaseEntry
public void clearPropertyData()
public void setNProperties(int N)
N
- Number of properties this entry should be able to storepublic void addProperty()
public void addProperty(double measuredValue)
measuredValue
- Measured value of new propertyMultiPropertyDataset.addProperty(java.lang.String, java.lang.String[])
public void addProperty(double measuredValue, double predictedValue)
measuredValue
- Measured value of this property. Set to Double.NaN if unknown.predictedValue
- Predicted value of this property. Set to Double.NaN if unknown.MultiPropertyDataset.addProperty(java.lang.String, java.lang.String[]);
public double getMeasuredClass()
BaseEntry
getMeasuredClass
in class BaseEntry
public void setMeasuredClass(double x)
BaseEntry
setMeasuredClass
in class BaseEntry
x
- Measured classpublic double[] getMeasuredProperties()
public void setMeasuredProperties(double[] newValues)
This command will automatically reset the predicted properties, so use with caution.
newValues
- Values of all measured propertiespublic double getMeasuredProperty(int index)
index
- Index of measured property to retrievepublic double getPredictedClass()
BaseEntry
getPredictedClass
in class BaseEntry
public void setPredictedClass(double x)
BaseEntry
setPredictedClass
in class BaseEntry
x
- Predicted classpublic double[] getClassProbilities()
BaseEntry
getClassProbilities
in class BaseEntry
public double getPredictedProperty(int index)
index
- Index of property to retrievepublic double[] getPropertyClassProbabilties(int index)
index
- Index of property to retrievepublic int getTargetProperty()
public void setTargetProperty(int index)
index
- Index of property to usepublic boolean usingPropertyAsClass()
public boolean hasMeasuredProperty(int index)
index
- Index of property to testpublic boolean hasPredictedProperty(int index)
index
- Index of property to testpublic boolean hasMeasurement()
hasMeasurement
in class BaseEntry
public boolean hasPrediction()
hasPrediction
in class BaseEntry
public boolean hasClassProbabilities()
BaseEntry
hasClassProbabilities
in class BaseEntry
public boolean hasPropertyClassProbabilities(int index)
index
- Index of propertypublic void deleteMeasuredClass()
BaseEntry
deleteMeasuredClass
in class BaseEntry
public void deletePredictedClass()
BaseEntry
deletePredictedClass
in class BaseEntry
public void setClassProbabilities(double[] probabilites)
BaseEntry
setClassProbabilities
in class BaseEntry
probabilites
- Probability of entry being in each classpublic void setMeasuredProperty(int index, double newValue)
index
- Index of property to setnewValue
- New measured valuepublic void setPredictedProperty(int index, double newValue)
index
- Index of propertynewValue
- Its new value.public void setPredictedProperty(int index, double[] newValues)
index
- Index of propertynewValues
- Class probabilities. If null
, marks this
class as unsetpublic int NProperties()