How to create an output from trained model using "nnstart" with new set of input data with unknown output?

35 次查看(过去 30 天)
Hello experts in MATLAB neural network. In nntool I introduce 3 files, "input", "target", and "sample". I use "input and target" to train my nn model. Then I use a completely new set of data (either larger or smaller number of data sets but with the same input variables) called "sample" and I extract my output called "predict" which I never given to nntool. How can I do the same with nnstart?

回答(1 个)

Tejas
Tejas 2024-3-28
Hello Ahmad,
To train a neural network and obtain predictions using the nnstart tool, simply type nnstart in the MATLAB command line. This action will launch the Neural Network Start GUI. Here is a step-by-step guide to navigate through the process:
  • First, select the type of neural network you wish to train.
  • At the top bar, choose the 'Import' option and add your input and target files.
  • Next, click on the 'Train' option in the top bar of the GUI. This will initiate the training of the model with your input data.
  • After the training is complete, click on the 'Export Model' option and then select 'Export to Workspace'.
  • You will be prompted to provide a name for the struct variable where this neural network will be saved. The default name is results.
  • The results will contain the network weights under the name Network and TrainingResults in the form of a structure.
  • To feed a sample dataset into this model, use the following syntax:
predict = results.Network(sample);
  • This will store the prediction in the 'predict' variable.
For additional details on the nnstart tool, please refer to this documentation:
Hope it helps!
  4 个评论
Ahmad Sedaghat
Ahmad Sedaghat 2024-4-1
This is not Regression Learner. I am using nnstart. The menu do not give any Export. They only provide a function or a script. What version do you use?
Tejas
Tejas 2024-4-2
I am currently working with MATLAB R2022b.
If the "Export to Workspace" option is missing, it may prove beneficial to reinstall or update MATLAB to newer versions for access to enhanced features and compatibility. This method simplifies the process, as selecting the "Export to Workspace" option immediately provides a structure into which the sample dataset can be input with minimal need for data conversion.
To obtain predictions from the function,save the function in a MATLAB file with the same name as the function itself. The following syntax can then be utilized: [Y, Xf, Af] = trainedModel(X, Xi, []);
This syntax is consistent with the code previously provided. To ensure the sample dataset is compatible with the model intended for predictions, appropriate conversion of the dataset is necessary. For guidance on this conversion, refer to the specific documentation for the desired neural network model. After inputting the dataset into the function, the variable "Y" will contain the predictions.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by