Transforms
Scaling and monotonic transforms for distribution shaping.
featurely.transforms
apply_standard_scale(df, feature_cols)
Return a copy with standard scaling applied to selected feature columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input frame; not modified. |
required |
feature_cols
|
list[str]
|
Columns to scale to zero mean and unit variance. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
A copy of |
Source code in src/featurely/transforms.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
apply_log1p(df, feature_cols)
Return a copy with log1p transform (with non-negative shift) then scaling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input frame; not modified. |
required |
feature_cols
|
list[str]
|
Columns to transform; columns with negative minimums are
shifted to zero before |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
A copy of |
Source code in src/featurely/transforms.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
apply_sqrt(df, feature_cols)
Return a copy with square-root transform (with non-negative shift) then scaling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input frame; not modified. |
required |
feature_cols
|
list[str]
|
Columns to transform; columns with negative minimums are shifted to zero before the square root. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
A copy of |
Source code in src/featurely/transforms.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
apply_yeo_johnson(df, feature_cols)
Return a copy with Yeo-Johnson transform applied to selected columns.
Yeo-Johnson fits a Box-Cox-style power parameter per column and handles negative values natively.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input frame; not modified. |
required |
feature_cols
|
list[str]
|
Columns to transform. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
A copy of |
Source code in src/featurely/transforms.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
apply_quantile_normal(df, feature_cols, random_state=315)
Return a copy with quantile-to-normal transform applied to selected columns.
Maps each column's empirical CDF onto a standard normal distribution, which erases outliers and skew but distorts within-column spacing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Input frame; not modified. |
required |
feature_cols
|
list[str]
|
Columns to transform. |
required |
random_state
|
int
|
Seed for the quantile transformer's subsampling. |
315
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
A copy of |
Source code in src/featurely/transforms.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |