I am trying to fit my model (neural networks) using keras but I got ValueError error.
import keras
from keras.models import Sequential
from keras.layers import Dense
classificador_rede_neural = Sequential()
# # Camadas Ocultas e de Saída
# camadas ocultas = (entradas + saídas)/2 #estimando o numero de neurônios em camada oculta
#
# temos:len(train.columns) - 1 atributos previsores
#
# 1 classe
#len(train.columns)
camadas_ocultas = round(len(train.columns)/2)
print(camadas_ocultas)
classificador_rede_neural.add(Dense(units=camadas_ocultas, activation='relu',input_dim =len(train.columns) ))#primeira camada
classificador_rede_neural.add(Dense(units=camadas_ocultas, activation='relu' ))#segunda camada
classificador_rede_neural.add(Dense(units=1, activation='sigmoid' ))#camada de saída. a saída é binária, logo units=1
classificador_rede_neural.compile(optimizer='adam',loss='binary_crossentropy',metrics=['accuracy'])
classificador_rede_neural.fit(X_train2,y_train2,batch_size=10,epochs =100)
I am getting the error:
ValueError: Please provide as model inputs either a single array or a list of arrays. You passed: x= sload dload spkts dpkts swin dwin smean dmean \
0 1.803636e+08 0.000000 2 0 0 0 248 0
1 8.810000e+08 0.000000 2 0 0 0 881 0
2 8.544000e+08 0.000000 2 0 0 0 534 0
3 6.000000e+08 0.000000 2 0 0 0 450 0
4 8.504000e+08 0.000000 2 0 0 0 1063 0
5 1.045333e+09 0.000000 2 0 0 0 392 0
6 1.306667e+09 0.000000 2 0 0 0 980 0
7 1.977143e+08 0.000000 2 0 0 0 692 0
[82332 rows x 22 columns]
How could I fit the model? What is wrong with my data?
The complete code > https://pastebin.com/jE7erEJs
X_train2
andy_train2
look like?