本文整理了Java中weka.classifiers.rules.ZeroR.<init>()
方法的一些代码示例,展示了ZeroR.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZeroR.<init>()
方法的具体详情如下:
包路径:weka.classifiers.rules.ZeroR
类名称:ZeroR
方法名:<init>
暂无
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Default constructor.
*/
public CostSensitiveClassifier() {
m_Classifier = new weka.classifiers.rules.ZeroR();
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
protected void resetOptions() {
m_trainInstances = null;
m_Evaluation = null;
m_BaseClassifier = new ZeroR();
m_folds = 5;
m_seed = 1;
m_threshold = 0.01;
}
代码示例来源:origin: Waikato/weka-trunk
protected void resetOptions() {
m_trainInstances = null;
m_Evaluation = null;
m_BaseClassifier = new ZeroR();
m_folds = 5;
m_seed = 1;
m_threshold = 0.01;
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Default constructor.
*/
public CostSensitiveClassifier() {
m_Classifier = new weka.classifiers.rules.ZeroR();
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* reset to defaults
*/
protected void resetOptions() {
m_trainingInstances = null;
m_ClassifierTemplate = new ZeroR();
m_holdOutFile = new File("Click to set hold out or test instances");
m_holdOutInstances = null;
m_useTraining = false;
m_splitPercent = "90";
m_usePercentageSplit = false;
m_evaluationMeasure = TAGS_EVALUATION[0];
m_IRClassVal = -1;
}
代码示例来源:origin: Waikato/weka-trunk
/**
* reset to defaults
*/
protected void resetOptions() {
m_trainingInstances = null;
m_ClassifierTemplate = new ZeroR();
m_holdOutFile = new File("Click to set hold out or test instances");
m_holdOutInstances = null;
m_useTraining = false;
m_splitPercent = "90";
m_usePercentageSplit = false;
m_evaluationMeasure = TAGS_EVALUATION[0];
m_IRClassVal = -1;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Main method for testing this class.
*
* @param argv the options
*/
public static void main(String[] argv) {
runClassifier(new ZeroR(), argv);
}
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Main method for testing this class.
*
* @param argv the options
*/
public static void main(String[] argv) {
runClassifier(new ZeroR(), argv);
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/** Creates a default ZeroR */
public Classifier getClassifier() {
return new ZeroR();
}
代码示例来源:origin: Waikato/weka-trunk
/** Creates a default ZeroR */
public Classifier getClassifier() {
return new ZeroR();
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* returns the default classifier (fully configured) for the classify panel.
*
* @return the default classifier, ZeroR by default
*/
public static Object getClassifier() {
Object result;
result = getObject("Classifier",
weka.classifiers.rules.ZeroR.class.getName(),
weka.classifiers.Classifier.class);
if (result == null) {
result = new weka.classifiers.rules.ZeroR();
}
return result;
}
代码示例来源:origin: Waikato/weka-trunk
/**
* returns the default classifier (fully configured) for the classify panel.
*
* @return the default classifier, ZeroR by default
*/
public static Object getClassifier() {
Object result;
result = getObject("Classifier",
weka.classifiers.rules.ZeroR.class.getName(),
weka.classifiers.Classifier.class);
if (result == null) {
result = new weka.classifiers.rules.ZeroR();
}
return result;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/multiInstanceLearning
/** Creates a default TLC */
public Classifier getClassifier() {
TLC tlc = new TLC();
// Use ZeroR so that we never perform worse than ZeroR...
tlc.setClassifier(new weka.classifiers.rules.ZeroR());
return tlc;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Determine whether the scheme performs worse than ZeroR during testing
*
* @param classifier the pre-trained classifier
* @param evaluation the classifier evaluation object
* @param train the training data
* @param test the test data
* @return index 0 is true if the scheme performs better than ZeroR
* @throws Exception if there was a problem during the scheme's testing
*/
protected boolean[] testWRTZeroR(Classifier classifier,
Evaluation evaluation, Instances train, Instances test) throws Exception {
boolean[] result = new boolean[2];
evaluation.evaluateModel(classifier, test);
try {
// Tested OK, compare with ZeroR
Classifier zeroR = new weka.classifiers.rules.ZeroR();
zeroR.buildClassifier(train);
Evaluation zeroREval = new Evaluation(train);
zeroREval.evaluateModel(zeroR, test);
result[0] = Utils.grOrEq(zeroREval.errorRate(), evaluation.errorRate());
} catch (Exception ex) {
throw new Error("Problem determining ZeroR performance: "
+ ex.getMessage());
}
return result;
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Determine whether the scheme performs worse than ZeroR during testing
*
* @param classifier the pre-trained classifier
* @param evaluation the classifier evaluation object
* @param train the training data
* @param test the test data
* @return index 0 is true if the scheme performs better than ZeroR
* @throws Exception if there was a problem during the scheme's testing
*/
protected boolean[] testWRTZeroR(Classifier classifier,
Evaluation evaluation, Instances train, Instances test) throws Exception {
boolean[] result = new boolean[2];
evaluation.evaluateModel(classifier, test);
try {
// Tested OK, compare with ZeroR
Classifier zeroR = new weka.classifiers.rules.ZeroR();
zeroR.buildClassifier(train);
Evaluation zeroREval = new Evaluation(train);
zeroREval.evaluateModel(zeroR, test);
result[0] = Utils.grOrEq(zeroREval.errorRate(), evaluation.errorRate());
} catch (Exception ex) {
throw new Error("Problem determining ZeroR performance: "
+ ex.getMessage());
}
return result;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/multiInstanceFilters
/**
* returns the configured FilteredClassifier. Since the base classifier is
* determined heuristically, derived tests might need to adjust it.
*
* @return the configured FilteredClassifier
*/
protected FilteredClassifier getFilteredClassifier() {
FilteredClassifier result;
result = new FilteredClassifier();
result.setFilter(getFilter());
result.setClassifier(new weka.classifiers.rules.ZeroR());
return result;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/multiInstanceFilters
/**
* returns the configured FilteredClassifier. Since the base classifier is
* determined heuristically, derived tests might need to adjust it.
*
* @return the configured FilteredClassifier
*/
protected FilteredClassifier getFilteredClassifier() {
FilteredClassifier result;
result = new FilteredClassifier();
result.setFilter(getFilter());
result.setClassifier(new weka.classifiers.rules.ZeroR());
return result;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* returns the configured FilteredClassifier. Since the base classifier is
* determined heuristically, derived tests might need to adjust it.
*
* @return the configured FilteredClassifier
*/
protected FilteredClassifier getFilteredClassifier() {
FilteredClassifier result;
result = super.getFilteredClassifier();
((NominalToString) result.getFilter()).setAttributeIndexes("1");
result.setClassifier(new ZeroR());
return result;
}
代码示例来源:origin: Waikato/weka-trunk
/**
* returns the configured FilteredClassifier. Since the base classifier is
* determined heuristically, derived tests might need to adjust it.
*
* @return the configured FilteredClassifier
*/
protected FilteredClassifier getFilteredClassifier() {
FilteredClassifier result;
result = super.getFilteredClassifier();
((NominalToString) result.getFilter()).setAttributeIndexes("1");
result.setClassifier(new ZeroR());
return result;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Initialize the classifier.
*
* @param data the training data to be used for generating the boosted
* classifier.
* @throws Exception if the classifier could not be built successfully
*/
public void initializeClassifier(Instances data) throws Exception {
super.buildClassifier(data);
// can classifier handle the data?
getCapabilities().testWithFail(data);
// remove instances with missing class
data = new Instances(data);
data.deleteWithMissingClass();
m_ZeroR = new weka.classifiers.rules.ZeroR();
m_ZeroR.buildClassifier(data);
m_NumClasses = data.numClasses();
m_Betas = new double[m_Classifiers.length];
m_NumIterationsPerformed = 0;
m_TrainingData = new Instances(data);
m_RandomInstance = new Random(m_Seed);
if ((m_UseResampling)
|| (!(m_Classifier instanceof WeightedInstancesHandler))) {
// Normalize weights so that they sum to one and can be used as sampling probabilities
double sumProbs = m_TrainingData.sumOfWeights();
for (int i = 0; i < m_TrainingData.numInstances(); i++) {
m_TrainingData.instance(i).setWeight(m_TrainingData.instance(i).weight() / sumProbs);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!