SMO,Sequential Minimal Optimization in WEKA

ⅰ亾dé卋堺 提交于 2019-12-08 08:51:27

I guess you have figured it out by now, but in case it helps others, there is a wiki page about it:

http://weka.wikispaces.com/Text+categorization+with+WEKA

to use SMO, let's say you have some train instances "trainset", and a test set "testset" to build the classifier:

            // train SMO and output model
            SMO classifier = new SMO();
            classifier.buildClassifier(trainset);

to evaluate it using cross validation for example:

    Evaluation eval = new Evaluation(testset);
    Random rand = new Random(1); // using seed = 1
    int folds = 10;
    eval.crossValidateModel(classifier, testset, folds, rand);

then eval holds all the stats, etc.

Gaurav

You can Read input file from these line:

Instances training_data = new Instances(new BufferedReader(
        new FileReader("tmp-file-duplicate-pairs.arff")));
training_data.setClassIndex(training_data.numAttributes() - 1);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!