fraudtwin.difficulty#
Scenario difficulty plans and resolvers.
Status: Experimental
Classes#
Complete, hashable M12 difficulty configuration. |
|
Resolved transformations for one fraud or graph scenario. |
Functions#
|
Apply resolved controls to one scenario without changing its objective. |
|
Resolve a level and its optional per-dimension replacements. |
Constants and protocols#
Name |
Reference |
|---|---|
|
|
|
|
|
|
|
|
Detailed API#
Deterministic M12 fraud-difficulty resolution and scenario plans.
The difficulty engine intentionally contains no business or ledger logic. It turns a requested level and optional normalized overrides into explicit, auditable parameters consumed by the existing M6 and M11 generators.
- class fraudtwin.difficulty.ResolvedDifficulty(**data)[source][source]
Bases:
BaseModelComplete, hashable M12 difficulty configuration.
- Parameters:
enabled (bool)
resolver_version (str)
requested_difficulty (int | None)
requested_controls (dict[str, float | None])
resolved_controls (dict[str, float])
scenario_transformations (dict[str, dict[str, object]])
effective_configuration_hash (str)
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property level: int | None
Return the requested level for convenient API consumers.
- class fraudtwin.difficulty.ScenarioDifficultyPlan(**data)[source][source]
Bases:
BaseModelResolved transformations for one fraud or graph scenario.
- Parameters:
scenario (str)
amount_similarity (float)
behavior_similarity (float)
merchant_similarity (float)
device_similarity (float)
channel_similarity (float)
geography_similarity (float)
scenario_subtlety (float)
noise_hard_negatives (float)
prevalence (float)
temporal_irregularity (float)
graph_structural_subtlety (float)
amount_multiplier (float)
timing_multiplier (float)
hard_negative_multiplier (float)
parameter_transformations (dict[str, object])
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- fraudtwin.difficulty.apply_difficulty(resolved, scenario, context=None)[source][source]
Apply resolved controls to one scenario without changing its objective.
contextis accepted for extension compatibility and is intentionally excluded from the plan hash; all stochastic choices use generator-owned M12 stream names.- Return type:
- Parameters:
resolved (ResolvedDifficulty)
scenario (str)
context (dict[str, Any] | None)