首页 > 代码库 > weka

weka

// remove instances with missing class
Instances newData = http://www.mamicode.com/new Instances(data);
newData.deleteWithMissingClass();
m_structure = new Instances(newData, 0);

m_Random = new Random(getSeed());

if (m_classifiersToLoad.size() > 0) {
m_preBuiltClassifiers.clear();
loadClassifiers(data);

if (m_Classifiers.length == 1
&& m_Classifiers[0] instanceof weka.classifiers.rules.ZeroR) {
// remove the single ZeroR
m_Classifiers = new Classifier[0];
}
}

Classifier [] Classifiers = new Classifier[3];

//m_Classifiers[0]=new LibSVM();
Classifiers[0]=new J48();
Classifiers[1]=new Logistic();
Classifiers[2]=new SMO();

m_Classifiers=Classifiers;
// can classifier handle the data?
getCapabilities().testWithFail(data);

for (int i = 0; i < m_Classifiers.length; i++) {
getClassifier(i).buildClassifier(newData);
}