Hi Muamin,
As per my understanding, you are getting a 99.5% accuracy, which is a very high accuracy for a neural network model. It is very difficult to beat these kind of numbers usually, but you can check for the following things and try to get better results:
- I see that your data is not normalized; that is, one of the variables is varying from -2 to 2, one is varying from 0 to 100 and the last one is -5 to 3.
- In simpler words, a variation of 1 unit in the first variable should have more effect than a variation of 1 unit in the second variable.
- Hence, we need to normalize this data, that is, bring this in similar ranges so that the model understands how the variation of each of the variables affects the output.
- You can use the "normalize" function for this : https://www.mathworks.com/help/matlab/ref/double.normalize.html
2. You are training for 2000 epochs (according to your code, but you have written 3000 in comments), which might result in overfitting, which is basically when your model is fit too closely to the training data, that it cannot perform on other data sets. To overcome this, you can use regularization, cross validation etc.
You can refer this page for more : https://www.mathworks.com/discovery/overfitting.html
Regularization : https://www.mathworks.com/help/stats/lasso.html
Cross Validation : https://www.mathworks.com/help/stats/crossval.html
3. Lastly, you can tweak the learning rate. The variable "nn.trainParam.lr" is currently set to 0.01. You can lower it, and keep the epochs 2000. By lowering the learning rate, the weights will change slowly, hence it needs more epochs to give better results. But this will drastically increasing the training time, with more or less no guarantee of increasing the accuracy as it is already at 99.5%.
Hope this helps!