API: preprocessing.imputation
skyulf.preprocessing.imputation
Imputation nodes package.
Split from a single 416-LOC module into per-imputer files
_common.py — shared helpers (column resolution, polars fill values, sklearn transform) simple.py — SimpleImputer group.py — GroupImputer (per-group statistic with global fallback) knn.py — KNNImputer iterative.py — IterativeImputer (MICE)
All public names are re-exported here so existing imports such as
from skyulf.preprocessing.imputation import SimpleImputerCalculator
continue to work unchanged.
GroupImputerApplier
Bases: BaseApplier
Fill gaps with the training value of each row's group, then with the global value.
Rows whose group was unseen in training, whose group key is null, or whose group had no observed value fall back to the column's global training value. The scoring batch's own values are never used to compute fills.
Source code in skyulf-core/skyulf/preprocessing/imputation/group.py
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 | |
apply(X, y, params)
Fill the learned columns on the active engine; y passes through.
Source code in skyulf-core/skyulf/preprocessing/imputation/group.py
165 166 167 168 169 170 171 172 173 174 | |
resolve_fitted_config(raw, state)
staticmethod
Bind inference configuration to this node's inspected fitted artifact.
Source code in skyulf-core/skyulf/preprocessing/imputation/group.py
160 161 162 163 | |
validate_fitted_state(raw)
staticmethod
Inspect this node's supported saved state without fitting or applying data.
Source code in skyulf-core/skyulf/preprocessing/imputation/group.py
155 156 157 158 | |
GroupImputerCalculator
Bases: BaseCalculator
Learn per-group and global fill values from training rows.
group_by names the column that defines the groups. strategy is
mean, median or most_frequent (mode is an alias). Leave
columns empty to fill every numeric column (mean/median) or every
column (most_frequent), excluding the group key and the target.
Source code in skyulf-core/skyulf/preprocessing/imputation/group.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
fit(X, _y, config)
Compute [group, value] pairs and a global fallback for every filled column.
Source code in skyulf-core/skyulf/preprocessing/imputation/group.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | |
infer_output_schema(input_schema, config)
Promote filled columns to float64 for mean/median; keep the schema otherwise.
Source code in skyulf-core/skyulf/preprocessing/imputation/group.py
303 304 305 306 307 308 309 | |
IterativeImputerApplier
Bases: BaseApplier
Fill missing values from the fitted MICE (chained-equations) imputer.
Source code in skyulf-core/skyulf/preprocessing/imputation/iterative.py
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 | |
apply(X, _y, params)
Impute X with the stored sklearn imputer; y passes through.
Source code in skyulf-core/skyulf/preprocessing/imputation/iterative.py
116 117 118 119 120 121 | |
inference_capability(state, *, engine)
staticmethod
Retain the all-missing request shortcut and abstain from stochastic replay.
Source code in skyulf-core/skyulf/preprocessing/imputation/iterative.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
validate_inference_state(raw)
staticmethod
Inspect learned initial values and estimator sequence without executing them.
Source code in skyulf-core/skyulf/preprocessing/imputation/iterative.py
87 88 89 90 91 92 93 94 95 96 | |
IterativeImputerCalculator
Bases: BaseCalculator
Fit a sklearn IterativeImputer with the configured estimator.
Source code in skyulf-core/skyulf/preprocessing/imputation/iterative.py
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 | |
fit(X, _y, config)
Fit chained-equations imputation, dropping all-missing columns sklearn cannot impute.
Source code in skyulf-core/skyulf/preprocessing/imputation/iterative.py
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 | |
infer_output_schema(input_schema, config)
Return a schema with selected columns promoted to float64.
Source code in skyulf-core/skyulf/preprocessing/imputation/iterative.py
152 153 154 155 156 | |
KNNImputerApplier
Bases: BaseApplier
Fill missing values from the fitted k-nearest-neighbors imputer.
Source code in skyulf-core/skyulf/preprocessing/imputation/knn.py
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 | |
apply(X, _y, params)
Impute X with the stored sklearn imputer; y passes through.
Source code in skyulf-core/skyulf/preprocessing/imputation/knn.py
66 67 68 69 70 71 | |
inference_capability(state, *, engine)
staticmethod
Describe native neighbor replay; arbitrary metrics or weights stay undeclared.
Source code in skyulf-core/skyulf/preprocessing/imputation/knn.py
54 55 56 57 58 59 60 61 62 63 64 | |
validate_inference_state(raw)
staticmethod
Inspect the saved neighbor estimator without refitting or normalizing it.
Source code in skyulf-core/skyulf/preprocessing/imputation/knn.py
45 46 47 48 49 50 51 52 | |
KNNImputerCalculator
Bases: BaseCalculator
Fit a sklearn KNNImputer on the selected numeric columns.
Source code in skyulf-core/skyulf/preprocessing/imputation/knn.py
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 | |
fit(X, _y, config)
Fit the neighbor imputer, dropping all-missing columns sklearn cannot impute.
Source code in skyulf-core/skyulf/preprocessing/imputation/knn.py
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 | |
infer_output_schema(input_schema, config)
Return a schema with selected columns promoted to float64.
Source code in skyulf-core/skyulf/preprocessing/imputation/knn.py
102 103 104 105 106 | |
SimpleImputerApplier
Bases: BaseApplier
Apply fitted Simple Imputer fill values to missing values in selected columns.
The calculator artifact records per-column values for mean, median,
most_frequent (also accepted as mode), or constant strategies.
Missing columns seen during fitting are restored with their stored value,
preserving the row count even when no input columns remain.
Empty saved artifacts declare identity replay only when the recipe explicitly
selects no columns; automatic or missing selections remain unreviewed.
Spark supports only mean and constant artifacts and applies them
with native expressions. All-missing means leave existing columns untouched.
Source code in skyulf-core/skyulf/preprocessing/imputation/simple.py
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 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 | |
apply(X, _y, params)
Fill nulls and NaNs with the fitted per-column values; y passes through.
Source code in skyulf-core/skyulf/preprocessing/imputation/simple.py
92 93 94 95 96 97 98 99 100 101 102 103 | |
resolve_fitted_config(raw, state)
staticmethod
Bind inference configuration to this node's inspected fitted artifact.
Source code in skyulf-core/skyulf/preprocessing/imputation/simple.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
validate_fitted_state(raw)
staticmethod
Inspect this node's supported saved state without fitting or applying data.
Source code in skyulf-core/skyulf/preprocessing/imputation/simple.py
65 66 67 68 69 70 71 72 | |
SimpleImputerCalculator
Bases: BaseCalculator
Fit per-column values for filling missing data with sklearn-compatible strategies.
Supported strategy values are mean, median, most_frequent,
and constant; mode is normalized to most_frequent. Use
columns to select columns and fill_value with constant.
Mean and median auto-select numeric columns and reject explicitly selected
non-numeric columns. The other strategies can operate on all selected columns.
Spark supports only mean and constant through a native aggregate;
string and boolean constants require explicit compatible fill values.
Source code in skyulf-core/skyulf/preprocessing/imputation/simple.py
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 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
fit(X, _y, config)
Resolve strategy and columns, then fit fill values on the active engine.
mode is accepted as an alias of most_frequent; mean/median are
restricted to numeric columns.
Source code in skyulf-core/skyulf/preprocessing/imputation/simple.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
infer_output_schema(input_schema, config)
Return input_schema and promote float-only imputation targets to float64.
Source code in skyulf-core/skyulf/preprocessing/imputation/simple.py
230 231 232 233 234 235 236 237 238 239 | |