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

33 Ansichten (letzte 30 Tage)
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?

Antworten (1)

Tejas
Tejas am 28 Mär. 2024
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 Kommentare
Ahmad Sedaghat
Ahmad Sedaghat am 1 Apr. 2024
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 am 2 Apr. 2024
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by