|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.DistributionClassifier
weka.classifiers.EnsembleClassifier
weka.classifiers.meta.SemiSupDecorate
Class for creating Semi-Supervised Diverse Ensembles of a Classifier Valid options are:
-W classname
Specify the full class name of a weak as the basis for
SemiSupDecorate (required).
-I num
Set the number of SemiSupDecorate iterations (default 50).
-N num
Specify the desired size of the committee (default 15).
-S seed
Random number seed for generating random examples (default random).
-R num
Number of random instances to add at each iteration (default 20).
Options after -- are passed to the designated classifier.
Field Summary | |
protected int |
labeling_method
Method to use for labeling randomly generated instances. |
protected Classifier |
m_Classifier
The model base classifier to use |
protected int |
m_DataCreationMethod
Method to use for creation of artificial data |
protected int |
m_DesiredSize
The number of iterations. |
protected int |
m_NumIterations
The number of iterations. |
protected double |
m_RandomSize
Number of random instances to add at each iteration. |
protected int |
m_Seed
The seed for random number generation. |
protected double |
m_Threshold
Confidence threshold above committee decisions are to be trusted. |
protected Instances |
m_Unlabeled
Unlabeled instances |
protected int |
m_UseWeights
Use weights for committe votes - default equal wts |
Fields inherited from class weka.classifiers.EnsembleClassifier |
m_EnsembleWts, m_SumEnsembleWts, m_TrainEnsembleDiversity, m_TrainEnsembleError, m_TrainError |
Constructor Summary | |
SemiSupDecorate()
|
Method Summary | |
protected void |
addInstances(Instances div_data,
Instances random_data)
|
void |
buildClassifier(Instances data)
SemiSupDecorate method. |
protected double |
computeAccuracy(Instances data)
Computes classification accuracy on the given data. |
protected double |
computeEnsembleWt(Classifier classifier,
Instances data)
Compute ensemble weight. |
protected double |
computeError(Instances data)
Computes the error in classification on the given data. |
protected void |
computeStats(Instances data)
Find and store mean and std devs for numeric attributes. |
double[] |
distributionForInstance(Instance instance)
Calculates the class membership probabilities for the given test instance. |
double[] |
distributionForInstanceUsingWeights(Instance instance)
Calculates the class membership probabilities for the given test instance. |
protected Instances |
generateRandomData(int random_size,
int num_attributes,
Instances data)
|
Classifier |
getClassifier()
Get the classifier used as the classifier |
int |
getDataCreationMethod()
Method to use for creating artificial data |
int |
getDesiredSize()
Gets the desired size of the committee. |
double[] |
getEnsemblePredictions(Instance instance)
Returns class predictions of each ensemble member |
double |
getEnsembleSize()
Returns size of ensemble |
double[] |
getEnsembleWts()
Returns vote weights of ensemble members. |
int |
getNumIterations()
Gets the number of bagging iterations |
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier. |
double |
getRandomSize()
Number of random instances to add at each iteration. |
int |
getSeed()
Gets the seed for the random number generations |
double |
getThreshold()
Get the value of threshold. |
int |
getUseWeights()
Get flag for using weights for committee votes. |
protected int |
highProbLabel(double[] probs)
Probabilisticly select class label - (high probability). |
protected Instances |
labelData(Instances random_data,
double threshold)
Labels the randomly generated data. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options |
protected int |
lowProbLabel(double[] probs)
Probabilisticly select class label - (low probability). |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
protected void |
removeInstances(Instances div_data,
int random_size)
|
protected Instances |
sampleUnlabeledData(int sampleSize,
Instances unlabeled)
Sample the pool of unlabeled data with replacement. |
protected double |
selectNominalValue(double[] cumm)
Given cummaltive probabilities select a nominal value index |
protected double |
selectThreshold(double error)
Set threshold for relabeling based on user specified threhsold or on error of current committee |
void |
setClassifier(Classifier newClassifier)
Set the classifier for bagging. |
void |
setDataCreationMethod(int method)
Sets method to use for creating artificial data |
void |
setDesiredSize(int new_desired_size)
Sets the desired size of the committee. |
void |
setNumIterations(int numIterations)
Sets the number of bagging iterations |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setRandomSize(double new_random_size)
Sets number of random instances to add at each iteration. |
void |
setSeed(int seed)
Set the seed for random number generation. |
void |
setThreshold(double v)
Set the value of threshold. |
void |
setUnlabeled(Instances unlabeled)
Provide unlabeled data to the classifier. |
void |
setUseWeights(int newUseWeights)
Set flag for using weights for committee votes. |
java.lang.String |
toString()
Returns description of the bagged classifier. |
Methods inherited from class weka.classifiers.EnsembleClassifier |
computeEnsembleMeasures, enumerateMeasures, getMeasure, initMeasures, measureTrainEnsembleDiversity, measureTrainEnsembleError, measureTrainError, updateEnsembleStats |
Methods inherited from class weka.classifiers.DistributionClassifier |
calculateEntropy, calculateLabeledInstanceMargin, calculateMargin, classifyInstance |
Methods inherited from class weka.classifiers.Classifier |
forName, makeCopies |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Instances m_Unlabeled
protected int m_UseWeights
protected Classifier m_Classifier
protected int m_NumIterations
protected int m_DesiredSize
protected int m_Seed
protected double m_RandomSize
protected double m_Threshold
protected int m_DataCreationMethod
protected int labeling_method
Constructor Detail |
public SemiSupDecorate()
Method Detail |
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-W classname
Specify the full class name of a weak classifier as the basis for
bagging (required).
-I num
Set the number of bagging iterations (default 50).
-S seed
Random number seed for resampling (default 0).
-N num
Specify the desired size of the committee (default 15).
-R num
Number of random instances to add at each iteration (default 5).
Options after -- are passed to the designated classifier.
setOptions
in interface OptionHandler
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public void setUseWeights(int newUseWeights)
newUseWeights
- flag for using weights for committee votes.public int getUseWeights()
public void setClassifier(Classifier newClassifier)
newClassifier
- the Classifier to use.public Classifier getClassifier()
public int getDataCreationMethod()
public void setDataCreationMethod(int method)
method
- the method to use for creating artificial datapublic double getRandomSize()
public void setRandomSize(double new_random_size)
new_random_size
- the number of random instances to add at each iteration.public int getDesiredSize()
public void setDesiredSize(int new_desired_size)
public void setNumIterations(int numIterations)
public int getNumIterations()
public void setSeed(int seed)
seed
- the seedpublic int getSeed()
public double getThreshold()
public void setThreshold(double v)
v
- Value to assign to threshold.public void setUnlabeled(Instances unlabeled)
setUnlabeled
in interface SemiSupClassifier
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- the training data to be used for generating the
bagged classifier.
java.lang.Exception
- if the classifier could not be built successfullyprotected Instances sampleUnlabeledData(int sampleSize, Instances unlabeled)
sampleSize
- desired size of random sampleunlabeled
- pool of unlabled data to sample from
protected void computeStats(Instances data)
data
- training instancesprotected Instances generateRandomData(int random_size, int num_attributes, Instances data)
protected double selectNominalValue(double[] cumm)
protected double selectThreshold(double error)
error
- Error of current committee
protected Instances labelData(Instances random_data, double threshold) throws java.lang.Exception
random_data
- the randomly generated instances
java.lang.Exception
- if instances cannot be labeled successfullyprotected int highProbLabel(double[] probs)
probs
- posterior probability of each class
protected int lowProbLabel(double[] probs) throws java.lang.Exception
probs
- posterior probability of each class
java.lang.Exception
- if instances cannot be labeled successfullyprotected void removeInstances(Instances div_data, int random_size)
div_data
- given instancesrandom_size
- number of instances to delete from the end of given instancesprotected void addInstances(Instances div_data, Instances random_data)
div_data
- given instancesrandom_data
- set of instances to add to given instancesprotected double computeError(Instances data) throws java.lang.Exception
data
- the instances to be classified
java.lang.Exception
- if error can not be computed successfullyprotected double computeEnsembleWt(Classifier classifier, Instances data) throws java.lang.Exception
classifier
- current classifierdata
- instances to compute accuracy on
java.lang.Exception
- if weight cannot be computed successfullyprotected double computeAccuracy(Instances data) throws java.lang.Exception
data
- the instances to be classified
java.lang.Exception
- if error can not be computed successfullypublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance
in class DistributionClassifier
instance
- the instance to be classified
java.lang.Exception
- if distribution can't be computed successfullypublic double[] distributionForInstanceUsingWeights(Instance instance) throws java.lang.Exception
instance
- the instance to be classified
java.lang.Exception
- if distribution can't be computed successfullypublic double[] getEnsemblePredictions(Instance instance) throws java.lang.Exception
getEnsemblePredictions
in class EnsembleClassifier
java.lang.Exception
public double[] getEnsembleWts()
getEnsembleWts
in class EnsembleClassifier
public double getEnsembleSize()
getEnsembleSize
in class EnsembleClassifier
public java.lang.String toString()
public static void main(java.lang.String[] argv)
argv
- the options
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |