{"id":1598,"date":"2025-07-31T16:29:30","date_gmt":"2025-07-31T16:29:30","guid":{"rendered":"https:\/\/blogs.mathworks.com\/finance\/?p=1598"},"modified":"2025-07-31T16:29:30","modified_gmt":"2025-07-31T16:29:30","slug":"building-a-neural-network-for-time-series-forecasting-low-code-workflow","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/finance\/2025\/07\/31\/building-a-neural-network-for-time-series-forecasting-low-code-workflow\/","title":{"rendered":"Building a Neural Network for Time Series Forecasting &#8211; Low-Code Workflow"},"content":{"rendered":"<p><em>The following post is from <a href=\"https:\/\/www.linkedin.com\/in\/yuchen-dong-48061582\/\">Yuchen Dong<\/a>, Senior Financial Application Engineer at MathWorks.<\/em><\/p>\n<p>Financial institutions forecast GDP to set capital buffers and plan stress-testing scenarios. Using <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/add-live-editor-tasks-to-a-live-script.html\">MATLAB\u00ae Live Tasks<\/a> and the <a href=\"https:\/\/www.mathworks.com\/help\/deeplearning\/ref\/neuralnettimeseries-app.html\">Neural Net Time Series App<\/a>, you can build and train a nonlinear autoregressive network in one line of code, without writing custom functions. This post shows how to import GDP data, clean missing values, and generate a trained model that forecasts for the next four quarters.<\/p>\n<h1>Step 1: Import Time Series Data with Live Task<\/h1>\n<p>First, open a new Live Script. From the Live Editor tab, click on Task and select Import Data.<br \/>\nUsing this task, you can load GDP data directly from an Excel file:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-1628\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2025\/07\/datatImport.png\" alt=\"\" width=\"653\" height=\"212\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-1625\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2025\/07\/dataFolder.png\" alt=\"\" width=\"645\" height=\"193\" \/><\/p>\n<p>MATLAB automatically identifies the structure as a <strong>timetable<\/strong>, where the first column is the date and the second column contains GDP values. Some entries have missing values.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-1622\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2025\/07\/dataHighlighted.png\" alt=\"\" width=\"770\" height=\"396\" \/><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-1619\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2025\/07\/dataTimestamp.png\" alt=\"\" width=\"305\" height=\"307\" \/><\/p>\n<h1>Step 2: Clean Missing Data with Live Task<\/h1>\n<p>Next, insert the <strong>&#8220;Clean Missing Data&#8221;<\/strong> Live Task. This task allows us to handle missing entries with just a few clicks.<br \/>\nSelect the GDP variable and choose <strong>linear interpolation<\/strong> to fill the missing values:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-1616\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2025\/07\/missingData.png\" alt=\"\" width=\"727\" height=\"368\" \/><\/p>\n<p>The output shows the original vs. filled-in values\u2014blue for existing data and red for interpolated points.<\/p>\n<h1><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-1613\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2025\/07\/fillMissing.png\" alt=\"\" width=\"522\" height=\"358\" \/><\/p>\n<p>Step 3: Build and Train the Neural Network<\/h1>\n<p>Once the data is preprocessed, run a single line of code to convert the numeric array to a cell array, which is required for the neural network app:<\/p>\n<pre>GDP = num2cell(newTable.GDP');<\/pre>\n<p>Then, launch the <strong>Neural Net Time Series App<\/strong>:<\/p>\n<p>From there:<br \/>\n1. Select the Nonlinear Autoregressive (NAR) network, ideal for forecasting based on past values.<\/p>\n<p>&nbsp;<\/p>\n<p>2. Import the GDP data.<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-1610\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2025\/07\/appScreenshot.png\" alt=\"\" width=\"864\" height=\"504\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>3. Specify the data split for training (e.g., 90%), validation (5%), and testing (5%). Adjust the hidden layer size and time delay according to your model requirements.<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-1607\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2025\/07\/toolstrip.png\" alt=\"\" width=\"543\" height=\"144\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>4. Click Train to start the learning process:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-1604\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2025\/07\/trainModel.png\" alt=\"\" width=\"1081\" height=\"281\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>5. The app provides performance metrics and visualizations:<br \/>\no Response Plot: Shows training targets vs. predicted outputs, highlighting discrepancies such as those during economic shocks (e.g., recessions).<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-1601\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2025\/07\/responsePlot.png\" alt=\"\" width=\"1007\" height=\"801\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>6. Automatically Generate Code<br \/>\nMATLAB allows automatic generation of the training script used in the modeling process:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-1634\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2025\/07\/generateCode.png\" alt=\"\" width=\"616\" height=\"458\" \/><\/p>\n<h1><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-1631\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2025\/07\/code.png\" alt=\"\" width=\"695\" height=\"398\" \/><\/p>\n<p>Conclusion<\/h1>\n<p>This low-code workflow is ideal for quickly experimenting with time series models, especially if you&#8217;re new to neural networks or prefer visual tools. No custom code is needed to get meaningful insights from your data.<\/p>\n<h1>Want to try it yourself?<\/h1>\n<p>Open MATLAB, create a Live Script, and start exploring Live Tasks and the Neural Network Time Series App.<\/p>\n<p><strong>To request a Free Trial, click on the link below:<\/strong><\/p>\n<p><a href=\"https:\/\/www.mathworks.com\/campaigns\/products\/trials.html?s_tid=sol_banner_trial\">Try MATLAB, Simulink, and More\u2026<\/a><\/p>\n<h1>Explore more resources:<\/h1>\n<p><a href=\"https:\/\/www.mathworks.com\/help\/deeplearning\/ref\/neuralnettimeseries-app.html\">Neural Net Time Series<\/a><br \/>\n<a href=\"https:\/\/www.mathworks.com\/help\/deeplearning\/ug\/time-series-forecasting-using-deep-learning.html\">Time series forecasting using Deep Learning<\/a><br \/>\n<a href=\"https:\/\/www.mathworks.com\/videos\/how-to-set-up-and-manage-experiments-in-matlab-1697438289991.html\">How to set up and manage experiments in MATLAB<\/a><br \/>\n<a href=\"https:\/\/www.mathworks.com\/videos\/how-to-clean-your-data-in-matlab-1669878601148.html?s_tid=vid_pers_recs\">How to do data cleaning in MATLAB<\/a><br \/>\n<a href=\"https:\/\/www.mathworks.com\/videos\/low-code-data-analysis-with-matlab-1676562237481.html\">Low-code data analysis in MATLAB<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"http:\/\/blogs.mathworks.com\/finance\/files\/2025\/07\/datatImport.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>The following post is from Yuchen Dong, Senior Financial Application Engineer at MathWorks.<br \/>\nFinancial institutions forecast GDP to set capital buffers and plan stress-testing scenarios. Using MATLAB\u00ae&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/finance\/2025\/07\/31\/building-a-neural-network-for-time-series-forecasting-low-code-workflow\/\">read more >><\/a><\/p>\n","protected":false},"author":204,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10,31,16,37],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/posts\/1598"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/users\/204"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/comments?post=1598"}],"version-history":[{"count":1,"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/posts\/1598\/revisions"}],"predecessor-version":[{"id":1637,"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/posts\/1598\/revisions\/1637"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/media?parent=1598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/categories?post=1598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/finance\/wp-json\/wp\/v2\/tags?post=1598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}