> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CustomModel Class Reference

Part of [MOP models](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__models)

## Public Member Functions

| Type | Name |
| - | - |
| virtual std::vector\< bool > | [activeVariables](#a5f1838dd858c10b0fd7437d43ac4ea33) () override Returns the active variables selected during the training process of the model. |
|  virtual | [addProperty](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_user_base.md#aedfb47575823522e6a6d22ce6c12e826) ([PropertyBase](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_property_base.md) p) Properties that help the [ScalarMOP](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_scalar_m_o_p.md) scheduling the Models to be built The properties class needs to be implemented for the specific model type. |
| | [CustomModel](#a4157584723d8c5006120f80f35c39062) () Creates an default initialized instance of this class. |
| | [CustomModel](#aacf86a2314d5ac9cf1771ca029dce7b9) ([PropertyList](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_list.md) properties) Creates an default initialized instance of this class takeing th given properties. |
| | [CustomModel](#a40e7ff8e5f1af327a84222a105453b44) ([CustomModel](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_custom_model.md) other) Copies an instance of this class. |
| virtual [Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) | [cvOutputs](#a85e586564296f496505584cce05a2654) () override Returns the values based on the cross validation residuals. |
| | **deserializePythonPart** () |
| virtual [Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) | [evaluate](#a85c04b0ec7ee1ee66e21af920faabb73) ([Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) points, bool extrapolate=true) override Destroys an instance of this class. |
| [ModelDataWrapper](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_model_data_wrapper.md) | [getModelData](#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++. |
|  string | [getModelName](#a6058bdae970b9b1ac93df22b24740a87) () Obtain the class name for which a c++ model will be created for hybrid approximation. |
|  virtual [PropertyList](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_list.md) | [getProperties](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_user_base.md#a0e1dd7df82728594fc128ed1c797b0c0) () Returns the properties stored by this user. |
| bool | [hasRegisteredModel](#aba852c1478ec4cf87b7510ea87aaec0b) () Returns true iff the instance of this class has a Python model instance registered. |
|  bool | [isHybrid](#a9dd98cbb44003dcaa6fb600d18440439) () Indicates whether this model is hybrid and thus, the approximation happens on C++ side. |
| virtual uint | [numCoeffs](#adc952cd2ab38749eaedfcce28a0cadb2) () override Returns the number of model coefficients used for the regression. |
| virtual uint | [numVariables](#af956c8befdfe0c8e9557bfe9ff57e46e) () override Returns the number of active variables selected during the training process of the model. |
| [CustomModel](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_custom_model.md) | [operator=](#a29255ab840bc80a9f21abd179f216d9d) ([CustomModel](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_custom_model.md) other) Copies an instance of this class. |
| virtual quality\_measure::ResidualsBase | [residuals](#afe90ce58ae457fa0cecebf5f154edc30) () override Returns the residuals needed to compute the quality\_measure. |
| template\<class Archive > | [serialize](#ae3fa2bc56690639794d33188524b0dfe) ([Archive](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_archive.md) ar, number version) serializes this object, see boost::serialization |
| virtual | [transferProperties](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_user_base.md#ab9507274f126b856fb69cd621f0f9fb4) ([PropertyList](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_list.md) property\_list) Convenience function to transfer a complete [PropertyList](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_list.md) into the model. |
| virtual std::ostream | [write](#a1aafb5e0753eea90b54a7c1f9bb27741) (std::ostream os) override Interface to write function identification. |

## Public Attributes

| Type | Name |
| - | - |
| apply SWIGTYPE \* | **DISOWN** |
|  string | **id** |

## Friends

| Type | Name |
| - | - |
|  class | **boost::serialization::access** |

## Constructor & Destructor Documentation

### CustomModel()

```cpp theme={null}
CustomModel(PropertyList properties)
```

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

**Parameters**

| Name | Description |
| - | - |
| properties | List of properties used by this class |

## Member Function Documentation

### activeVariables()

```cpp theme={null}
virtual std::vector<bool> activeVariables()
```

`override` `virtual`

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()

```cpp theme={null}
virtual Matrix cvOutputs()
```

`override` `virtual`

Returns the values based on the cross validation residuals.

**Returns**

The cross-validation values, a vector of length numInputs

### evaluate()

```cpp theme={null}
virtual Matrix evaluate(
    Matrix points,
    bool extrapolate = true
)
```

`override` `virtual`

Destroys an instance of this class.

Evaluates the model on the given points and returns the values

**Parameters**

| Name | Description |
| - | - |
| points | The input points the model is evaluated on |
| extrapolate | Evaluate the points outside of the bounding box of its training data |

**Returns**

The values of the model on the given points

Implements [ModelBase](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_model_base.md#a5ec7821e9b8c1aaa6c43dc5ca1263f2f).

### hasRegisteredModel()

```cpp theme={null}
bool hasRegisteredModel()
```

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

**Returns**

true/false

### numCoeffs()

```cpp theme={null}
virtual uint numCoeffs()
```

`override` `virtual`

Returns the number of model coefficients used for the regression.

**Returns**

A numbereger

### numVariables()

```cpp theme={null}
virtual uint numVariables()
```

`override` `virtual`

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

**Returns**

A numbereger

### residuals()

```cpp theme={null}
virtual quality_measure::ResidualsBase residuals()
```

`override` `virtual`

Returns the residuals needed to compute the quality\_measure.

**Returns**

The residuals

### serialize()

```cpp theme={null}
serialize(
    Archive ar,
    number version
)
```

serializes this object, see boost::serialization

**Parameters**

| Name | Description |
| - | - |
| ar | the boost archive |
| version | the version number |

### transferProperties()

```cpp theme={null}
virtual transferProperties(PropertyList property_list)
```

`virtual` `inherited`

Convenience function to transfer a complete [PropertyList](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_property_list.md) into the model.

**Parameters**

| Name | Description |
| - | - |
| property\_list | The properties to transfer into this model |

### write()

```cpp theme={null}
virtual std::ostream write(std::ostream os)
```

`override` `virtual`

Interface to write function identification.

**Returns**

ostream containing the information

## Member Data Documentation

### DISOWN

```cpp theme={null}
apply SWIGTYPE * DISOWN
```

**Initial value:**

```lua theme={null}
{CustomModelInterface * model}

         registerModel(CustomModelInterface * model, bool reset_residuals = true)
```
