Imputers
Imputers
ApplyRollingImputer
              Bases: TransformerStep
Impute missing values using a function over a rolling window
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| window_size | int | Window size of the rolling window | required | 
| func | callable | The function to call in each window | required | 
Source code in ceruleo/transformation/features/imputers.py
fit(X)
Compute a default value in case there are not valid values in the rolling window
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life | required | 
Source code in ceruleo/transformation/features/imputers.py
partial_fit(X)
Compute incrementally the mean value to use as default value to impute
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life | required | 
Source code in ceruleo/transformation/features/imputers.py
transform(X)
Transform the input life
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life to be transformed | required | 
Returns:
| Type | Description | 
|---|---|
| DataFrame | A new life with the same index as the input with the missing values replaced by the output of the function supplied | 
Source code in ceruleo/transformation/features/imputers.py
BackwardFillImputer
              Bases: TransformerStep
Impute forward filling the values
Source code in ceruleo/transformation/features/imputers.py
transform(X)
Transform the input life
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life to be transformed | required | 
Returns:
| Type | Description | 
|---|---|
| DataFrame | A new life with the same index as the input with the missing values replaced by the value in the previous timestamp | 
Source code in ceruleo/transformation/features/imputers.py
FillImputer
              Bases: TransformerStep
Source code in ceruleo/transformation/features/imputers.py
transform(X)
Transform the input life
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life to be transformed | required | 
Returns:
| Type | Description | 
|---|---|
| DataFrame | A new life with the same index as the input with the missing values replaced by the value specified in the input | 
Source code in ceruleo/transformation/features/imputers.py
ForwardFillImputer
              Bases: TransformerStep
Impute forward filling the values
Source code in ceruleo/transformation/features/imputers.py
transform(X)
Transform the input life
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life to be transformed | required | 
Returns:
| Type | Description | 
|---|---|
| DataFrame | A new life with the same index as the input with the missing values replaced by the value in the succesive timestamp | 
Source code in ceruleo/transformation/features/imputers.py
MeanImputer
              Bases: TransformerStep
Impute missing values with the mean value of the training set
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| name | Optional[str] | The name of the step | None | 
Source code in ceruleo/transformation/features/imputers.py
fit(X, y=None)
Compute the mean value
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life | required | 
partial_fit(X, y=None)
Compute the mean value incrementally
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life | required | 
Source code in ceruleo/transformation/features/imputers.py
transform(X, y=None)
Return a new dataframe with the missing values replaced by the fitted mean
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life | required | 
Returns:
| Type | Description | 
|---|---|
| DataFrame | A new DataFrame with the same index as the input with the Na values replaced by the fitted mean | 
Source code in ceruleo/transformation/features/imputers.py
MedianImputer
              Bases: TransformerStep
Impute missing values with the median value of the training set
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| name | Optional[str] | The name of the step | None | 
Source code in ceruleo/transformation/features/imputers.py
fit(X, y=None)
Compute the median value
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life | required | 
partial_fit(X)
Compute the median value incrementally
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life | required | 
Source code in ceruleo/transformation/features/imputers.py
transform(X, y=None)
Return a new dataframe with the missing values replaced by the fitted median
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life | required | 
Returns:
| Type | Description | 
|---|---|
| DataFrame | A new DataFrame with the same index as the input with the Na values replaced by the fitted median | 
Source code in ceruleo/transformation/features/imputers.py
NaNtoInf
              Bases: TransformerStep
Replace NaN for inf
Source code in ceruleo/transformation/features/imputers.py
transform(X, y=None)
Transform the input life replacing Nan for inf
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | Input Dataframe to be transformed | required | 
Returns:
| Type | Description | 
|---|---|
| DataFrame | A dataframe with she same index as the input with the NaN values replaced with inf | 
Source code in ceruleo/transformation/features/imputers.py
PerColumnImputer
              Bases: TransformerStep
Impute the values of each column following a simple rule
The imputing is made following this rule
- -np.inf -> min
- np.inf -> max
- nan -> median
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| name | Optional[str] | Step name, by default None | None | 
Source code in ceruleo/transformation/features/imputers.py
| 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |  | 
description()
Transformation's Description
Returns:
| Type | Description | 
|---|---|
| tuple | A tuple with the transformation name and the Max, Min and Median values for each feature. | 
Source code in ceruleo/transformation/features/imputers.py
fit(X, y=None)
Fit the transformation
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life | required | 
Source code in ceruleo/transformation/features/imputers.py
partial_fit(X, y=None)
Fit the transformation incrementally
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life | required | 
Source code in ceruleo/transformation/features/imputers.py
transform(X, y=None)
Apply the transformation to the input life
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | DataFrame | The input life | required | 
Source code in ceruleo/transformation/features/imputers.py
RollingMeanImputer
              Bases: ApplyRollingImputer
Impute missing values with the mean value on a rolling window
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| window_size | int | Window size of the rolling window | required | 
Source code in ceruleo/transformation/features/imputers.py
RollingMedianImputer
              Bases: ApplyRollingImputer
Impute missing values with the median value on a rolling window
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| window_size | int | Window size of the rolling window | required |