Custom Python Model Predict
Libraries:
Statistics and Machine Learning Toolbox /
Deep Learning Toolbox /
Python Models /
Python Neural Networks
Description
The Custom Python Model Predict block predicts responses using a pretrained custom Python® model running in the MATLAB® Python environment. MATLAB supports the reference implementation of Python, often called CPython. If you use a Mac or Linux® platform, you already have Python installed. If you use Windows®, you need to install a distribution, such as those found at https://www.python.org/downloads/. For more information, see Configure Your System to Use Python. The Custom Python Model Predict block has been tested using Python version 3.10.
Load a custom Python model into the block by specifying the path to a Python file that
defines load_model()
and predict()
functions. The
Custom Python Model Predict block calls the load_model()
function once in
Python with arguments you specify in Arguments to load_model(), and then calls the
predict()
function at every simulation step. The input port
In1 receives input data, and the output port Out1
returns predicted responses for the input data. You can add input and output ports using the
Inputs and Outputs tabs of the Block Parameters
dialog box (see Inputs and Outputs).
Note
You cannot run the Custom Python Model Predict block in Rapid Accelerator mode.
Examples
Ports
Input
Output
Parameters
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Version History
Introduced in R2024a
See Also
Blocks
- Scikit-learn Model Predict | TensorFlow Model Predict (Deep Learning Toolbox) | PyTorch Model Predict (Deep Learning Toolbox) | ONNX Model Predict (Deep Learning Toolbox)