990 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.0k
6.0k views
tofighi asked Aug 10, 2020
6,004 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
548
548 views
Anas asked Nov 28, 2021
548 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
547
547 views
engy.abdelazeez asked Mar 7, 2019
547 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.7k
2.7k views
engy.abdelazeez asked Apr 3, 2019
2,683 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
527
527 views
Ziva asked Aug 6, 2020
527 views