fraudtwin.ml.dataset#
Point-in-time dataset construction.
Status: Stable
Classes#
|
alias of |
|
Stable rows and the manifest that describes their construction. |
|
Build historical features and labels using only available source data. |
Functions#
|
Convenience API for deterministic in-memory M9 construction. |
|
Convenience API for deterministic in-memory M9 construction. |
|
Load one existing generated run without regenerating unrelated records. |
|
Write the fixed-schema M9 Parquet table and its JSON manifest. |
Constants and protocols#
Name |
Reference |
|---|---|
|
|
|
|
Detailed API#
Deterministic point-in-time training data construction.
The builder works on the existing in-memory M1-M8 records or on one generated run. It deliberately does not regenerate simulation state and does not add a feature-store or model-serving dependency.
- fraudtwin.ml.dataset.DatasetBuilder[source]
alias of
PointInTimeDatasetBuilder
- class fraudtwin.ml.dataset.PointInTimeDataset(rows, manifest)[source][source]
Bases:
objectStable rows and the manifest that describes their construction.
- Parameters:
rows (tuple[dict[str, Any], ...])
manifest (DatasetManifest)
- property frame: DataFrame
Return the dataset as a frame with the stable output schema.
- class fraudtwin.ml.dataset.PointInTimeDatasetBuilder(config, entities, behavior, source_manifest=None)[source][source]
Bases:
objectBuild historical features and labels using only available source data.
- Parameters:
config (SimulationRunConfig)
entities (EntityDataset)
behavior (BehaviorDataset)
source_manifest (RunManifest | None)
- build_rows(prediction_times=None)[source][source]
Build every eligible PIT row without applying M9 split boundaries.
M10 uses this shared row construction to assign several independent rolling folds while retaining the exact M9 availability logic.
- Return type:
tuple[dict[str,Any],...]- Parameters:
prediction_times (Mapping[str, datetime] | None)
- build(prediction_times=None)[source][source]
Build rows in stable payment-ID order.
By default each payment is scored when its initial source event becomes available. Callers may provide a deterministic payment-to-prediction mapping for snapshot or delayed-prediction use cases.
- Return type:
PointInTimeDataset- Parameters:
prediction_times (Mapping[str, datetime] | None)
- fraudtwin.ml.dataset.build_point_in_time_dataset(config, entities, behavior, source_manifest=None, prediction_times=None)[source][source]
Convenience API for deterministic in-memory M9 construction.
- Return type:
PointInTimeDataset- Parameters:
config (SimulationRunConfig)
entities (EntityDataset)
behavior (BehaviorDataset)
source_manifest (RunManifest | None)
prediction_times (Mapping[str, datetime] | None)
- fraudtwin.ml.dataset.build_dataset(config, entities, behavior, source_manifest=None, prediction_times=None)[source]
Convenience API for deterministic in-memory M9 construction.
- Return type:
PointInTimeDataset- Parameters:
config (SimulationRunConfig)
entities (EntityDataset)
behavior (BehaviorDataset)
source_manifest (RunManifest | None)
prediction_times (Mapping[str, datetime] | None)