I started learning Neural Networks and after going through few videos on YouTube, I started creating my own Neural network for Regression problem. The dataset I used is just a set of numbers from 1-10000 in X and X*2.5+10 in y. But I am getting the accuracy as 0.0000e+00.
The data I used->
X=[x for x in range(1,10001)]
y=[x*2+x*0.5+10 for x in range(1,10001)]
plt.scatter(X,y)
plt.show
X_train=tf.constant(X[:len(X)//2])
X_test=tf.constant(X[len(X)//2:])
y_train=tf.constant(y[:len(y)//2])
y_test=tf.constant(y[len(y)//2:])
and the model is as follows:
model=tf.keras.Sequential([
tf.keras.layers.Dense(100,activation='relu'),
tf.keras.layers.Dense(10,activation='relu'),
tf.keras.layers.Dense(1,activation='sigmoid'),
])
model.compile(loss=tf.keras.losses.mse,optimizer=tf.keras.optimizers.Adam(lr=2.0),metrics=['accuracy'])
model.fit(tf.expand_dims(X_train, axis=-1), y_train, epochs=5)
The Results are as follows:
Epoch 1/5
/usr/local/lib/python3.7/dist-packages/keras/optimizer_v2/adam.py:105: UserWarning: The `lr` argument is deprecated, use `learning_rate` instead.
super(Adam, self).__init__(name, **kwargs)
157/157 [==============================] - 1s 2ms/step - loss: 52211620.0000 - accuracy: 0.0000e+00
Epoch 2/5
157/157 [==============================] - 0s 2ms/step - loss: 52211552.0000 - accuracy: 0.0000e+00
Epoch 3/5
157/157 [==============================] - 0s 2ms/step - loss: 52211556.0000 - accuracy: 0.0000e+00
Epoch 4/5
157/157 [==============================] - 0s 2ms/step - loss: 52211576.0000 - accuracy: 0.0000e+00
Epoch 5/5
157/157 [==============================] - 0s 2ms/step - loss: 52211564.0000 - accuracy: 0.0000e+00
<keras.callbacks.History at 0x7f04db138250>
Note: I Tried even with 10,000 epochs but the result hasn't changed.
Please give me some solution to solve this problem and also give some suggestions so that I can avoid such mistakes in future.