Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from keras.models import Sequential
- from keras.layers import Dense
- from keras.layers.core import Activation, Dense
- # define base mode
- def baseline_model():
- # create model
- model = Sequential()
- model.add(Dense(1, input_dim=1, init='normal', activation='relu'))
- model.add(Dense(1, init='normal'))
- model.compile(loss='mean_squared_error', optimizer='adam')
- return model
- regr = baseline_model()
- regr.fit(X_train, Y_train,
- nb_epoch=200, validation_split=0.2, verbose = 1) #batch_size=5,
- Epoch 197/200
- 64/64 [==============================] - 0s - loss: 34810.5195 - val_loss: 131652.9375
- Epoch 198/200
- 64/64 [==============================] - 0s - loss: 34809.8574 - val_loss: 131651.5000
- Epoch 199/200
- 64/64 [==============================] - 0s - loss: 34809.2266 - val_loss: 131650.0781
- Epoch 200/200
- 64/64 [==============================] - 0s - loss: 34808.5801 - val_loss: 131648.6406
- plt.scatter(X_test, Y_test, color='black')
- plt.plot(X_test, regr.predict(X_test), color='blue',
- linewidth=3)
- plt.xticks()
- plt.yticks()
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement