Loading Classification Model in Simulink created using MATLAB Classification Learner App
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have trained a classification model using Matlab's Classification Learner App. I have exported it to the workspace and also saved it as a .mat file.
I need to embed it in a Simulink model to make predictions at every time step during simulation. I've tried multiple things like:
- Using a From File block to load the classification model from the .mat file and then using mdl.predictFcn(myInputData) to make a prediction on new data.
- Pre-loading the model in workspace and then accessing it using a Matlab Function
However, both of these methods do not work. The first method gives me an error stating that the .mat file can only have timeseries data (which it doesn't as it is a classification model) and the second method is not able to identify the pre-loaded model in the workspace.
Can someone guide me in solving this issue. Thanks
0 commentaires
Réponses (1)
Drew
le 3 Nov 2023
MathWorks provides Simulink blocks for machine learning model prediction. So, you can use the native Simulink block designed for model prediction with your machine learning model. Check the "Blocks" section of the doc page https://www.mathworks.com/help/stats/code-generation.html
For example, from that doc page, here are Simulink blocks currently available for prediction with different types of ML Classifiers:
ClassificationECOC Predict Classify observations using error-correcting output codes (ECOC) classification model (Since R2023a)
ClassificationEnsemble Predict Classify observations using ensemble of decision trees (Since R2021a)
ClassificationKNN Predict Classify observations using nearest neighbor classification model (Since R2022b)
ClassificationNeuralNetwork Predict Classify observations using neural network classification model (Since R2021b)
ClassificationSVM Predict Classify observations using support vector machine (SVM) classifier for one-class and binary classification (Since R2020b)
if this answer helps you, please remember to accept the answer.
0 commentaires
Voir également
Catégories
En savoir plus sur Classification Learner App dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!