Transform & Features¶
Transforms turn raw market data into model-ready features. Feature is the
base contract, FeaturePipe chains transforms into a pipeline, and the
selection helpers score and prune features by informativeness.
Transform contract¶
signalflow.Transform ¶
Bases: ABC
Base contract for every computation in the framework.
compute
abstractmethod
¶
fit ¶
from_config
classmethod
¶
Inverse of :meth:to_config, rebuilding nested transforms recursively.
to_config ¶
Round-trippable {transform, role, params} (registry reconstructs it).
Source code in src/signalflow/transform/base.py
signalflow.FeaturePipe ¶
Bases: Transform
Run child transforms in order; outputs are the union of their outputs.
Source code in src/signalflow/transform/pipe.py
fit ¶
Fit stateful children in order, each on the frame produced so far.
Source code in src/signalflow/transform/pipe.py
load
classmethod
¶
Rebuild a pipe from a YAML file written by :meth:save; reject non-pipe roots.
Source code in src/signalflow/transform/pipe.py
save ¶
Serialize the pipe (config only) to a portable YAML file.
Curated features¶
Encoding and selection¶
signalflow.WoE
dataclass
¶
WoE(binning: Binning = (lambda: Binning('monotonic', 10))(), refit: str | None = '1d', window: str | None = '365d', smoothing: float = 0.5, positive_threshold: float = 0.0, positive_classes: tuple[float, ...] | None = None, columns: list[str] | None = None)
Bases: Transform
Encode every feature column via Weight of Evidence against the target.
refit is the rolling retrain cadence and window the trailing training span
(duration strings such as "1d"/"365d"); either set to None (or "" for
back-compat) disables rolling refit and fits once over all data.
positive_threshold/positive_classes control how the target is binarized.
from_config
classmethod
¶
Rebuild the recipe (hyperparameters); the fitted table is restored via load_state.
Source code in src/signalflow/transform/encode/woe.py
load_state ¶
Restore fitted edges/WoE/IV produced by :meth:state_dict.
Source code in src/signalflow/transform/encode/woe.py
state_dict ¶
Portable fitted state: bin edges + WoE table + IV per column (JSON-able).
Source code in src/signalflow/transform/encode/woe.py
signalflow.Binning
dataclass
¶
Bin-edge policy used by WoE/IV. monotonic enforces a monotone event rate.
signalflow.IVSelector
dataclass
¶
IVSelector(min_iv: float = 0.1, max_bins: int = 10, smoothing: float = 0.5, positive_threshold: float = 0.0, positive_classes: tuple[float, ...] | None = None)
Bases: Transform
Keep feature columns with IV ≥ min_iv.
positive_threshold/positive_classes control how the target is binarized.