CustomModelInterface Struct Reference
Last update: 16.07.2025This class provides an API for the CustomModels to be implemented in Python. It is exported as an director through SWIG and the user will be able to derive from it in Python. More...
Public Member Functions | |
| virtual string | __class_name_internal__ () |
| Internal helper function to use with de-/serialization. | |
| virtual Matrix | activeVariables () |
| Returns a vector describing which input variable was active during training. More... | |
| CustomModelInterface () | |
| Creates an default initialized instance of this class. | |
| virtual | deserialize (string state) |
| This function allows an instance of the python model to deserialize its state from the given string. How this is done needs to be implemented in Python. More... | |
| virtual Matrix | evaluate (Matrix samples) |
| Destroys an instance of this class. More... | |
| virtual ModelDataWrapper | getModelData () |
| Obtain data necessary to built a model, mainly used for hybrid models where the build is performed in python but the inference in C++. | |
| virtual string | getModelName () |
| Obtain the class name for which a c++ model will be created for hybrid approximation. | |
| virtual bool | isHybrid () |
| Indicates whether this model is hybrid and thus, the approximation happens on C++ side. | |
| virtual int | numCoeffs () |
| Returns the number of model coefficients used for the regression. More... | |
| virtual int | numVariables () |
| Returns the number of active variables selected during the training process of the model. More... | |
| virtual quality_measure::Residuals | residuals () |
| Return the residuals that from the training to evaluate the quality measure with. More... | |
| virtual string | serialize () |
| This function returns the serialized data from the Python of the CustomModelInterface to be included in the CustomModel. It needs to be overloaded in Python. More... | |
Detailed Description
This class provides an API for the CustomModels to be implemented in Python. It is exported as an director through SWIG and the user will be able to derive from it in Python.
Member Function Documentation
◆ activeVariables()
|
virtual |
Returns a vector describing which input variable was active during training.
- Returns
- vector v with v[i] == 0 if input i was not active, v[i] == 1 otherwise
◆ deserialize()
|
virtual |
This function allows an instance of the python model to deserialize its state from the given string. How this is done needs to be implemented in Python.
- Parameters
-
state The serialization as produced by the serialize function
◆ evaluate()
Destroys an instance of this class.
Evaluate the model on the given sample inputs and return the values
- Parameters
-
samples The given values
- Returns
- The models values on the given samples
◆ numCoeffs()
|
virtual |
Returns the number of model coefficients used for the regression.
- Returns
- An integer
◆ numVariables()
|
virtual |
Returns the number of active variables selected during the training process of the model.
- Returns
- An integer
◆ residuals()
|
virtual |
Return the residuals that from the training to evaluate the quality measure with.
- Returns
- An instance of the Residuals class with the residuals from the training
◆ serialize()
|
virtual |
This function returns the serialized data from the Python of the CustomModelInterface to be included in the CustomModel. It needs to be overloaded in Python.
- Returns
- The serialization of the python instance