Skip to main content

oSP3D Script API 2024 R1

CustomModelInterface Struct Reference

Last update: 16.07.2025

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. 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 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 Matrix 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 deserialize ( string  state)
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
stateThe serialization as produced by the serialize function

◆ evaluate()

virtual Matrix evaluate ( Matrix  samples)
virtual

Destroys an instance of this class.

Evaluate the model on the given sample inputs and return the values

Parameters
samplesThe given values
Returns
The models values on the given samples

◆ residuals()

virtual quality_measure::Residuals 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 string 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

Connect with Ansys