Skip to main content

optiSLang 3D Postprocessing Script API 2025 R1

CustomModel Class Reference

Last update: 16.07.2025

Public Member Functions

virtual std::vector< bool > activeVariables () override
 Returns the active variables selected during the training process of the model. More...
 
virtual addProperty (PropertyBase p)
 Properties that help the ScalarMOP scheduling the Models to be built The properties class needs to be implemented for the specific model type.
 
 CustomModel ()
 Creates an default initialized instance of this class.
 
 CustomModel (PropertyList properties)
 Creates an default initialized instance of this class takeing th given properties. More...
 
 CustomModel (CustomModel other)
 Copies an instance of this class.
 
virtual Matrix cvOutputs () override
 Returns the values based on the cross validation residuals. More...
 
 deserializePythonPart ()
 
virtual Matrix evaluate (Matrix points, bool extrapolate=true) override
 Destroys an instance of this class. More...
 
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++.
 
string getModelName ()
 Obtain the class name for which a c++ model will be created for hybrid approximation.
 
virtual PropertyList getProperties ()
 Returns the properties stored by this user.
 
bool hasRegisteredModel ()
 Returns true iff the instance of this class has a Python model instance registered. More...
 
bool isHybrid ()
 Indicates whether this model is hybrid and thus, the approximation happens on C++ side.
 
virtual uint numCoeffs () override
 Returns the number of model coefficients used for the regression. More...
 
virtual uint numVariables () override
 Returns the number of active variables selected during the training process of the model. More...
 
CustomModel operator= (CustomModel other)
 Copies an instance of this class.
 
virtual quality_measure::ResidualsBase residuals () override
 Returns the residuals needed to compute the quality_measure. More...
 
template<class Archive >
 serialize (Archive ar, number version)
 serializes this object, see boost::serialization More...
 
virtual transferProperties (PropertyList property_list)
 Convenience function to transfer a complete PropertyList into the model. More...
 
virtual std::ostream write (std::ostream os) override
 Interface to write function identification. More...
 

Public Attributes

apply SWIGTYPE * DISOWN
 
string id
 

Friends

class boost::serialization::access
 

Constructor & Destructor Documentation

◆ CustomModel()

CustomModel ( PropertyList  properties)

Creates an default initialized instance of this class takeing th given properties.

Parameters
propertiesList of properties used by this class

Member Function Documentation

◆ activeVariables()

virtual std::vector<bool> activeVariables ( )
overridevirtual

Returns the active variables selected during the training process of the model.

Returns
A vector that i-th entry is true iff the i-th input variable is active in the model

◆ cvOutputs()

virtual Matrix cvOutputs ( )
overridevirtual

Returns the values based on the cross validation residuals.

Returns
The cross-validation values, a vector of length numInputs

◆ evaluate()

virtual Matrix evaluate ( Matrix  points,
bool  extrapolate = true 
)
overridevirtual

Destroys an instance of this class.

Evaluates the model on the given points and returns the values

Parameters
pointsThe input points the model is evaluated on
extrapolateEvaluate the points outside of the bounding box of its training data
Returns
The values of the model on the given points

Implements ModelBase.

◆ hasRegisteredModel()

bool hasRegisteredModel ( )

Returns true iff the instance of this class has a Python model instance registered.

Returns
true/false

◆ numCoeffs()

virtual uint numCoeffs ( )
overridevirtual

Returns the number of model coefficients used for the regression.

Returns
A numbereger

◆ numVariables()

virtual uint numVariables ( )
overridevirtual

Returns the number of active variables selected during the training process of the model.

Returns
A numbereger

◆ residuals()

virtual quality_measure::ResidualsBase residuals ( )
overridevirtual

Returns the residuals needed to compute the quality_measure.

Returns
The residuals

◆ serialize()

serialize ( Archive  ar,
number  version 
)

serializes this object, see boost::serialization

Parameters
arthe boost archive
versionthe version number

◆ transferProperties()

virtual transferProperties ( PropertyList  property_list)
virtualinherited

Convenience function to transfer a complete PropertyList into the model.

Parameters
property_listThe properties to transfer into this model

◆ write()

virtual std::ostream write ( std::ostream  os)
overridevirtual

Interface to write function identification.

Returns
ostream containing the information

Member Data Documentation

◆ DISOWN

apply SWIGTYPE * DISOWN
Initial value:
registerModel(CustomModelInterface * model, bool reset_residuals = true)

Connect with Ansys