[英]Exporting Weka predictions in command line
我能夠在GUI中成功導出分類器錯誤,但無法在命令行中導出。 有什么方法可以在命令行上完成此操作?
我正在使用Weka3.6.x。 在這里,您可以右鍵單擊模型,選擇“可視化分類器錯誤”,然后從此處保存數據(包括預測)。 我想在命令行上做同樣的事情。
我不太在意文件格式(arff或csv可以),但是獲取每個測試數據實例的錯誤值很重要。
我之前曾在[這個問題]中問過這個問題。 ( 對CSV的Weka預測 )
通過使用每個分類器中可用的以下選項,您可以在命令行中獲得預測,概率等:
-classifications "weka.classifiers.evaluation.output.prediction.AbstractOutput + options"
Uses the specified class for generating the classification output.
E.g.: weka.classifiers.evaluation.output.prediction.PlainText
-p range
Outputs predictions for test instances (or the train instances if
no test instances provided and -no-cv is used), along with the
attributes in the specified range (and nothing else).
Use '-p 0' if no attributes are desired.
Deprecated: use "-classifications ..." instead.
-distribution
Outputs the distribution instead of only the prediction
in conjunction with the '-p' option (only nominal classes).
Deprecated: use "-classifications ..." instead.
例如,對天氣數據集使用NaiveBayes:
$ java weka.classifiers.bayes.NaiveBayes -t weather.nominal.arff -classifications weka.classifiers.evaluation.output.prediction.PlainText
=== Predictions under cross-validation ===
inst# actual predicted error prediction
1 2:no 1:yes + 0.926
2 1:yes 1:yes 0.825
1 2:no 1:yes + 0.636
2 1:yes 1:yes 0.808
1 2:no 2:no 0.718
2 1:yes 2:no + 0.656
1 2:no 1:yes + 0.579
2 1:yes 1:yes 0.541
1 2:no 1:yes + 0.515
1 1:yes 2:no + 0.632
1 1:yes 1:yes 0.84
1 1:yes 1:yes 0.554
1 1:yes 1:yes 0.757
1 1:yes 1:yes 0.778
輸出以制表符分隔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.