there is such a problem, created a simple three-layer network for predicting the behavior of a number series (rise / fall): Input values ​​have the following dimension: X: (20, 50, 1) in the range from -1 to 1 Y: (20.1) or 0 either 1

model = Sequential() #5 карт признаков ядро свертки 5х1 вход model.add(Conv1D(5, kernel_size=5, padding='same', input_shape=(50,1), activation=tf.keras.activations.sigmoid)) model.add(Flatten()) model.add(Dense(100, activation=tf.keras.activations.sigmoid, kernel_initializer="normal")) #вероятносный выходы model.add(Dense(1, activation=tf.keras.activations.softmax)) model.compile(loss=tf.keras.losses.mean_squared_error, optimizer="SGD", metrics=["accuracy"]) plot_model(model, to_file='model.png',show_shapes=True,show_layer_names=True) history = None history=model.fit(X_train,Y_train, epochs=5[![введите сюда описание изображения][1]][1], shuffle=True, verbose=0) if (history!=None): plt.plot(history.history['acc']) plt.title('Model accuracy') plt.ylabel('Accuracy') plt.xlabel('Epoch') plt.legend(['Train', 'Test'], loc='upper left') plt.show() 

However, when learning:

This is how I prepare the data:

 def Ynormalize(i): if (price[i]>price[i-1]): return 1 else: return 0 X_train = np.array([ np.array([ [price[(i+1)*(j+1)-1]] for i in range(50) ]) for j in range(int(len(price)/50)) ]) Y_train = np.array([ np.array([ Ynormalize((i+1)*50) ]) for i in range(int(len(price)/50)) ]) 

Tell me, what is the reason and how can I fix it?

  • Your model has a 0% prediction accuracy even for a training sample. If you randomly choose 1 or 0 , then the prediction accuracy will be approx. 50% better;) - MaxU

0