# data
myinput = np.array([ [ 1,0 ],[ 1,1 ],[ 1,2 ],[ 1,3 ],[ 1,4 ],[ 1,5 ] ])
myotput = np.array([ [ 0 ],[ 1 ],[ 2 ],[ 3 ],[ 4 ],[ 5 ] ])
# model
model = Sequential()
model.add(Dense(32, input_dim=2, activation='tanh'))
model.add(Dense(1, activation='tanh'))
model.compile(loss='mean_squared_error',
optimizer='adam',
metrics=['accuracy'])
# train
model.fit(x=myinput, y=myotput, epochs=10000, verbose=0)
# check
print(model.predict(myinput))
A straight line fit under condition “1
” seems not feasible. Thanks!