weka.core
Class SoftClassifiedFullInstance

java.lang.Object
  extended byweka.core.Instance
      extended byweka.core.SoftClassifiedFullInstance
All Implemented Interfaces:
Copyable, java.io.Serializable, SoftClassifiedInstance

public class SoftClassifiedFullInstance
extends Instance
implements SoftClassifiedInstance

An Instance that has a probability distribution across class values. Particularly useful for EM using a SoftClassifier

See Also:
Serialized Form

Field Summary
protected  double[] m_ClassDistribution
          An array of probabilities giving the probability of each class for this Instance
 
Fields inherited from class weka.core.Instance
m_AttValues, m_Dataset, m_Weight, MISSING_VALUE
 
Constructor Summary
SoftClassifiedFullInstance()
           
SoftClassifiedFullInstance(Instance instance)
          Constructor that copies the attribute values and the weight from the given instance and gives SoftInstance random class probabilities that assign all probability (1) to the instance's given class
SoftClassifiedFullInstance(Instance instance, java.util.Random randomizer)
          Constructor that copies the attribute values and the weight from the given instance and gives SoftInstance random class probabilities generated by the given randomizer.
 
Method Summary
 java.lang.Object copy()
          Produces a shallow copy of this instance.
 double[] getClassDistribution()
          Get the class distribution for this instance
 double getClassProbability(int classNum)
          Return the probability the instance is in the given class
protected  double[] randomClassDistribution(java.util.Random randomizer)
          Return a random class distribution
 void setClassDistribution(double[] dist)
          Set the class distribution for this instance
 void setClassProbability(int classNum, double prob)
          Set the probability the instance is in the given class
 
Methods inherited from class weka.core.Instance
attribute, attributeSparse, classAttribute, classIndex, classIsMissing, classValue, dataset, deleteAttributeAt, enumerateAttributes, equalHeaders, index, insertAttributeAt, isMissing, isMissing, isMissingSparse, isMissingValue, main, mergeInstance, missingValue, numAttributes, numClasses, numValues, replaceMissingValues, setClassMissing, setClassValue, setClassValue, setDataset, setMissing, setMissing, setValue, setValue, setValue, setValue, setValueArray, setValueSparse, setWeight, stringValue, stringValue, toDoubleArray, toString, toString, toString, value, value, valueSparse, weight
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_ClassDistribution

protected double[] m_ClassDistribution
An array of probabilities giving the probability of each class for this Instance

Constructor Detail

SoftClassifiedFullInstance

public SoftClassifiedFullInstance(Instance instance,
                                  java.util.Random randomizer)
Constructor that copies the attribute values and the weight from the given instance and gives SoftInstance random class probabilities generated by the given randomizer.


SoftClassifiedFullInstance

public SoftClassifiedFullInstance(Instance instance)
Constructor that copies the attribute values and the weight from the given instance and gives SoftInstance random class probabilities that assign all probability (1) to the instance's given class


SoftClassifiedFullInstance

public SoftClassifiedFullInstance()
Method Detail

randomClassDistribution

protected double[] randomClassDistribution(java.util.Random randomizer)
Return a random class distribution


getClassProbability

public double getClassProbability(int classNum)
Return the probability the instance is in the given class

Specified by:
getClassProbability in interface SoftClassifiedInstance

setClassProbability

public void setClassProbability(int classNum,
                                double prob)
Set the probability the instance is in the given class

Specified by:
setClassProbability in interface SoftClassifiedInstance

getClassDistribution

public double[] getClassDistribution()
Get the class distribution for this instance

Specified by:
getClassDistribution in interface SoftClassifiedInstance

setClassDistribution

public void setClassDistribution(double[] dist)
                          throws java.lang.Exception
Set the class distribution for this instance

Specified by:
setClassDistribution in interface SoftClassifiedInstance
Throws:
java.lang.Exception

copy

public java.lang.Object copy()
Produces a shallow copy of this instance. The copy has access to the same dataset. (if you want to make a copy that doesn't have access to the dataset, use new Instance(instance)

Specified by:
copy in interface Copyable
Overrides:
copy in class Instance
Returns:
the shallow copy