Passing numerical and categorical data to regression learner .predictFcn programmatically in app designer
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Drew
2023-3-2
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Regression Learner App 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!