I am trying to train neural network with the 'BFGS' as the update function, there appears to be no problem while training and getting the cost function, however wnen I try to test it andmake prediction it gives me an error: ValueError: Found input variables with inconsistent numbers of samples: [10000, 5711] the code I use is:
X=data.iloc[:,0:].values
y=data.iloc[:,-1:].values
X=pd.DataFrame(data,columns=data.columns)
y=pd.DataFrame(data,columns=['class'])
X.drop(['class'],axis=1,inplace=True)
X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.3,random_state=0)
sc=StandardScaler()
X_train=sc.fit_transform(X_train)
X_test=sc.transform(X_test)
qnewton=algorithms.QuasiNewton(
network=[
layers.Input(13),
layers.Tanh(10),
layers.Sigmoid(1),
],
update_function='bfgs',verbose=True
)
qnewton.train(X_train,y_train)
y_predict=qnewton.predict(X_test)
I don't really understand whatam I doing wrong. Please help.
Aucun commentaire:
Enregistrer un commentaire