Simulink 中的机器学习
使用 Simulink 扩展机器学习工作流
通过使用 Statistics and Machine Learning Toolbox™ 中包含的 Statistics and Machine Learning 模块库中的模块,在 Simulink® 模型中实现机器学习功能。此工具箱提供执行以下工作流的模块:
使用分类预测或回归预测模块将经过训练的分类或回归模型对象导入 Simulink 中。
在分类学习器或回归学习器中训练机器学习模型,并将模型导出到 Simulink。
在 Simulink 中使用增量学习模块实时持续更新和监控机器学习模型中的漂移。
在 Simulink 中使用 KNN Search 模块查找数据中的最近邻点以查询点并执行聚类分析。
在 Simulink 中使用 Python 协同执行模块协同执行经过训练的 Python® 机器学习模型。
模块
主题
分类
- Predict Class Labels Using ClassificationSVM Predict Block
This example shows how to use the ClassificationSVM Predict block for label prediction in Simulink®. - Predict Class Labels Using ClassificationTree Predict Block
Train a classification decision tree model using the Classification Learner app, and then use the ClassificationTree Predict block for label prediction. - Predict Class Labels Using ClassificationLinear Predict Block
This example shows how to use the ClassificationLinear Predict block for label prediction in Simulink®. (自 R2023a 起) - Predict Class Labels Using ClassificationECOC Predict Block
Train an ECOC classification model, and then use the ClassificationECOC Predict block for label prediction. (自 R2023a 起) - Predict Class Labels Using ClassificationEnsemble Predict Block
Train a classification ensemble model with optimal hyperparameters, and then use the ClassificationEnsemble Predict block for label prediction. - Predict Class Labels Using ClassificationNaiveBayes Predict Block
Train a naive Bayes classification model, and then use the ClassificationNaiveBayes Predict block for label prediction. (自 R2024a 起) - Predict Class Labels Using ClassificationNeuralNetwork Predict Block
Train a neural network classification model, and then use the ClassificationNeuralNetwork Predict block for label prediction. - Predict Class Labels Using ClassificationKNN Predict Block
Train a nearest neighbor classification model, and then use the ClassificationKNN Predict block for label prediction. - Predict Class Labels Using ClassificationDiscriminant Predict Block
Train a discriminant analysis classification model, and then use the ClassificationDiscriminant Predict block for label prediction. (自 R2023b 起) - Predict Class Labels Using ClassificationKernel Predict Block
Train a Gaussian kernel classification model, and then use the ClassificationKernel Predict block for label prediction. (自 R2024b 起)
回归
- Predict Responses Using RegressionSVM Predict Block
Train a support vector machine (SVM) regression model using the Regression Learner app, and then use the RegressionSVM Predict block for response prediction. - Predict Responses Using RegressionTree Predict Block
This example shows how to use the RegressionTree Predict block for response prediction in Simulink®. - Predict Responses Using RegressionLinear Predict Block
This example shows how to use the RegressionLinear Predict block for response prediction in Simulink®. (自 R2023a 起) - Predict Responses Using RegressionEnsemble Predict Block
Train a regression ensemble model with optimal hyperparameters, and then use the RegressionEnsemble Predict block for response prediction. - Predict Responses Using RegressionNeuralNetwork Predict Block
Train a neural network regression model, and then use the RegressionNeuralNetwork Predict block for response prediction. - Predict Responses Using RegressionGP Predict Block
Train a Gaussian process (GP) regression model, and then use the RegressionGP Predict block for response prediction. - Predict Responses Using RegressionKernel Predict Block
This example shows how to use the RegressionKernel Predict block for response prediction in Simulink®. (自 R2024b 起)
增量学习
- Perform Incremental Learning Using IncrementalClassificationLinear Fit and Predict Blocks
Perform incremental learning with the IncrementalClassificationLinear Fit block and predict labels with the IncrementalClassificationLinear Predict block. (自 R2023b 起) - Perform Incremental Learning Using IncrementalRegressionLinear Fit and Predict Blocks
Perform incremental learning with the IncrementalRegressionLinear Fit block and predict responses with the IncrementalRegressionLinear Predict block. (自 R2023b 起) - Perform Incremental Learning Using IncrementalClassificationECOC Fit and Predict Blocks
Perform incremental learning with the IncrementalClassificationECOC Fit block and predict labels with the IncrementalClassificationECOC Predict block. (自 R2024a 起) - Perform Incremental Learning Using IncrementalClassificationKernel Fit and Predict Blocks
Perform incremental learning with the IncrementalClassificationKernel Fit block and predict labels with the IncrementalClassificationKernel Predict block. (自 R2024b 起) - Perform Incremental Learning Using IncrementalRegressionKernel Fit and Predict Blocks
Perform incremental learning with the IncrementalRegressionKernel Fit block and predict responses with the IncrementalRegressionKernel Predict block. (自 R2024b 起) - Perform Incremental Learning and Track Performance Metrics Using Update Metrics Block
Perform incremental learning and track performance metrics with the Update Metrics block. (自 R2023b 起) - Monitor Drift Using Detect Drift Block
This example shows how to use the Detect Drift block for monitoring drift in a data stream in Simulink®. (自 R2024b 起) - In-Place Model Update of Offline Linear Model Using IncrementalClassificationLinear Predict Block
Perform in-place model update without regenerating deployed code. (自 R2025a 起)
增量学习模板
- Configure Simulink Template for Conditionally Enabled Incremental Linear Classification
Configure the Simulink Enabled Execution Incremental Learning template to perform incremental linear classification. (自 R2024a 起) - Configure Simulink Template for Conditionally Enabled Incremental Linear Regression
Configure the Simulink Enabled Execution Incremental Learning template to perform incremental linear regression. (自 R2024a 起) - Configure Simulink Template for Rate-Based Incremental Linear Classification
Configure the Simulink Rate-Based Incremental Learning template to perform incremental linear classification. (自 R2024a 起) - Configure Simulink Template for Rate-Based Incremental Linear Regression
Configure the Simulink Rate-Based Incremental Learning template to perform incremental linear regression. (自 R2024a 起) - Configure Simulink Template for Drift-Aware Incremental Learning
Configure the Drift-Aware Training for Incremental Learning template to perform drift-aware learning. (自 R2025a 起)
聚类分析和建立分类模型检测
- Find Nearest Neighbors Using KNN Search Block
Train a nearest neighbor searcher model, and then use the KNN Search block for label prediction. (自 R2023b 起)
Python 协同执行
- Predict Cluster Assignments Using Python Scikit-learn Model Predict Block
This example shows how to use the Scikit-learn Model Predict block for prediction in Simulink®. - Predict Responses Using Custom Python Model in Simulink
This example shows how to use the Custom Python Model Predict block for prediction in Simulink®.
将使用学习器 App 训练的模型导出到 Simulink
- Export Classification Model to Make Predictions in Simulink
Train a model in Classification Learner, and then export the model to Simulink. - Export Regression Model to Make Predictions in Simulink
Train a model in Regression Learner, and then export the model to Simulink.
代码生成
- System Objects for Classification and Code Generation
Generate code from a System object™ for making predictions using a trained classification model, and use the System object in a Simulink model. - Predict Class Labels Using MATLAB Function Block
Generate code from a Simulink model that classifies data using an SVM model. - Predict Class Labels Using Stateflow
Generate code from a Stateflow® model that classifies data using a discriminant analysis classifier.
相关信息
- Simulink 深度学习 (Deep Learning Toolbox)