|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--milk.core.Exemplar
Class for handling an ordered set of weighted exemplars.
This class is not intended for reading directly from the Reader.
Instead, the data should be pre-processed and then are tried to
form an exemplar.
The following members are still useful from the Instances class
in the context of exemplar by using getInstances()
attribute(int)
attribute(String)
attributeStats(int)
attributeToDoubleArray(int)
checkForStringAttributes()
checkInstance(Instance)
classAttribute()
classIndex()
compactify()
delete()
delete(int)
deleteWithMissing(Attribute)
deleteWithMissing(int)
enumerateInstances()
firstInstance()
instance(int)
lastInstance()
meanOrMode(Attribute)
meanOrMode(int)
numAttributes()
numClasses()
numDistinctValues(Attribute)
numDistinctValues(int)
numInstances()
randomize(Random)
renameAttribute(Attribute, String)
renameAttribute(int, String)
renameAttributeValue(Attribute, String, String)
renameAttributeValue(int, int, String)
resample(Random)
resampleWithWeights(Random)
resampleWithWeights(Random, double[])
sort(Attribute)
sort(int)
stringFreeStructure()
sumOfWeights()
variance(Attribute)
variance(int)
Typical usage is to read the instances from the Reader and try to feed
it into into an array of Exemplars according to it's ID values
| Constructor Summary | |
Exemplar(Exemplar exemplar)
Constructor to form an exemplar by copying from another exemplar |
|
Exemplar(Exemplar exemplar,
int size)
Constructor creating an empty Exemplar with the same structure of the given exemplar and the given size |
|
Exemplar(weka.core.Instance inst,
int id)
Constructor using one instance to form an exemplar |
|
Exemplar(weka.core.Instances dataset)
Constructor copying all instances and references to the header information from the given set of instances. |
|
Exemplar(weka.core.Instances dataset,
int id)
Constructor creating an exemplar with the given dataset and the given ID index |
|
| Method Summary | |
void |
add(weka.core.Instance instance)
Adds one instance to the end of the set. |
boolean |
checkInstance(weka.core.Instance instance)
Checks if the given instance is compatible with this Exemplar. |
weka.core.Attribute |
classAttribute()
Returns the class attribute. |
int |
classIndex()
Returns the class attribute's index. |
double |
classValue()
Returns the class value of this exemplar. |
void |
compactify()
Compactifies the set of instances in this exemplar |
void |
deleteAttributeAt(int position)
Deletes an attribute at the given position (0 to numAttributes() - 1). |
java.util.Enumeration |
enumerateAttributes()
Returns an enumeration of all the attributes. |
weka.core.Instances |
getInstances()
Returns the dataset in this exemplar |
weka.core.Attribute |
idAttribute()
Returns the ID attribute. |
int |
idIndex()
Returns the ID attribute's index. |
double |
idValue()
Returns the ID attribute's value. |
void |
insertAttributeAt(weka.core.Attribute att,
int position)
Inserts an attribute at the given position (0 to numAttributes()) and sets all values to be missing. |
boolean |
isAllMissing(int attIndex)
Check whether the values of the specified attribute in this exemplar are all missing values |
static void |
main(java.lang.String[] args)
Main method for testing this class -- just prints out a set of Exemplars. |
double[] |
meanOrMode()
Returns the mean (mode) for all attributes (except ID and class) as a floating-point value. |
int |
numIds()
Returns the number of ID labels. |
void |
setClassValue(double cv)
Sets the class value of the exemplar |
void |
setWeight(double weight)
Sets the weight of the exemplar. |
java.lang.String |
toString()
Returns the exemplar as a string. |
double[] |
variance()
Computes the variances for all numeric attributes. |
double |
weight()
Returns the exemplar's weight. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Exemplar(weka.core.Instance inst,
int id)
id - the ID index
public Exemplar(Exemplar exemplar,
int size)
exemplar - the given exemplarsize - the given sizepublic Exemplar(Exemplar exemplar)
exemplar - the copied exemplar
public Exemplar(weka.core.Instances dataset)
throws java.lang.Exception
if - the exemplar cannot be built properly
java.lang.Exception
public Exemplar(weka.core.Instances dataset,
int id)
throws java.lang.Exception
id - the index of the ID of the exemplar| Method Detail |
public final void add(weka.core.Instance instance)
instance - the instance to be addedpublic final boolean checkInstance(weka.core.Instance instance)
public final weka.core.Attribute classAttribute()
weka.core.UnassignedClassException - if the class is not setpublic final int classIndex()
public final double classValue()
weka.core.UnassignedClassException - if the class is not setpublic void setClassValue(double cv)
cv - the new class valuepublic final void compactify()
public void deleteAttributeAt(int position)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - if the given index is out of range or the
class attribute is being deletedpublic java.util.Enumeration enumerateAttributes()
public weka.core.Instances getInstances()
public final weka.core.Attribute idAttribute()
public final int idIndex()
public final double idValue()
public void insertAttributeAt(weka.core.Attribute att,
int position)
att - the attribute to be inserted
java.lang.IllegalArgumentException - if the given index is out of rangepublic final double[] meanOrMode()
public final double[] variance()
public final int numIds()
public final void setWeight(double weight)
weight - the weightpublic final java.lang.String toString()
toString in class java.lang.Objectpublic final double weight()
public final boolean isAllMissing(int attIndex)
attIndex - the specified attribute index
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||