# LogitScaler

**Compatibility:** `numerical` data

The `LogitScaler` performs a statistical transformation on numerical data. It computes the [Logit function](https://en.wikipedia.org/wiki/Logit) to convert the scale and shape of the data. You can optionally choose the min and max values of the Logit function, effectively enforcing the min/max boundaries on your data.

<figure><img src="/files/Y3lbDMLVGirrcsIUkVPk" alt=""><figcaption></figcaption></figure>

```python
from rdt.transformers.numerical import LogitScaler

transformer = LogitScaler(min_value=0, max_value=100)
```

## Parameters

**`missing_value_replacement`**: Add this argument to replace missing values during the transform phase

<table data-header-hidden><thead><tr><th width="212"></th><th></th></tr></thead><tbody><tr><td>(default) <code>'mean'</code></td><td>Replace all missing values with the average value.</td></tr><tr><td><code>'random'</code></td><td>Replace missing values with a random value. The value is chosen uniformly at random from the min/max range.</td></tr><tr><td><code>'mode'</code></td><td>Replace all missing values with the most frequently occurring value</td></tr><tr><td><code>&#x3C;number></code></td><td>Replace all missing values with the specified number (<code>0</code>, <code>-1</code>, <code>0.5</code>, etc.)</td></tr><tr><td><code>None</code></td><td>Do not replace missing values. The transformed data will continue to have missing values.</td></tr></tbody></table>

**`missing_value_generation`**: Add this argument to determine how to recreate missing values during the reverse transform phase

<table data-header-hidden><thead><tr><th width="203"></th><th></th></tr></thead><tbody><tr><td>(default) <code>'random'</code></td><td>Randomly assign missing values in roughly the same proportion as the original data.</td></tr><tr><td><code>'from_column'</code></td><td>Create a new column to store whether the value should be missing. Use it to recreate missing values. <em>Note: Adding extra columns uses more memory and increases the RDT processing time.</em></td></tr><tr><td><code>None</code></td><td>Do not recreate missing values.</td></tr></tbody></table>

**`min_value`**: The min value for the Logit function.  The Logit function of anything ≤ this value is undefined.

<table data-header-hidden><thead><tr><th width="262.5"></th><th></th></tr></thead><tbody><tr><td>(default) <code>0</code></td><td>The min value of the function is 0.</td></tr><tr><td><code>&#x3C;float></code></td><td>A floating point value that acts as as the min value of the Logit function.</td></tr></tbody></table>

**`max_value`**: The max value for the Logit function.  The Logit function of anything ≥ this value is undefined.

<table data-header-hidden><thead><tr><th width="270.5"></th><th></th></tr></thead><tbody><tr><td>(default) <code>1</code></td><td>The max value of the function is 1.</td></tr><tr><td><code>&#x3C;float></code></td><td>A floating point value that acts as as the max value of the Logit function.</td></tr></tbody></table>

**`learn_rounding_scheme`**: Add this argument to allow the transformer to learn about rounded values in your dataset.

<table data-header-hidden><thead><tr><th width="249.5"></th><th></th></tr></thead><tbody><tr><td>(default) <code>False</code></td><td>Do not learn or enforce any rounding scheme. When reverse transforming the data, there may be many decimal places present.</td></tr><tr><td><code>True</code></td><td>Learn the rounding rules from the input data. When reverse transforming the data, round the number of digits to match the original.</td></tr></tbody></table>

## FAQ

<details>

<summary>How do I enforce min/max values with this transformer?</summary>

This transformer enforces strict minimum and maximum boundaries on your data using the `min_value` and `max_value` parameters.

If you'd like the minimum or maximum value to be allowed, we suggest setting the boundary to something slightly outside the range that you need.

```python
from rdt.transformers.numerical import LogitScaler
transformer = LogitScaler(
    min_value=0.0 - 1e-10, # allow a value of exactly 0 
    max_value=10.0 + 1e-10 # allow a value of exactly 10
)
```

If you'd like to enforce singular boundary (min or max) instead, please use the [LogScaler](/rdt/transformers-glossary/numerical/logscaler.md).

</details>


---

# 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.sdv.dev/rdt/transformers-glossary/numerical/logitscaler.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.
