1,081 views
0 0 votes

from keras.models import Sequential 
from keras.layers import Dense 
from keras.layers import LSTM 
from sklearn.model_selection import train_test_split

model = Sequential() 
model.add(LSTM( 10, input_shape=(1, 1))) 
model.add(Dense(1, activation="linear")) 
model.compile(loss="mse", optimizer="adam")

X, y = get_data()

X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state=1)
X_train_2, X_val, y_train_2, y_val = train_test_split(X_train, y_train, test_size=0.25, random_state=1)

model.fit(X_train, y_train, epochs=800, validation_data=(X_val, y_val), shuffle=False)

html, body, table, thead, input, textarea, select {color: #bab5ab!important; background: #35393b;} input[type="text"], textarea, select {color: #bab5ab!important; background: #35393b;} [data-darksite-inline-background-image-gradient] {background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5))!important; -webkit-background-size: cover!important; -moz-background-size: cover!important; -o-background-size: cover!important; background-size: cover!important;} [data-darksite-force-inline-background] * {background-color: rgba(0,0,0,0.7)!important;} [data-darksite-inline-background] {background-color: rgba(0,0,0,0.7)!important;} [data-darksite-inline-color] {color: #fff!important;} [data-darksite-inline-background-image] {background-image: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3))!important}

Please log in or register to answer this question.

Related questions

3 3 votes
1 answers 1 answer
6.2k
6.2k views
tofighi asked Aug 10, 2020
6,213 views
The goal of backpropagation is to optimize the weights so that the neural network can learn how to correctly map arbitrary inputs to outputs.Assume for the following neur...
0 0 votes
0 0 answers
624
624 views
Anas asked Nov 28, 2021
624 views
So say I have a column with categorical data like different styles of temperature: 'Lukewarm', 'Hot', 'Scalding', 'Cold', 'Frostbite',... etc.I know that we can use pd.ge...
1 1 vote
1 1 answer
639
639 views
engy.abdelazeez asked Mar 7, 2019
639 views
I'm trying to create a regression with a data set that does not contain any nulls and has a very few outliers. I fit a linear regression, a random forest, and a gbm model...
1 1 vote
1 1 answer
2.8k
2.8k views
engy.abdelazeez asked Apr 3, 2019
2,814 views
I preprocessed the data, normalized the numerical features, and did one hot encoding for the categorical ones. I end up with a model with R^2=0.7 and RMSE which is 15% of...
1 1 vote
0 0 answers
579
579 views
Ziva asked Aug 6, 2020
579 views