Trasformers
Transformer
The transformer is a high-level class that hold at least two transformation pipelines
- One related to the transformation of the input of the model
- The other related to the target of the model.
It allows accessing the information of the transformed data and is the object that uses the dataset iterators to transform the data before feeding it to the model.
Transformer
Transform each life
The transformer class is the highest level class of the transformer API. It contains Transformation Pipelines for the input data and the target, and provides mechanism to inspect the structure of the transformed data.
Parameters:
pipelineX: Pipeline that will be applied to the run-to-cycle data
pipelineY: Pipeline that will be applied to the target.
pipelineMetadata: Pipeline that will be used to extract additional
data from the lives information, by default None
Source code in ceruleo/transformation/functional/transformers.py
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 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
n_features: int
property
Number of features after transformation
Returns:
n: Number of features
columns()
fit(dataset, show_progress=False)
Fit the transformer with a given dataset.
The transformer will fit the X transformer, the Y transformer and the metadata transformer
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset |
|
required |
Source code in ceruleo/transformation/functional/transformers.py
transform(life)
Transform a life and obtain the input data, the target and the metadata
Parameters:
Name | Type | Description | Default |
---|---|---|---|
life |
DataFrame
|
A life in a form of a DataFrame |
required |
Tuple[np.array, np.array, np.array]
* The first element consists of the input transformed
* The second element consits of the target transformed
* The third element consists of the metadata
Source code in ceruleo/transformation/functional/transformers.py
transformX(life)
Get the transformer input data
Parameters
life: A life i an form of a DataFrame
Returns
t: Input data transformed
Source code in ceruleo/transformation/functional/transformers.py
transformY(life)
Get the transformed target from a life
Parameters
life: A run-to-failrue cycle in a form of a DataFrame
Returns t: Target obtained from the life
Source code in ceruleo/transformation/functional/transformers.py
TransformerIdentity(rul_column='RUL')
Return the Transformer
Parameters:
rul_column : Name of the RUL Column
Returns:
TransformerIdentity: An identity f(x)=x transformer
Source code in ceruleo/transformation/functional/transformers.py
transformer_info(transformer)
Obtains the transformer information in a serializable format
Parameters:
transformer: The transformer step, or pipeline to obtain their underlying information
Returns:
Type | Description |
---|---|
dict |
ValueError
If the transformer passed as an argument doesn't have
the get_params method.
Source code in ceruleo/transformation/functional/transformers.py
Transformer Step
Transformer step is the base class of all transformers
The pipeline will use the steps to fit and transform the run-to-failure cycles
TransformerStep
Bases: TransformerStepMixin
, TransformerMixin
Base class of all transformation step
Source code in ceruleo/transformation/functional/transformerstep.py
find_feature(X, name)
Find the feature that best maches the columns in X
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
DataFrame
|
A run-to-failure cycle |
required |
name |
str
|
The name of the feature to find |
required |
Returns:
Type | Description |
---|---|
Optional[str]
|
The name of the columns if it was found, else None |
Source code in ceruleo/transformation/functional/transformerstep.py
fit(X, y=None)
Fit the complete set of run-to-failure cycles
Parameters:
X: Features of the all the run-to-failure cycles
Returns:
Name | Type | Description |
---|---|---|
TransformerStep |
TransformerStep
|
The same step |
Source code in ceruleo/transformation/functional/transformerstep.py
partial_fit(X, y=None)
Fit a single run-to-failure cycle
Parameters:
X: Features of the run-to-failure cycle
Returns:
Name | Type | Description |
---|---|---|
TransformerStep |
TransformerStep
|
The same step |