从命令行打开 Weka

数据挖掘 威卡
2022-03-16 16:51:39

总的来说,我对计算机编码和数据科学非常陌生。我正在尝试打开 Weka 并将其用于名为 weather.arff 的练习 csv 数据集。我说的手册将其输入命令行:

java weka.classifiers.j48.J48 -t 天气.arff

当我打开命令行时,它转到 C:\User\Admin 当我在命令行上输入上述内容时,它会给我消息

错误:无法找到或加载主类 weka.classifiers.j48.J48

可能有人给我一些关于如何继续使命令行工作的建议。谢谢

1个回答

我认为您的手册适用于较旧版本的 Weka。我有版本 3.9.3。在某些版本中,Weka 开发人员可能更改了一些内部结构和类名。

在带有命令行提示符的终端窗口中,转到安装 Weka 的目录,即weka.jar文件所在的目录。应该有一个data/子目录。

cd c:\.....

在那里,运行这个命令。

java -cp weka.jar weka.classifiers.trees.J48 -t data/weather.nominal.arff (您的数据文件名可能不同)

然后我得到这个输出:

=== Classifier model (full training set) ===

J48 pruned tree
------------------

outlook = sunny
|   humidity = high: no (3.0)
|   humidity = normal: yes (2.0)
outlook = overcast: yes (4.0)
outlook = rainy
|   windy = TRUE: no (2.0)
|   windy = FALSE: yes (3.0)

Number of Leaves  :     5

Size of the tree :  8


Time taken to build model: 0.33 seconds

Time taken to test model on training data: 0 seconds

=== Error on training data ===

Correctly Classified Instances          14              100      %
Incorrectly Classified Instances         0                0      %
Kappa statistic                          1     
Mean absolute error                      0     
Root mean squared error                  0     
Relative absolute error                  0      %
Root relative squared error              0      %
Total Number of Instances               14     


=== Detailed Accuracy By Class ===

                 TP Rate  FP Rate  Precision  Recall   F-Measure  MCC      ROC Area  PRC Area  Class
                 1.000    0.000    1.000      1.000    1.000      1.000    1.000     1.000     yes
                 1.000    0.000    1.000      1.000    1.000      1.000    1.000     1.000     no
Weighted Avg.    1.000    0.000    1.000      1.000    1.000      1.000    1.000     1.000     


=== Confusion Matrix ===

 a b   <-- classified as
 9 0 | a = yes
 0 5 | b = no

Time taken to perform cross-validation: 0.02 seconds


=== Stratified cross-validation ===

Correctly Classified Instances           7               50      %
Incorrectly Classified Instances         7               50      %
Kappa statistic                         -0.0426
Mean absolute error                      0.4167
Root mean squared error                  0.5984
Relative absolute error                 87.5    %
Root relative squared error            121.2987 %
Total Number of Instances               14     


=== Detailed Accuracy By Class ===

                 TP Rate  FP Rate  Precision  Recall   F-Measure  MCC      ROC Area  PRC Area  Class
                 0.556    0.600    0.625      0.556    0.588      -0.043   0.633     0.758     yes
                 0.400    0.444    0.333      0.400    0.364      -0.043   0.633     0.457     no
Weighted Avg.    0.500    0.544    0.521      0.500    0.508      -0.043   0.633     0.650     


=== Confusion Matrix ===

 a b   <-- classified as
 5 4 | a = yes
 3 2 | b = no