AttributeError using pyBrain _splitWithPortion - object type changed?

前端 未结 6 948
遥遥无期
遥遥无期 2021-02-07 06:36

I\'m testing out pybrain following the basic classification tutorial here and a different take on it with some more realistic data here. However I receive this error when applyi

6条回答
  •  春和景丽
    2021-02-07 07:20

    I had the same problem. I added the following code to make it work on my machine.

    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] )
    

    This converts tstdata and trndata back to the ClassificationDataSet type.

提交回复
热议问题