AttributeError: ‘SupervisedDataSet’ object has no attribute ‘_convertToOneOfMany

Hi everybody,

I used pybrain libra for neurel networ on python. I took a error abput _convertToOneOfMany fon. Because it return different class. For instance;

ds = ClassificationDataSet(4096, 1 , nb_classes=40)
for k in xrange(len(X)):ds.addSample(ravel(X[k]),y[k])

tstdata, trndata= ds.splitWithProportion(0.25)
print type(ds)

print type(tstdata)

print type(trndata)

Result;

<class ‘pybrain.datasets.classification.ClassificationDataSet’>
<class ‘pybrain.datasets.supervised.SupervisedDataSet’>
<class ‘pybrain.datasets.supervised.SupervisedDataSet’>

So I didn’t use “tstdata._convertToOneOfMany() and trndata._convertToOneOfMany()”

This is solution;

ds = ClassificationDataSet(4096, 1 , nb_classes=40)

tstdata = ClassificationDataSet(4096, 1, nb_classes=40)

trndata = ClassificationDataSet(4096, 1, nb_classes=40)
for k in xrange(len(X)):ds.addSample(ravel(X[k]),y[k])
tstdata_temp, trndata_temp = ds.splitWithProportion(0.25)
for n in xrange(0, tstdata_temp.getLength()):tstdata.addSample( tstdata_temp.getSample(n)[0], tstdata_temp.getSample(n)[1])
for n in xrange(0, trndata_temp.getLength()):trndata.addSample( trndata_temp.getSample(n)[0], trndata_temp.getSample(n)[1])
tstdata._convertToOneOfMany()

trndata._convertToOneOfMany()

We have to convert from SupervisedDataSet to ClassificationDataSet.

have a nice day.

Semiha Makinist Uzman on 21 Nisan 2016 yazdı
Yorum Ekle
  • 0 Yanıt(lar)
  • Yanıtınız

    Cevabınızı göndererek Gizlilik Politikası ve Hizmet Şartlarını kabul ediyorsunuz.