0

I'm having difficulties setting up a NN in Keras. Please help me!

This is my code and I'm getting random values every time when I predict.

model = Sequential()
layer1 = Dense(5, input_shape = (5,))
model.add(layer1)
model.add(Activation('relu'))

layer2 = Dense(1)
model.add(layer2)   
model.add(Activation('relu'))


model.compile(loss='mean_squared_error', optimizer='adam')
model.fit(xtrain, ytrain, verbose=1)

I have 5 input features and want to predict a single continuous value as an output

vermanil
  • 212
  • 1
  • 8

2 Answers2

1

Input space have five features. The problem was that i am getting random prediction at same input. Now, I have reach the solution. It is happening just because of that i am not doing the normalisation of features.

Thanks

vermanil
  • 212
  • 1
  • 8
0

From my point of view,

you are not giving your input shape correctly

layer1 = Dense(5, input_shape = (5,))

What is your actual input shape?

jrbedard
  • 3,662
  • 5
  • 30
  • 34
Ramesh Kumar
  • 1,508
  • 15
  • 16
  • While this code snippet may solve the question, [including an explanation](http://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. – DimaSan Mar 16 '17 at 11:38
  • Input space have five features. – vermanil Mar 16 '17 at 12:27