# Feature Neutralizer

**Module:** `sovai.extensions.feature_neutralizer`

## Functions

### `gram_schmidt_orthogonalization()`

```python
def gram_schmidt_orthogonalization(df)
```

Applies Gram-Schmidt process to orthogonalize the features of the DataFrame. Returns a new DataFrame with orthogonalized features in the original scale.

**Parameters**

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `df`      | —    | —           |

***

### `pca_neutralization()`

```python
def pca_neutralization(df)
```

Neutralizes features using PCA by removing all but the last principal component.

**Parameters**

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `df`      | —    | —           |

***

### `qr_neutralization()`

```python
def qr_neutralization(df)
```

Neutralizes features using QR decomposition.

**Parameters**

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `df`      | —    | —           |

***

### `svd_neutralization()`

```python
def svd_neutralization(df)
```

Neutralizes features using SVD by setting all but the smallest singular value to zero.

**Parameters**

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `df`      | —    | —           |

***

### `iterative_regression_neutralization()`

```python
def iterative_regression_neutralization(df, max_iter = 100, tol = 1e-06)
```

Neutralizes features using iterative regression.

**Parameters**

| Parameter  | Type | Description      |
| ---------- | ---- | ---------------- |
| `df`       | —    | —                |
| `max_iter` | —    | Default: `100`   |
| `tol`      | —    | Default: `1e-06` |

***

### `orthogonalize_features_function()`

```python
def orthogonalize_features_function(df, method = 'gram_schmidt')
```

Orthogonalizes the features of the DataFrame using the specified method.

**Parameters**

| Parameter | Type  | Description                                                         |
| --------- | ----- | ------------------------------------------------------------------- |
| `method`  | `str` | Method to use for orthogonalization. Options: 'gram\_schmidt', 'qr' |

**Returns**

CustomDataFrame: DataFrame with orthogonalized features

***

### `neutralize_features_function()`

```python
def neutralize_features_function(df, method = 'pca')
```

Neutralizes the features of the DataFrame using the specified method.

**Parameters**

| Parameter | Type  | Description                                                                      |
| --------- | ----- | -------------------------------------------------------------------------------- |
| `method`  | `str` | Method to use for neutralization. Options: 'pca', 'svd', 'iterative\_regression' |

**Returns**

CustomDataFrame: DataFrame with neutralized features

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sov.ai/api-reference/extensions/feature-neutralizer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
