0

I am newbie in the neural network world and actually I build my first neural network but for some reason when I use de trained model to predict ,giving by myselft the data I want it to predict it, returns me the same value even if I modify some columns value.

I describe deeper, I am trying to build a model that is capable to predict wicht machine must be planificate for the day choosen. The input data that I use for train the model has 22 attributes columns for the machine and the last column the value that I wanted to predict (IFV) that is between 0-1.

From thoose columns I pass: the weeknumber of the year, the month number, and the week day. After trying it with some executions and having the same output I one-hot the week day and divided in 7 columns more, but even with this change I still have the same value for each time.

This is my model structure:

    model = Sequential ([
        Dense(16, activation ="relu", input_shape=(22,)),
        Dense(8, activation ="relu"),
        Dense(1, activation = "linear")
    ])

And this is my compilation and training code:

model = get_model()
model.compile(optimizer='adam', loss='mean_squared_error', metrics=['mse', 'mae'])
my_callbacks =[
    save_checkpoint_foreach_epoch('history_all_process_mse4'),
    save_model_folder ('model_all_process_mse4'),
]
history_all_process_mse = model.fit(X_train, Y_train,
                    batch_size= 32,
                    epochs=20,
                    callbacks= my_callbacks,
                    validation_data=(X_val, Y_val))
model.evaluate(X_test, Y_test, verbose=2)
save_model_h5 (model, 'model_all_process_mse4')

I use this number of epochs because my trained input data is too large and I use this batch size (the default one) because in diferent searches says that have good results in general

The evaluation output is the following one:

loss: 0.0016 - mse: 0.0016 - mae: 0.0270

By the way I am using Jupyter notebooks and this is from Jupyter, and the predictions are from another Jupyter.

In the prediction Jupyter I load the model saved and prepare the new data ,with the same structure as the trained data, that i wanted the model to predict the IFV column.

The trained data like the new data is normalized and scaled in the range 0 to 1.

Load the data to predict and normalize it with MinMaxScaler (0-1):

# In this csv the date for planificate is '2021-06-04'
# Importan! --> If i change the date about 9 columns are modified
# weekNumberOfYear, month, and 7 columns for each week day (monday-sunday)
 
df = pd.read_csv('../data/planificationsPredictions.csv')
dataset = df.values
X_predict = dataset
X_predict_values = normalize_data(X_predict)

And the result is this one:

IFV_predictions_values

I know the result value is lower but for now I wanted that the output prediction values change when I change the date.

Sorry if myproblem isn't as clear as I wanted, if is not plis let me know and i will modified the question. Thanks fo reading.

  • Does this answer your question? [What should I do when my neural network doesn't learn?](https://stats.stackexchange.com/questions/352036/what-should-i-do-when-my-neural-network-doesnt-learn) – Arya McCarthy May 28 '21 at 13:00
  • Using the week number, the month number, and the day of week has only so many possible combinations. If any of those classes of features has weights at or near zero, or if you have dead relu phenomenon, then the *effective number* of different inputs is much lower. – Sycorax May 28 '21 at 13:17
  • @Sycorax I read about dead relu phenomenon but I'm not sure how to detect if my model is sufering it, even so, they also said that in that case it can be use "Leaky ReLU" or "ELU" to avoid it. – Hello There May 31 '21 at 06:45
  • @AryaMcCarthy I alredy read that answer and have good points to have in mind but even that I dont understand why I have same predict values all time even if I change the date (the columns that represents the date) – Hello There May 31 '21 at 07:45

0 Answers0