APP DESIGNER: How to convert value input by user into array and test it using trained neural network?

1 Ansicht (letzte 30 Tage)
Dear MATLAB user,
I have been stucked with this problem for several days and I could not figure out what are my mistakes?
The aim of my app designer is to receive input from user > predict using trained neural network > show output at GUI
Problem that I face now is to convert the input variables (3 variables) by user into an array. This is because I used an array in the network. The code that I used:
T=table(app.Variable1.Value,app.Variable2.Value,app.Variable3.Value,);
T2=table2array(T);
but somehow I dont think this is the right way to do this.

Akzeptierte Antwort

Cris LaPierre
Cris LaPierre am 25 Feb. 2022
Bearbeitet: Cris LaPierre am 25 Feb. 2022
Why create a table just to turn it back into a matrix? Why not just concatenate the 3 variables? Since we know nothing about what the input looks like, here is a general suggestion
T2=[app.Variable1.Value,app.Variable2.Value,app.Variable3.Value];
You may need to transpose your variables depending on how the user inputs them to get your array to be organized the way your network expects.
  2 Kommentare
Nurliana Farhana Salehuddin
Nurliana Farhana Salehuddin am 25 Feb. 2022
Bearbeitet: Nurliana Farhana Salehuddin am 25 Feb. 2022
Thank you. I also dunno why I make it complicated.
Would like to ask for your opinion, I use mapstd to scale my input for the trained network.
x = TrainInput;
t = TrainOutput;
[x1 ps]=mapstd(x);
[t1 ts]=mapstd(t);
Thus, in app designer I also need to convert the input before using the network right? But how do I convert back the mapstd values after prediction into the original scale ?
Cris LaPierre
Cris LaPierre am 25 Feb. 2022
You need to preprocess your actual data the exact same way you preprocessed your training data for your model to give meaningful results.
The way to get back to original values is to do the opposite of what mapstd is doing. You can see the algorithm used here. Just a note that I would not expect to get exactly the same values back, but they should be fairly close. You will need to use the mean and std values you passed into mapstd.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by