Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Tweeted twitter.com/StackStats/status/934870464945643520

I set up a model in keras (in python 2.7) to predict the next stock price in a particular sequence.

The model I used is shown below (edited to fit this page):

model = Sequential() model.add(Dense(5, input_shape=(1, 1))) model.add(LSTM(5, return_sequences=True)) model.add(Dense(1)) model.add(Activation("linear")) model.compile(loss="mse", optimizer="Nadam", metrics=["mape"]) predict = model.fit(X, Y, epochs=epochs, verbose=1, validation_split=0.2, callbacks=[checkpoint_maker], shuffle=True, batch_size=count / 10 * 8)

model = Sequential()
model.add(Dense(5, input_shape=(1, 1)))
model.add(LSTM(5, return_sequences=True))
model.add(Dense(1))
model.add(Activation("linear"))
model.compile(loss="mse", optimizer="Nadam", metrics=["mape"])
predict = model.fit(X, Y, epochs=epochs, verbose=1, validation_split=0.2,
                    callbacks=[checkpoint_maker], shuffle=True,
                    batch_size=count / 10 * 8)

However, when I ran the model, I found that val_mean_absolute_percentage_error decreases while the mean_absolute_percentage_error increases.

Here is the graph I managed to generate after 1000 epochs. Graph

Notice that the blue line is going up while the orange line is going down.

I have no idea why.

I've read on some sources that if the loss is decreasing and the val_loss is increasing it means that:

(the) model is over fitting, that (it) is just memorizing the training data - https://stats.stackexchange.com/a/260346

soSo does that mean, that in my case, the model is "under fitting"?

P.S. Code and files

I set up a model in keras (in python 2.7) to predict the next stock price in a particular sequence.

The model I used is shown below (edited to fit this page):

model = Sequential() model.add(Dense(5, input_shape=(1, 1))) model.add(LSTM(5, return_sequences=True)) model.add(Dense(1)) model.add(Activation("linear")) model.compile(loss="mse", optimizer="Nadam", metrics=["mape"]) predict = model.fit(X, Y, epochs=epochs, verbose=1, validation_split=0.2, callbacks=[checkpoint_maker], shuffle=True, batch_size=count / 10 * 8)

However, when I ran the model, I found that val_mean_absolute_percentage_error decreases while the mean_absolute_percentage_error increases.

Here is the graph I managed to generate after 1000 epochs. Graph

Notice that the blue line is going up while the orange line is going down.

I have no idea why.

I've read on some sources that if the loss is decreasing and the val_loss is increasing it means that

(the) model is over fitting, that (it) is just memorizing the training data - https://stats.stackexchange.com/a/260346

so does that mean that in my case the model is "under fitting"?

P.S. Code and files

I set up a model in keras (in python 2.7) to predict the next stock price in a particular sequence.

The model I used is shown below (edited to fit this page):

model = Sequential()
model.add(Dense(5, input_shape=(1, 1)))
model.add(LSTM(5, return_sequences=True))
model.add(Dense(1))
model.add(Activation("linear"))
model.compile(loss="mse", optimizer="Nadam", metrics=["mape"])
predict = model.fit(X, Y, epochs=epochs, verbose=1, validation_split=0.2,
                    callbacks=[checkpoint_maker], shuffle=True,
                    batch_size=count / 10 * 8)

However, when I ran the model, I found that val_mean_absolute_percentage_error decreases while the mean_absolute_percentage_error increases.

Here is the graph I managed to generate after 1000 epochs. Graph

Notice that the blue line is going up while the orange line is going down.

I have no idea why.

I've read on some sources that if the loss is decreasing and the val_loss is increasing it means that:

(the) model is over fitting, that (it) is just memorizing the training data - https://stats.stackexchange.com/a/260346

So does that mean, that in my case, the model is "under fitting"?

P.S. Code and files

edited body
Source Link

I set up a model in keras (in python 2.7) to predict the next stock price in a particular sequence.

The model I used is shown below (edited to fit this page):

model = Sequential() model.add(Dense(5, input_shape=(1, 1))) model.add(LSTM(5, return_sequences=True)) model.add(Dense(1)) model.add(Activation("linear")) model.compile(loss="mse", optimizer="Nadam", metrics=["mape"]) predict = model.fit(X, Y, epochs=epochs, verbose=1, validation_split=0.2, callbacks=[checkpoint_maker], shuffle=True, batch_size=count / 10 * 8)

However, when I ran the model, I found that val_mean_absolute_percentage_error decreases while the mean_absolute_percentage_error increases.

Here is the graph I managed to generate after 1000 epochs. Graph

Notice that the blue line is going up while the orange line is going down.

I have no idea why.

I've read on manysome sources that if the loss is decreasing and the val_loss is increasing it means that

(the) model is over fitting, that (it) is just memorizing the training data - https://stats.stackexchange.com/a/260346

so does that mean that in my case the model is "under fitting"?

P.S. Code and files

I set up a model in keras (in python 2.7) to predict the next stock price in a particular sequence.

The model I used is shown below (edited to fit this page):

model = Sequential() model.add(Dense(5, input_shape=(1, 1))) model.add(LSTM(5, return_sequences=True)) model.add(Dense(1)) model.add(Activation("linear")) model.compile(loss="mse", optimizer="Nadam", metrics=["mape"]) predict = model.fit(X, Y, epochs=epochs, verbose=1, validation_split=0.2, callbacks=[checkpoint_maker], shuffle=True, batch_size=count / 10 * 8)

However, when I ran the model, I found that val_mean_absolute_percentage_error decreases while the mean_absolute_percentage_error increases.

Here is the graph I managed to generate after 1000 epochs. Graph

Notice that the blue line is going up while the orange line is going down.

I have no idea why.

I've read on many sources that if the loss is decreasing and the val_loss is increasing it means that

(the) model is over fitting, that (it) is just memorizing the training data - https://stats.stackexchange.com/a/260346

so does that mean that in my case the model is "under fitting"?

P.S. Code and files

I set up a model in keras (in python 2.7) to predict the next stock price in a particular sequence.

The model I used is shown below (edited to fit this page):

model = Sequential() model.add(Dense(5, input_shape=(1, 1))) model.add(LSTM(5, return_sequences=True)) model.add(Dense(1)) model.add(Activation("linear")) model.compile(loss="mse", optimizer="Nadam", metrics=["mape"]) predict = model.fit(X, Y, epochs=epochs, verbose=1, validation_split=0.2, callbacks=[checkpoint_maker], shuffle=True, batch_size=count / 10 * 8)

However, when I ran the model, I found that val_mean_absolute_percentage_error decreases while the mean_absolute_percentage_error increases.

Here is the graph I managed to generate after 1000 epochs. Graph

Notice that the blue line is going up while the orange line is going down.

I have no idea why.

I've read on some sources that if the loss is decreasing and the val_loss is increasing it means that

(the) model is over fitting, that (it) is just memorizing the training data - https://stats.stackexchange.com/a/260346

so does that mean that in my case the model is "under fitting"?

P.S. Code and files

Source Link

Keras: val_loss decreases while loss increases

I set up a model in keras (in python 2.7) to predict the next stock price in a particular sequence.

The model I used is shown below (edited to fit this page):

model = Sequential() model.add(Dense(5, input_shape=(1, 1))) model.add(LSTM(5, return_sequences=True)) model.add(Dense(1)) model.add(Activation("linear")) model.compile(loss="mse", optimizer="Nadam", metrics=["mape"]) predict = model.fit(X, Y, epochs=epochs, verbose=1, validation_split=0.2, callbacks=[checkpoint_maker], shuffle=True, batch_size=count / 10 * 8)

However, when I ran the model, I found that val_mean_absolute_percentage_error decreases while the mean_absolute_percentage_error increases.

Here is the graph I managed to generate after 1000 epochs. Graph

Notice that the blue line is going up while the orange line is going down.

I have no idea why.

I've read on many sources that if the loss is decreasing and the val_loss is increasing it means that

(the) model is over fitting, that (it) is just memorizing the training data - https://stats.stackexchange.com/a/260346

so does that mean that in my case the model is "under fitting"?

P.S. Code and files