擅长:python、mysql、java
<p>我也有同样的问题。我添加了下面的代码使它在我的机器上工作。在</p>
<pre><code>tstdata_temp, trndata_temp = alldata.splitWithProportion(0.25)
tstdata = ClassificationDataSet(2, 1, nb_classes=3)
for n in xrange(0, tstdata_temp.getLength()):
tstdata.addSample( tstdata_temp.getSample(n)[0], tstdata_temp.getSample(n)[1] )
trndata = ClassificationDataSet(2, 1, nb_classes=3)
for n in xrange(0, trndata_temp.getLength()):
trndata.addSample( trndata_temp.getSample(n)[0], trndata_temp.getSample(n)[1] )
</code></pre>
<p>这会将<code>tstdata</code>和<code>trndata</code>转换回<code>ClassificationDataSet</code>类型。在</p>