Try:
def cnn_model(): model = Sequential() model.add(Conv1D(filters=1, kernel_size=10 ,strides=10, input_shape=(N_features, 1),kernel_initializer= 'uniform', activation= 'relu')) model.flatten() model.add(Dense(N_features/10, init= 'uniform' , activation= 'relu' )) ....
And change form x to form (nb_of_examples, nb_of_features, 1) .
EDIT:
Conv1D was designed for sequence analysis — having convolutional filters that are the same no matter where in the sequence we are. The second dimension is the so-called features, where you can have a vector with several functions on each of the timestamps. You can think of the dimension of a sequence as well as the spatial dimensions and dimension of an object, the same as the channel size or color size in Conv2D . As mentioned by @putonspectacles in your comment, you can set the size of the None sequence to make your input network length invariant.
source share