2013-06-21 39 views
4

我刚刚开始使用Weka并遇到了第一步的麻烦。分步指南为Weka中的异或情况训练多层感知器?

我们已经得到了我们的训练集:

 
@relation PerceptronXOR 
@attribute X1 numeric 
@attribute X2 numeric 
@attribute Output numeric 
@data 
1,1,-1 
-1,1,1 
1,-1,1 
-1,-1,-1 

第一步我想要做的只是训练,然后进行分类使用Weka的GUI一套。 我到目前为止所做的一切:

使用Weka 3.7.0。

  1. 启动GUI。
  2. 资源管理器。
  3. 打开文件 - >选择我的arff文件。
  4. 分类选项卡。
  5. 使用训练集单选按钮。
  6. 选择 - >功能>多层感知器
  7. 单击顶部的'多层感知器'文本打开设置。
  8. 将隐藏层设置为'2'。 (如果gui选择正确,则表明这是我们想要的正确网络)。点击确定。
  9. 点击开始。

输出:

 
=== Run information === 

Scheme:  weka.classifiers.functions.MultilayerPerceptron -L 0.3 -M 0.2 -N 500 -V 0 -S 0 -E 20 -H 2 -R 
Relation:  PerceptronXOR 
Instances: 4 
Attributes: 3 
       X1 
       X2 
       Output 
Test mode: evaluate on training data 

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

Linear Node 0 
    Inputs Weights 
    Threshold 0.21069691964232443 
    Node 1 1.8781169869419072 
    Node 2 -1.8403146612166397 
Sigmoid Node 1 
    Inputs Weights 
    Threshold -3.7331156814378685 
    Attrib X1 3.6380519730323164 
    Attrib X2 -1.0420815868133226 
Sigmoid Node 2 
    Inputs Weights 
    Threshold -3.64785119182632 
    Attrib X1 3.603244645539393 
    Attrib X2 0.9535137571446323 
Class 
    Input 
    Node 0 


Time taken to build model: 0 seconds 

=== Evaluation on training set === 
=== Summary === 

Correlation coefficient     0.7047 
Mean absolute error      0.6073 
Root mean squared error     0.7468 
Relative absolute error     60.7288 % 
Root relative squared error    74.6842 % 
Total Number of Instances    4  

这似乎很奇怪,在0.3 500次迭代没有得到它的错误,但5000 @ 0.1呢,所以让我们一起去那。

现在使用的测试数据集:

 
@relation PerceptronXOR 
@attribute X1 numeric 
@attribute X2 numeric 
@attribute Output numeric 
@data 
1,1,-1 
-1,1,1 
1,-1,1 
-1,-1,-1 
0.5,0.5,-1 
-0.5,0.5,1 
0.5,-0.5,1 
-0.5,-0.5,-1 
  1. 单选按钮,以 '提供的测试集'
  2. 选择我的测试集ARFF。
  3. 点击开始。
 
=== Run information === 

Scheme:  weka.classifiers.functions.MultilayerPerceptron -L 0.1 -M 0.2 -N 5000 -V 0 -S 0 -E 20 -H 2 -R 
Relation:  PerceptronXOR 
Instances: 4 
Attributes: 3 
       X1 
       X2 
       Output 
Test mode: user supplied test set: size unknown (reading incrementally) 

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

Linear Node 0 
    Inputs Weights 
    Threshold -1.2208619057226187 
    Node 1 3.1172079341507497 
    Node 2 -3.212484459911485 
Sigmoid Node 1 
    Inputs Weights 
    Threshold 1.091378074639599 
    Attrib X1 1.8621040828953983 
    Attrib X2 1.800744048145267 
Sigmoid Node 2 
    Inputs Weights 
    Threshold -3.372580743113282 
    Attrib X1 2.9207154176666386 
    Attrib X2 2.576791630598144 
Class 
    Input 
    Node 0 


Time taken to build model: 0.04 seconds 

=== Evaluation on test set === 
=== Summary === 

Correlation coefficient     0.8296 
Mean absolute error      0.3006 
Root mean squared error     0.6344 
Relative absolute error     30.0592 % 
Root relative squared error    63.4377 % 
Total Number of Instances    8  

为什么无法将这些正确分类?

仅仅因为它在训练数据上很快达到当地最低标准,并且不知道那不适合所有情况?

问题。

  1. 为什么500 @ 0.3不起作用?对于这样一个简单的问题似乎很奇怪。
  2. 为什么它在测试集上失败。
  3. 我该如何传入一组来分类?
+1

1.如果学习率太高,它不会收敛。即使0.1有点大。 –

回答

4

使用0.5的学习率对两个例子都做了500次迭代。 学习速度是它为新例子提供的重量。 显然这个问题很困难,并且很容易在2个隐藏层获得局部极小值。如果您使用低迭代次数的学习率较低,学习过程将会更加保守,并且更有可能达到一个好的最小值。