Tish_sheridan asked . 2021-07-08

How can I predict a future value from a time series using the

I am trying to use MATLAB and the Neural Network Toolbox to predict a future value from a time series. I am trying to use a recurrent network (Elman), but am unable to get it working. I think I misinterpreted the example and am not providing the right input data.
 
For example, I am trying to predict the next value in a series:
 x1 x2 x3 x4 x5 -> x6

 x2 x3 x4 x5 x6 -> x7

 

predict , elman , newelm , matlab , programming

Expert Answer

Prashant Kumar answered . 2024-12-21 17:27:16

If you happen to know that "x(T)" is predictable, given:
 
 
 x(T-N) ... x(T-1)
The best way to solve the problem is simply to provide those values to a feed-forward network as you have done.
 
We recommend the Elman network for problems where an unknown number of past data points are needed to properly predict the next data point. The advantage of the Elman network is that it can use its recurrent hidden layer to store useful information about data points far in the past.
 
There are a few drawbacks with this method. First, the job an Elman network has to perform is more difficult than that of a feed-forward network. The feed-forward network is presumably given enough information to make a good prediction. The Elman network not only has to make the prediction, but has to figure out what information is necessary to keep about past data points in order to make a prediction. Thus, more neurons are needed in the hidden layer.
Second, the internal state produced by the hidden layer is largely dependent on its initial weights and biases. Ensuring that there is enough variation in weights and biases to form a precise enough representation of past inputs for the problem also requires that even more neurons be allocated to the hidden layer.
 
There are also a couple of practical reasons that feed-forward networks will give you a better result when using the current version of the Neural Network Toolbox. You can now train feed-forward networks with the Levenberg-Marquardt algorithm, saving a lot of time. The Elman network also currently trains on a single time series.
 
Here is the code if you do decide that an Elman network is appropriate for your problem:
 
    % Target Vector

    T = [3 9 12 4 10 13 5]; 

    % Input Vector

    delaymat = toeplitz([3 0],T);

    P = delaymat(2,:);

    % Number of hidden neurons

    S1 = 20;

    % Create Network

    net = newelm(P,T,S1);

    % Train Network

    Pseq = con2seq(P);

    Tseq = con2seq(T);

    net = train(net,Pseq,Tseq);

    % Test the network 

    Y = sim(net,Pseq);

    z = seq2con(Y);

    diff1 = T - z{1,1};

One way around the single-series limitation is to append separate time series to each other. If the series are long, the fact that prediction is impossible (between the end of one series and the beginning of the next) should not harm learning any more than that from noise. The network will learn the predictable parts and simply settle for high errors where the series are joined, satisfying the initial goal.


Not satisfied with the answer ?? ASK NOW

Frequently Asked Questions

MATLAB offers tools for real-time AI applications, including Simulink for modeling and simulation. It can be used for developing algorithms and control systems for autonomous vehicles, robots, and other real-time AI systems.

MATLAB Online™ provides access to MATLAB® from your web browser. With MATLAB Online, your files are stored on MATLAB Drive™ and are available wherever you go. MATLAB Drive Connector synchronizes your files between your computers and MATLAB Online, providing offline access and eliminating the need to manually upload or download files. You can also run your files from the convenience of your smartphone or tablet by connecting to MathWorks® Cloud through the MATLAB Mobile™ app.

Yes, MATLAB provides tools and frameworks for deep learning, including the Deep Learning Toolbox. You can use MATLAB for tasks like building and training neural networks, image classification, and natural language processing.

MATLAB and Python are both popular choices for AI development. MATLAB is known for its ease of use in mathematical computations and its extensive toolbox for AI and machine learning. Python, on the other hand, has a vast ecosystem of libraries like TensorFlow and PyTorch. The choice depends on your preferences and project requirements.

You can find support, discussion forums, and a community of MATLAB users on the MATLAB website, Matlansolutions forums, and other AI-related online communities. Remember that MATLAB's capabilities in AI and machine learning continue to evolve, so staying updated with the latest features and resources is essential for effective AI development using MATLAB.

Without any hesitation the answer to this question is NO. The service we offer is 100% legal, legitimate and won't make you a cheater. Read and discover exactly what an essay writing service is and how when used correctly, is a valuable teaching aid and no more akin to cheating than a tutor's 'model essay' or the many published essay guides available from your local book shop. You should use the work as a reference and should not hand over the exact copy of it.

Matlabsolutions.com provides guaranteed satisfaction with a commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been empanelled after extensive research and quality check.

Matlabsolutions.com provides undivided attention to each Matlab assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work done at the best price in industry.