    

 ## On this page

  

 

 # CustomModel Class Reference

 Last update: 16.07.2025 

## <a name="pub-methods"></a>Public Member Functions

virtual std::vector&lt; bool &gt; [activeVariables](class_custom_model.xhtml#a5f1838dd858c10b0fd7437d43ac4ea33) () override Returns the active variables selected during the training process of the model. [More...](#a5f1838dd858c10b0fd7437d43ac4ea33)  
 <a id="aedfb47575823522e6a6d22ce6c12e826"></a>virtual [addProperty](class_property_user_base.xhtml#aedfb47575823522e6a6d22ce6c12e826) ([PropertyBase](struct_property_base.xhtml) p) Properties that help the [ScalarMOP](struct_scalar_m_o_p.xhtml "This is only a sketch of the possible ScalarMOPApproximate API Implementation shall be refined if mor...") scheduling the Models to be built The properties class needs to be implemented for the specific model type.   
 <a id="a4157584723d8c5006120f80f35c39062"></a> [CustomModel](class_custom_model.xhtml#a4157584723d8c5006120f80f35c39062) () Creates an default initialized instance of this class.   
  [CustomModel](class_custom_model.xhtml#aacf86a2314d5ac9cf1771ca029dce7b9) ([PropertyList](class_property_list.xhtml) properties) Creates an default initialized instance of this class takeing th given properties. [More...](#aacf86a2314d5ac9cf1771ca029dce7b9)  
 <a id="a40e7ff8e5f1af327a84222a105453b44"></a> [CustomModel](class_custom_model.xhtml#a40e7ff8e5f1af327a84222a105453b44) ([CustomModel](class_custom_model.xhtml) other) Copies an instance of this class.   
 virtual [Matrix](class_matrix.xhtml) [cvOutputs](class_custom_model.xhtml#a85e586564296f496505584cce05a2654) () override Returns the values based on the cross validation residuals. [More...](#a85e586564296f496505584cce05a2654)  
 <a id="a5b2e46fbcea6066927a42c7b182116a7"></a> **deserializePythonPart** () virtual [Matrix](class_matrix.xhtml) [evaluate](class_custom_model.xhtml#a85c04b0ec7ee1ee66e21af920faabb73) ([Matrix](class_matrix.xhtml) points, bool extrapolate=true) override Destroys an instance of this class. [More...](#a85c04b0ec7ee1ee66e21af920faabb73)  
 <a id="a9347a73a154f12da870142da796881e0"></a>[ModelDataWrapper](class_model_data_wrapper.xhtml) [getModelData](class_custom_model.xhtml#a9347a73a154f12da870142da796881e0) () Obtain data necessary to built a model, mainly used for hybrid models where the build is performed in python but the inference in C++.   
 <a id="a6058bdae970b9b1ac93df22b24740a87"></a>string [getModelName](class_custom_model.xhtml#a6058bdae970b9b1ac93df22b24740a87) () Obtain the class name for which a c++ model will be created for hybrid approximation.   
 <a id="a0e1dd7df82728594fc128ed1c797b0c0"></a>virtual [PropertyList](class_property_list.xhtml) [getProperties](class_property_user_base.xhtml#a0e1dd7df82728594fc128ed1c797b0c0) () Returns the properties stored by this user.   
 bool [hasRegisteredModel](class_custom_model.xhtml#aba852c1478ec4cf87b7510ea87aaec0b) () Returns true iff the instance of this class has a Python model instance registered. [More...](#aba852c1478ec4cf87b7510ea87aaec0b)  
 <a id="a9dd98cbb44003dcaa6fb600d18440439"></a>bool [isHybrid](class_custom_model.xhtml#a9dd98cbb44003dcaa6fb600d18440439) () Indicates whether this model is hybrid and thus, the approximation happens on C++ side.   
 virtual uint [numCoeffs](class_custom_model.xhtml#adc952cd2ab38749eaedfcce28a0cadb2) () override Returns the number of model coefficients used for the regression. [More...](#adc952cd2ab38749eaedfcce28a0cadb2)  
 virtual uint [numVariables](class_custom_model.xhtml#af956c8befdfe0c8e9557bfe9ff57e46e) () override Returns the number of active variables selected during the training process of the model. [More...](#af956c8befdfe0c8e9557bfe9ff57e46e)  
 <a id="a29255ab840bc80a9f21abd179f216d9d"></a>[CustomModel](class_custom_model.xhtml) [operator=](class_custom_model.xhtml#a29255ab840bc80a9f21abd179f216d9d) ([CustomModel](class_custom_model.xhtml) other) Copies an instance of this class.   
 virtual quality\_measure::ResidualsBase [residuals](class_custom_model.xhtml#afe90ce58ae457fa0cecebf5f154edc30) () override Returns the residuals needed to compute the quality\_measure. [More...](#afe90ce58ae457fa0cecebf5f154edc30)  
 template&lt;class Archive &gt;  [serialize](class_custom_model.xhtml#ae3fa2bc56690639794d33188524b0dfe) ([Archive](class_archive.xhtml) ar, number version) serializes this object, see boost::serialization [More...](#ae3fa2bc56690639794d33188524b0dfe)  
 virtual [transferProperties](class_property_user_base.xhtml#ab9507274f126b856fb69cd621f0f9fb4) ([PropertyList](class_property_list.xhtml) property\_list) Convenience function to transfer a complete [PropertyList](class_property_list.xhtml "Container class for handling properties Uses templates to easily find and cast configurations of diff...") into the model. [More...](#ab9507274f126b856fb69cd621f0f9fb4)  
 virtual std::ostream [write](class_custom_model.xhtml#a1aafb5e0753eea90b54a7c1f9bb27741) (std::ostream os) override Interface to write function identification. [More...](#a1aafb5e0753eea90b54a7c1f9bb27741)  
 ## <a name="pub-attribs"></a>Public Attributes

apply SWIGTYPE \* **DISOWN** <a id="ad97b05b88ce9080f35b157cfacc8eb69"></a>string **id** ## <a name="friends"></a>Friends

<a id="ac98d07dd8f7b70e16ccb9a01abf56b9c"></a>class **boost::serialization::access**## Constructor &amp; Destructor Documentation

<a id="aacf86a2314d5ac9cf1771ca029dce7b9"></a>## [◆ ](#aacf86a2314d5ac9cf1771ca029dce7b9)CustomModel()

 [CustomModel](class_custom_model.xhtml)  ( [PropertyList](class_property_list.xhtml)  *properties*) 

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

Parameters propertiesList of properties used by this class 



## Member Function Documentation

<a id="a5f1838dd858c10b0fd7437d43ac4ea33"></a>## [◆ ](#a5f1838dd858c10b0fd7437d43ac4ea33)activeVariables()

 virtual std::vector&lt;bool&gt; activeVariables  ( )   overridevirtual 

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

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



<a id="a85e586564296f496505584cce05a2654"></a>## [◆ ](#a85e586564296f496505584cce05a2654)cvOutputs()

 virtual [Matrix](class_matrix.xhtml) cvOutputs  ( )   overridevirtual 

Returns the values based on the cross validation residuals.

ReturnsThe cross-validation values, a vector of length numInputs 



<a id="a85c04b0ec7ee1ee66e21af920faabb73"></a>## [◆ ](#a85c04b0ec7ee1ee66e21af920faabb73)evaluate()

 virtual [Matrix](class_matrix.xhtml) evaluate  ( [Matrix](class_matrix.xhtml)  *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 ReturnsThe values of the model on the given points Implements [ModelBase](class_model_base.xhtml#a5ec7821e9b8c1aaa6c43dc5ca1263f2f).





<a id="aba852c1478ec4cf87b7510ea87aaec0b"></a>## [◆ ](#aba852c1478ec4cf87b7510ea87aaec0b)hasRegisteredModel()

 bool hasRegisteredModel  ( ) 

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

Returnstrue/false 



<a id="adc952cd2ab38749eaedfcce28a0cadb2"></a>## [◆ ](#adc952cd2ab38749eaedfcce28a0cadb2)numCoeffs()

 virtual uint numCoeffs  ( )   overridevirtual 

Returns the number of model coefficients used for the regression.

ReturnsA numbereger 



<a id="af956c8befdfe0c8e9557bfe9ff57e46e"></a>## [◆ ](#af956c8befdfe0c8e9557bfe9ff57e46e)numVariables()

 virtual uint numVariables  ( )   overridevirtual 

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

ReturnsA numbereger 



<a id="afe90ce58ae457fa0cecebf5f154edc30"></a>## [◆ ](#afe90ce58ae457fa0cecebf5f154edc30)residuals()

 virtual quality\_measure::ResidualsBase residuals  ( )   overridevirtual 

Returns the residuals needed to compute the quality\_measure.

ReturnsThe residuals 



<a id="ae3fa2bc56690639794d33188524b0dfe"></a>## [◆ ](#ae3fa2bc56690639794d33188524b0dfe)serialize()

 serialize  ( [Archive](class_archive.xhtml)  *ar*,    number  *version*   ) 

serializes this object, see boost::serialization

Parameters arthe boost archive versionthe version number 



<a id="ab9507274f126b856fb69cd621f0f9fb4"></a>## [◆ ](#ab9507274f126b856fb69cd621f0f9fb4)transferProperties()

 virtual transferProperties  ( [PropertyList](class_property_list.xhtml)  *property\_list*)   virtualinherited 

Convenience function to transfer a complete [PropertyList](class_property_list.xhtml "Container class for handling properties Uses templates to easily find and cast configurations of diff...") into the model.

Parameters property\_listThe properties to transfer into this model 



<a id="a1aafb5e0753eea90b54a7c1f9bb27741"></a>## [◆ ](#a1aafb5e0753eea90b54a7c1f9bb27741)write()

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

Interface to write function identification.

Returnsostream containing the information 



## Member Data Documentation

<a id="aa936348f586ed71a2a8585a4b16b20fc"></a>## [◆ ](#aa936348f586ed71a2a8585a4b16b20fc)DISOWN

 apply SWIGTYPE \* DISOWN

**Initial value:**{[CustomModelInterface](struct_custom_model_interface.xhtml "This class provides an API for the CustomModels to be implemented in Python. It is exported as an dir...") * model}





 registerModel([CustomModelInterface](struct_custom_model_interface.xhtml "This class provides an API for the CustomModels to be implemented in Python. It is exported as an dir...") * model, bool reset_residuals = true)