主な目的は、 CNNのような深層学習の分類方法を Python のアンサンブルに個体として追加することです。
次のコードは正常に動作します。
clf1=CNN()
eclf1=VotingClassifier(estimators=[('lr', clf1)], voting='soft')
eclf1=eclf1.fit(XTrain,YTrain)
しかし、エラー:
'NoneType' object has no attribute 'predict_proba'
実行すると起動しeclf1=eclf1.predict(XTest)
ます。
念のため、 はトレーニング用の関数と次の関数でCNN
構成されます。_fit_
def predict_proba(self,XTest):
#prediction=np.mean(np.argmax(teY, axis=1) == predict(teX))
teX=XTest.reshape(len(XTest),3,112,112)
p=predict(teX)
i = np.zeros((p.shape[0],p.max()+1))
for x,y in enumerate(p):
i[x,y] = 1
return i