Neural Network is unable to predict high values . - neural-network

I am trying to design a feed forward neural network for predicting regression values . Max value 125 and Min value is -1000 in training set for dependent values .
But after training my neural network is predicting max value as 9 and min value as -7 .
Can anyone please suggest me how can i improve predictions .

Yes, neural network is stable to output around the value -1 ~ 1.
You can use StandardScaler, or MinMaxScaler for preprocessing to convert the target value's scale (to usually around -1 ~ 1.).
See also:
http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.MinMaxScaler.html

Related

Evaluating performance of Neural Network embeddings in kNN classifier

I am solving a classification problem. I train my unsupervised neural network for a set of entities (using skip-gram architecture).
The way I evaluate is to search k nearest neighbours for each point in validation data, from training data. I take weighted sum (weights based on distance) of labels of nearest neighbours and use that score of each point of validation data.
Observation - As I increase the number of epochs (model1 - 600 epochs, model 2- 1400 epochs and model 3 - 2000 epochs), my AUC improves at smaller values of k but saturates at the similar values.
What could be a possible explanation of this behaviour?
[Reposted from CrossValidated]
To cross check if imbalanced classes are an issue, try fitting a SVM model. If that gives a better classification(possible if your ANN is not very deep) it may be concluded that classes should be balanced first.
Also, try some kernel functions to check if this transformation makes data linearly separable?

how patch training for xor in neural network works?

how to calculate the error for xor patch training in neural network before updating the weights? for example if i got the following feed forward result :
x|y| output
1|1|0.9
1|0|0.65
0|1|0.08
0|0|0.14
should i calculate the RSE(or MSE doesn't matter) to get the value that will be used in calculating the delta for weights update?

Parameters for Support Vector Regression using LibSVM in Matlab

I am trying to use LibSVM for regression. I am trying to detect faces (10 classes of different faces). I labeled 1-10 as face class and 11 is for non face. I want to develop a script usig LibSVM which will give me a continuous score between 0-1 if the test image falls to any of the 10 face class, otherwise it will give me -1 (non-face). From this score, I can be able to predict my calss. If the test image is matched with 1st class, the score should be around .1. Similarly if the test image is matched with class 10, the score should be around 1 (any continuous value close to 1). I am trying to use SVR using LibSVM to solve this problem. I can easily get the predicted class through classification. But I want a continuous score value which I can get through regression. Now, I was looking in the net for the function or parameters in function for SVR using LibSVM, but I couldn't find anything. Can anybody please help me in this regard?
This is not a regression problem. Solving it through regression will not yield good results.
You are dealing with a multiclass classification problem. The best way to approach this is to construct 10 one-vs-all classifiers with probabilistic output. To get probabilistic output (e.g. in the interval [0,1]), you can train and predict with the -b 1 option for C-SVC (-s 0).
If any of the 10 classifiers yields a sufficiently large probability for its positive class, you use that probability (which is close to 1). If none of the 10 classifiers yield a positive label with high enough confidence you can default to -1.
So in short: make a multiclass classifier containing one-vs-all classifiers with probabilistic output. Subsequently post-process the predictions as I described, using a probability threshold of your choice (for example 0.7).

How to use trained Neural Network in Matlab for classification in a real system

I have trained Feed Forward NN using Matlab Neural Network Toolbox on a dataset containing speech features and accelerometer measurements. Targetset contains two target classes for dataset: 0 and 1. The training, validation and performance are all fine and I have generated code for this network.
Now I need to use this neural network in real-time to recognize pattern when occur and generate 0 or 1 when I test a new dataset against previously trained NN. But when I issue a command:
c = sim(net, j)
Where "j" is a new dataset[24x11]; instead 0 or 1 i get this as an output (I assume I get percent of correct classification but there is no classification result itself):
c =
Columns 1 through 9
0.6274 0.6248 0.9993 0.9991 0.9994 0.9999 0.9998 0.9934 0.9996
Columns 10 through 11
0.9966 0.9963
So is there any command or a way that I can actually see classification results? Any help highly appreciated! Thanks
I'm no matlab user, but from a logical point of view, you are missing an important point:
The input to a Neural Network is a single vector, you are passing a matrix. Thus matlab thinks that you want to classify a bunch of vectors (11 in your case). So the vector that you get is the output activation for every of these 11 vectors.
The output activation is a value between 0 and 1 (I guess you are using the sigmoid), so this is perfectly normal. Your job is to get a threshold that fits your data best. You can get this threshold with cross validation on your training/test data or by just choosing one (0.5?) and see if the results are "good" and modify if needed.
NNs normally convert their output to a value within (0,1) using for example the logistic function. It's not a percentage or probability, just a relative measure of certainty. In any case this means is that you have to manually use a threshold (such as 0.5) to discriminate the two classes. Which threshold is best is tough to find because you must select the optimum trade off between precision and recall.

ANNs traning, what happen in each epoche?

I have a question about the training of ANNs,
So I want to ask how the training is done for a set of input samples? Are there some relation between the size of the input set for training and the number of epoches for training, or it's totally independant?
For exemple, if my ANN has 4 inputs and for 2000 training's samples I get an input matrix of size 4x2000. So for each epoche of training, is that the whole matrix is loaded, or just one sample (training matrix column) is loaded for each epoche of traning?
in each epoch of a NN all the weight values of the neurons are updated, all the nodes. Usually the more neurons & layers & data you have the more epoches you need for a correct value for the weights, but there is not an equation for relationing epoches with neurons.
For the training usually there is used Backpropagation algorithm (check wikpedia for a great example), that updates each weight once. The more epoches the more accurate your NN will be. Usually for the training you set 2 variables: max num of epoches and accuracy, and when one of the two is finally achieved you stop iterating.