I am generating uniformly distributed data points in a circle shape, where the radius of each circle is also generated uniformly. These circles look like this:
the uniformly distributed radia look like this:
My goal in this exercise is to predict the radius of these circles with a NN just by inputting the x,y-coordinates of the data points. (I am generating 1000 circles with its radia and data points for this)
But when trying this with the following architecture:
model = Sequential()
model.add(Flatten(input_shape=(X.shape[1],2)))
model.add(Dense(128, activation='relu'))
model.add(Dense(64, activation='relu'))
model.add(Dense(1))
model.compile('adam', 'mse', metrics=['accuracy'])
model.summary()
I get these results:
model.predict(X_test)[:10]
array([[1.0524317],
[0.9874419],
[1.1739452],
[1.0584671],
[1.035887 ],
[1.1663618],
[1.1536952],
[0.7245674],
[1.0469185],
[1.328696 ]], dtype=float32)
Y_test[:10]
array([[1.34369499],
[0.9539995 ],
[1.73399686],
[1.56665937],
[0.40627674],
[1.73467557],
[0.87950118],
[1.13395495],
[0.51870017],
[1.28441215]])
as you can see the results are very bad when predicting the radius.
What am I missing here? Or is a NN just not the best way to do this task?
[EDIT]
Now I tried it with 100k circles and their corresponding radia:
The plot shows the real value against the prediction of the radius. with more training samples the prediction is much better, but for such a simple task there is still a big scatter around y = x.
I have some suggestions, as you seem to be having Overfitting:
This is not all that it's possible to do, but I believe those points will be of great help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With