I generated some data from a 4th degree polynomial and wanted to create a regression model in Keras to fit this polynomial. The problem is that predictions after fitting seem to be basically linear. Since this is my first time working with neural nets I assume I made a very trivial and stupid mistake.
Here is my code:
model = Sequential()
model.add(Dense(units=200, input_dim=1))
model.add(Activation('relu'))
model.add(Dense(units=45))
model.add(Activation('relu'))
model.add(Dense(units=1))
model.compile(loss='mean_squared_error',
optimizer='sgd')
model.fit(x_train, y_train, epochs=20, batch_size=50)
loss_and_metrics = model.evaluate(x_test, y_test, batch_size=100)
classes = model.predict(x_test, batch_size=1)
x_train
and y_train
are numpy arrays containing the first 9900 entries from this file.
I tried different batch_sizes, number of epochs, layer sizes and amounts of training data. Nothing seems to help.
Please point out everything you see that does not make sense!