> ## 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.

# Residuals Class Reference

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

The estimator class creates an abstraction for classes the QualityMeasure may be evaluated for in the [MOP](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_m_o_p.md) framework. It abstracts the essential data necessary in an quality measurement which can be done based on Three information: Approximation: This is data estimated using any approximation type CrossValidation: This is data that is estimated explicitly using cross-validation sets generated by the [MOP](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_m_o_p.md) handler AdjustmentCoefficient: This is a value in the range 1,...,N where N is the number of samples provided to the Estimator.

## Public Member Functions

| Type | Name |
| - | - |
| virtual string | [\_\_getstate\_\_](#a9350cb76131731f942f48489020fa0b2) () Serialization helpers for Python. This function allows the serialization of the REsiduals from inside Python. It can be used to serialize the residuals to store with custom model implementation. |
| virtual | [\_\_setstate\_internal](#a63341b304935e7b46f1e215161f07671) (string state) De-serialization helper fro python. This function gets called from a python function defined in the SWIG-Layer that provides de-serialization capabilities for the state encoded as a string. It finalizes setting an instances state from the given string. |
|  virtual uint64\_t | [adjustmentCoefficient](#a8dd7f15655b57d7cc35407bc11334bb2) () override A function returning the AdjustmentCoefficient when called. |
|  virtual uint64\_t | [adjustmentCoefficientRef](#a72fbb0caf78eef1bce91de6e9b1249a7) () override A function returning the AdjustmentCoefficient when called. |
| virtual [Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) | [approximationValues](#a628146b05607ddc049415f176de09828) () override Destructor. |
|  virtual [Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) | [approximationValuesRef](#a4715cc9b7cdd549625596777ecf92856) () override A function returning the Approximation data when called. |
|  virtual [Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) | [crossValidationValues](#a19a8dd18ea4cba56a3546a9d7db7be47) () override A function return the CrossValidation data when called. |
|  virtual [Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) | [crossValidationValuesRef](#adb0fcf21491d18d53b6d9b6db7446ea2) () override A function return the CrossValidation data when called. |
| [Residuals](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_residuals.md) | [operator=](#a63221de26f2540b1609bbde9e0c165b9) ([Residuals](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_residuals.md) other) Copy-Assignment. |
|  virtual [Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) | [originalValues](#a12d59f25cbe442106a8d89c13fc96852) () A function return the original data when called. |
|  virtual [Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) | [originalValuesRef](#a75d50538e802e65a662fa2bf3923ba4d) () A function return the original data when called. |
| | [Residuals](#a03801914800cc202cd858c6702493859) () Constructor. |
| | [Residuals](#a6f2b1c38c3523414fe721c5a0f44d0b2) ([Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) approx\_values, [Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) cv\_values, [Matrix](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_matrix.md) original\_values, uint64\_t adj\_coeff) Constructor that initializes the [Residuals](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_residuals.md) with its data. |
| | [Residuals](#a54041735a9cd5871b43643a98e8612af) ([Residuals](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_residuals.md) other) Copy-Constructor. |
| template\<class Archive > | [serialize](#aaa3a4f99152c0c2dce6c8794c9b1ee49) ([Archive](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_archive.md) ar, number) serializes this object, see boost::serialization |

## Friends

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

## Detailed Description

The estimator class creates an abstraction for classes the QualityMeasure may be evaluated for in the [MOP](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_m_o_p.md) framework. It abstracts the essential data necessary in an quality measurement which can be done based on Three information: Approximation: This is data estimated using any approximation type CrossValidation: This is data that is estimated explicitly using cross-validation sets generated by the [MOP](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_m_o_p.md) handler AdjustmentCoefficient: This is a value in the range 1,...,N where N is the number of samples provided to the Estimator.

## Constructor & Destructor Documentation

### Residuals()

```cpp theme={null}
Residuals(
    Matrix approx_values,
    Matrix cv_values,
    Matrix original_values,
    uint64_t adj_coeff
)
```

Constructor that initializes the [Residuals](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_residuals.md) with its data.

**Parameters**

| Name | Description |
| - | - |
| approx\_values | The approximation values for the given input points Can be identical to the cv\_values |
| cv\_values | The cross-validation values on the input points. These are expected to be computed on base of the MOPs selection of a segmentation of the input values. This selection needs to be consistent for all models in a competition. |
| original\_values | The values used originally dduring the training. |
| adj\_coeff | The adjustment coefficient. |

## Member Function Documentation

### \_\_getstate\_\_()

```cpp theme={null}
virtual string __getstate__()
```

`virtual`

Serialization helpers for Python. This function allows the serialization of the REsiduals from inside Python. It can be used to serialize the residuals to store with custom model implementation.

**Returns**

The [Residuals](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_residuals.md) state as a string

### \_\_setstate\_internal()

```cpp theme={null}
virtual __setstate_internal(string state)
```

`virtual`

De-serialization helper fro python. This function gets called from a python function defined in the SWIG-Layer that provides de-serialization capabilities for the state encoded as a string. It finalizes setting an instances state from the given string.

**Parameters**

| Name | Description |
| - | - |
| state | The residuals state encoded as string |

### approximationValues()

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

`override` `virtual`

Destructor.

A function returning the Approximation data when called

Implements [ResidualsBase](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/struct_residuals_base.md#ae88060171492f9cde2caa03a1d7d8673).

### serialize()

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

serializes this object, see boost::serialization

**Parameters**

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