- 1、本文档共71页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
示例 // load data ArffLoader loader = new ArffLoader(); loader.setFile(new File(/some/where/data.arff)); Instances structure = loader.getStructure(); structure.setClassIndex(structure.numAttributes() - 1); ? // train NaiveBayes NaiveBayesUpdateable nb = new NaiveBayesUpdateable(); nb.buildClassifier(structure); Instance current; while ((current = loader.getNextInstance(structure)) != null) nb.updateClassifier(current); 示例 import weka.classifiers.Evaluation; import java.util.Random; ... Evaluation eval = new Evaluation(newData); eval.crossValidateModel(tree, newData, 10, new Random(1)); 示例 import weka.core.Instances; import weka.classifiers.Evaluation; import weka.classifiers.trees.J48; ... Instances train = ... // from somewhere Instances test = ... // from somewhere // train classifier Classifier cls = new J48(); cls.buildClassifier(train); // evaluate classifier and print some statistics Evaluation eval = new Evaluation(train); eval.evaluateModel(cls, test); System.out.println(eval.toSummaryString(\nResults\n======\n, false)); 从evaluation中获取结果的一些方法: nominal class correct() - number of correctly classified instances (see also incorrect()) pctCorrect() - percentage of correctly classified instances (see also pctIncorrect()) kappa() - Kappa statistics numeric class correlation Coefficient() - correlation coefficient general meanAbsoluteError() - the mean absolute error rootMeanSquaredError() - the root mean squared error unclassified() - number of unclassified instances pctUnclassified() - percentage of unclassified instances 以下示例装入未标识类别的数据/some/where/unlabeled.arff ,并用已训练好的分类器tree对每条数据进行标识,最后结果保存为/some/where/labeled.arff import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import weka.core.Instances; ... // load unlabeled data Instances unlabeled = new Instances( new BufferedReader( new FileReader(/some/where/unlabeled.arff))); ? // set class at
您可能关注的文档
最近下载
- 最新新华书店招聘考试真题试卷B卷.docx
- 第八章 现代平面设计的形成——俄国构成主义和荷兰风格派.ppt
- 小学科学我们的小缆车省公开课一等奖全国示范课微课金奖PPT课件.pptx
- 初三学生个人寒假学习总结未来学习规划PPT.pptx
- 最新JingChaDaXue《灭火救援基础工作》期末试卷( A )参考答案.docx
- 新D型模块机操作用户手册_邦普-服务版_标准20RT30RT40RT要点详解.pdf
- 抖音客服知识考试(服务态度)附有答案.docx
- psg alice pdx操作指南飞利浦家庭医疗事业部.pdf VIP
- 中国古代史_中国古代史.ppt
- 初中英语2025届中考必考单词汇总(共27类).doc
文档评论(0)