Passing numerical and categorical data to regression learner .predictFcn programmatically in app designer
4 views (last 30 days)
Show older comments
I am trying to pass the following table to the .predictFcn in a trained regression model from the regression learner app.
I currently get the following error:
I think this is down to the data type difference in Tyre as it is categorical data. However, when I try and change the data type of the table using predictarray.Tyre = categorical(predictarray.Tyre) it also throws an error.
I was wondering if anyone might be able to tell me how to feed the categorical data into the table so the function can pick it up.
Thanks
0 Comments
Answers (1)
Drew
on 2 Mar 2023
In general, when using trainedModel.predictFcn, the observation data that is passed to trainedModel.predictFcn should contain the same features (same columns) that were in the original dataset that was loaded into the Regression Learner app. The predictFcn will handle the feature selection and PCA, if any. Given the error message seen above, it looks like perhaps 'Tyre' was not one of the featues loaded into the Regression Learner app when building that model.
To look into this further, please share samples from the model training data, the trained model, and samples of the test data.
For examples of using models exported from Learner Apps in App Designer, see these two answers:
If this answer helps you, please remember to accept this answer.
0 Comments
See Also
Categories
Find more on Regression Learner App in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!