Reputation: 145
I am trying to perform a rating using the CNN template.
I have 150 classes. My train base has 19470 rows and 1945 columns. It is an matrix that contains 0 and 1.
import keras
from keras.models import Sequential
from keras.layers import Conv1D
from keras.layers.advanced_activations import LeakyReLU
model = Sequential()
model.add(Conv1D(150,kernel_size=3,input_shape(19470,1945),activation='linear',padding='same'))
model.add(LeakyReLU(alpha=0.1))
model.compile(loss=keras.losses.categorical_crossentropy, optimizer=keras.optimizers.Adam(),metrics=['accuracy'])
model.fit(x_train, y_train)
This raises:
ValueError: Error when checking input: expected conv1d_39_input to have 3 dimensions, but got array with shape (19470, 1945)
Upvotes: 1
Views: 537
Reputation: 2762
Did you check your xtrain shape?
According to the error that keras is raising you should do: x_train = xtrain.reshape(19470, 1945, 1)
I don't understand why are you using as many layers of conv1d as classes you have? I can't give advice on the architecture of your NN, but I your last layer should be a Dense layer with 150 units and softmax activation. Don't you have 150 classes?
Upvotes: 1