How do you make a prediction (forecast) from a trained network for a given input in Matlab? - matlab

I am using the neural network toolbox that Matlab provides. I trained a NARX neural network for time series problems. I am trying to predict future values using the inputs I am giving to the neural network.
I am able to see the error graphs and the response for the testing and validation samples, but how do I test new samples? How can I make a prediction using the trained neural network? I could not find any documentation.
This was my attempt
>> net(input2')
ans =
[917.9814]
But no matter what the inputs are, I am getting the exact same output always....

Related

Neural Network Regression for Winequality Data [predicting density]

I am trying to run my neural network code but it showed an error. My code as per below.. wondering what i missed out. I am trying to predict the MSE value for the model and compare it with Linear regression.

SVM Vs Deep Neural Network

I am trying to solve a regression problem by comparing different machine learning algorithms. So far i have tried Linear Regression) (accuracy: 0.88) and SVM ( Accuarcy : 0.84). Now i am trying to neural network for the same problem but i am getting a very low accuracy ( around 1 Percent!) I cant seem to figure out if i am using the same data, then why am i getting such low acccuracy using the neural network?
I have tried using different number of neurons but nothing seems to work. Here is the neural network that i am using Neural Network
I expect the accuracy to be somewhere near to SVM and linear regression but it does not seem to work. My labels look like this labels
My features look like this. features.Here is the output of the neural network Neural Network Output
Looks like you are doing a regression task on your data, accuracy is a classification metric and can only be used for classification, not regression, so your results are meaningless and you cannot compare regressors using accuracy.
Just use another metric like mean squared error or mean absolute error.

Applying Neural Network to forecast prices

I have read this line about neural networks :
"Although the perceptron rule finds a successful weight vector when
the training examples are linearly separable, it can fail to converge
if the examples are not linearly separable.
My data distribution is like this :The features are production of rubber ,consumption of rubber , production of synthetic rubber and exchange rate all values are scaled
My question is that the data is not linearly separable so should i apply ANN on it or not? is this a rule that it should be applied on linerly separable data only ? as i am getting good results using it (0.09% MAPE error) . I have also applied SVM regression (fitrsvm function in MATLAB)so I have to ask can SVM be used in forecasting /prediction or it is used only for classification I haven't read anywhere about using SVM to forecast , and the results for SVM are also not good what can be the possible reason?
Neural networks are not perceptrons. Perceptron is on of the oldest ideas, which is at most a single building block of neural networks. Perceptron is designed for binary, linear classification and your problem is neither the binary classification nor linearly separable. You are looking at regression here, where neural networks are a good fit.
can SVM be used in forecasting /prediction or it is used only for classification I haven't read anywhere about using SVM to forecast , and the results for SVM are also not good what can be the possible reason?
SVM has regression "clone" called SVR which can be used for any task NN (as a regressor) can be used. There are of course some typical characteristics of both (like SVR being non parametric estimator etc.). For the task at hand - both approaches (as well as any another regressor, there are dozens of them!) is fine.

How to simulate neural network by changing different parameters after training in MATLAB?

I have trained the neural network for a particular time series in MATLAB. After that I have saved the network. So if I want to simulate the network using different parameters like changing the number of neurons,number of hidden layer, transfer functions, learning ratio,momentum coefficient, Can I do it without again training the network?
If not what is the criteria to select the best parameter for my neural network?
How should I configure my neural network in MATLAB to do all these?
No because you save whole model to file, with including weights + activation function and whole structure (layers). You can train few networks, and save to file if you want to check in future on real data (validation data) which networks is better.
Check this also ;) http://people.cs.umass.edu/~btaylor/publications/PSI000008.pdf

In Matlab, How to use already trained neural network on real time values?

Using nntool(Neural Network Manager) in Matlab, we have created a neural network named network1, the network type is Feed Forward backprop. Training function is TRAINLM, learning function is LEARNGDM, performance function is MSE. No. of layers are 2 and transfer function is TRANSIG. No. of Inputs is 2.
We have trained it using known datasets.
Now, we want to use this trained Neural Network on real time values(dynamically one by one) to get the output.
We are unable to use the network on real time values.
So, please guide us through the steps to use trained neural network on real time values.
if you created a ann via
network1 = feedforwardnet;
or something of that kind and then trained it with your known data, you should be able to use said net via
outputs = network1(inputs);
You can create a function from the neural network that you have trained and use it as regular MATLAB functions.
You can either create it with genFun command or using the GUI in neural network toolbox.
genFunction(net,pathname)
If you want the function to accept only matrix elements you should use this command:
genFunction(net,pathname,'MatrixOnly','yes')