I am having an issue with using neural networks. I started with something simple. I just used nntool with one hidden layer (with one neuron) with linear activation function. For the output also, I used the linear activation function. I just fed my Xs and Ys to the neural network tool and got the results on the testing set.

I compared that with normal ridge function in MATLAB.

I could see that neural network one performed much worse than ridge function. The first reason is that there are lots of negative values in the predictions, when my target is only positive. Ridge regression gave about 800 -ve values while nn gave around 5000 -ve values which totally ruined the accuracy of nntool.

Since nntool can be used to perform linear regression, why nntool is not performing as well as ridge regression?

What about the negative values what's the reason behind it and how to enforce positive values?