> For the complete documentation index, see [llms.txt](https://docs.sov.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sov.ai/api-reference/extensions/feature-neutralizer.md).

# 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

***
