API: preprocessing.feature_generation
skyulf.preprocessing.feature_generation
Feature-generation nodes package.
Importing this package registers the PolynomialFeatures, FeatureInteraction and FeatureGeneration nodes and re-exports their public classes plus shared constants for backward compatibility.
FeatureGenerationApplier
Bases: BaseApplier
Append the columns described by a feature-generation artifact.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/generation.py
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 | |
apply(X, _y, params)
Evaluate each configured operation and append its output column to X.
Operations run in order, so a later one can read a column an earlier one
created. Unsupported operation types raise ValueError before any
operation runs. A failure inside a supported operation is logged and
skipped, and an output name that already exists is suffixed until
unique unless allow_overwrite says otherwise.
Datetime extraction uses output_column exactly for one configured
source and feature. With multiple features it produces name_feature;
with multiple sources it produces name_source_feature. Without an
explicit name, outputs remain source_feature, optionally preceded
by output_prefix. Every datetime output follows the collision policy.
Saved pipelines affected by formerly ignored names or overwritten
columns require refitting after upgrading.
Group aggregates require training-fitted mappings. Legacy artifacts lacking those mappings must be refitted before inference.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/generation.py
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 | |
inference_capability(state, *, engine)
staticmethod
Describe saved feature replay without granting arbitrary partition execution.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/generation.py
140 141 142 143 144 145 146 147 148 149 150 | |
validate_inference_state(raw)
staticmethod
Inspect saved operations, pinned similarity and learned group lookup shapes.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/generation.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
FeatureGenerationCalculator
Bases: BaseCalculator
Record row-local operations and fit group aggregates from training rows.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/generation.py
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 | |
fit(X, _y, config)
Fit aggregate mappings against the intermediate training feature frame.
Operations execute in order while fitting so an aggregate can consume
an earlier generated column. Its saved mapping supplies held-out rows;
unknown keys stay missing, and no inference values are aggregated.
Configurations containing only row-local operations need no data fit.
Unsupported operation types raise ValueError; polynomial expansion
belongs in the separate PolynomialFeatures node.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/generation.py
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 | |
FeatureInteractionApplier
Bases: BaseApplier
Append the multiplicative interaction columns named by the artifact.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/interaction.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 | |
apply(X, _y, params)
Compute each artifact combination as a column product and append it.
A combination whose columns are absent from X is skipped rather than
raising, so the node survives an upstream column drop; include_bias
adds a constant 1.0 interaction_bias column per existing row,
including zero rows when no input columns remain. When no column is
generated the frame is returned unchanged. Generated product names must
be unique and must not collide with existing columns. An existing bias
column retains its established passthrough behavior.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/interaction.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
resolve_fitted_config(raw, state)
staticmethod
Bind inference configuration to this node's inspected fitted artifact.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/interaction.py
166 167 168 169 | |
validate_fitted_state(raw)
staticmethod
Inspect this node's supported saved state without fitting or applying data.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/interaction.py
161 162 163 164 | |
FeatureInteractionCalculator
Bases: BaseCalculator
Resolve which cross-products to generate, without computing them.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/interaction.py
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 | |
fit(X, _y, config)
Validate the requested columns and degree, then enumerate the combinations.
Columns are sorted into the artifact so the generated names depend only
on the set of inputs, never on the order they were configured in.
With interaction_only=True, fewer columns than degree yields
no products. With False, one column is sufficient for self-products.
An empty selection yields no products; bias generation is independent.
Raises:
| Type | Description |
|---|---|
ValueError
|
If a configured column is missing or non-numeric, or if
|
Source code in skyulf-core/skyulf/preprocessing/feature_generation/interaction.py
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 | |
PolynomialFeaturesApplier
Bases: BaseApplier
Append the polynomial expansion described by the artifact.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/polynomial.py
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 | |
apply(X, _y, params)
Recompute the expansion from X and append it as new columns.
PolynomialFeatures is refit here rather than persisted, so the
artifact only carries configuration. Artifact columns absent from X
are filtered out first, and the default include_input_features=False
drops the degree-1 terms so the originals are not duplicated. X is
returned unchanged when nothing survives. Emitted names must be unique
and must not collide with existing columns.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/polynomial.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
inference_capability(state, *, engine)
staticmethod
Describe local polynomial arithmetic without granting worker execution.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/polynomial.py
146 147 148 149 150 151 152 | |
validate_inference_state(raw)
staticmethod
Inspect saved expansion configuration without rebuilding or fitting its terms.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/polynomial.py
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 | |
PolynomialFeaturesCalculator
Bases: BaseCalculator
Resolve the polynomial configuration and the names it will emit.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/polynomial.py
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 | |
fit(X, _y, config)
Record the expansion settings and the feature names they produce.
columns falls back to auto-detected numeric columns when
auto_detect is set. PolynomialFeatures is fitted here purely to
derive feature_names — the expansion itself is recomputed at apply
time. Returns an empty artifact, a no-op passthrough, when no column
resolves. Ambiguous generated names raise ValueError before replay.
Source code in skyulf-core/skyulf/preprocessing/feature_generation/polynomial.py
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 | |