check_scenario_probability
Check if a constrained scenario is achievable before running a full simulation. Probe the model to estimate the probability and get a recommended generation method.
Instructions
Pre-flight feasibility check for a constrained FLOW scenario. ALWAYS call this BEFORE simulate_flow_scenario when you have ≥2 constraints, or whenever you're unsure if a scenario is in the model's natural distribution.
Probes the trained model with up to n_baseline unconstrained paths and reports what fraction satisfy your constraints, plus a recommended generation method: • probability ≥5% → 'rejection' (fast, exact samples) • probability 1-5% → 'hybrid' (rejection + latent fallback) • probability <1% → 'latent' (paths satisfy by construction; mild dynamics distortion) • probability <0.1% → infeasibility floor — refuse or relax constraints
Cheap (~1-15s) compared to a full scenario (minutes + GPU credits). Reuses today's baseline if generate_flow_paths has already been called; if not, auto_generate_baseline=True (default) creates one in the same call.
Workflow when probability is low: report it back to the user, then iterate — try each constraint individually to identify the binding one, relax magnitudes, widen t_start/t_end windows, or drop the least-essential constraint. Only commit to simulate_flow_scenario once probability is in a usable band, OR the user has explicitly accepted latent-mode distortion.
feature_name in constraints must be the DISPLAY NAME from the trained model's feature_names (e.g. 'Apple Inc.', 'SPDR S&P 500 ETF Trust'), NOT ticker symbols.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n_baseline | No | Probe size when generating a baseline. Larger = better resolution (1/n_baseline = floor) but slower. Default 1000. | |
| constraints | Yes | Same shape as simulate_flow_scenario constraints. Each MUST have 'lower' and/or 'upper'. Required keys: feature_name, lower and/or upper. Optional: type, t_start, t_end. Example: [{'feature_name': 'Equity Volatility (VIX)', 'lower': 30, 't_start': 10, 't_end': 25}] | |
| model_group_id | Yes | UUID of the model group with a trained Flow model (from train_flow_model) | |
| n_paths_target | No | Number of paths the eventual scenario would generate (used for the method recommendation). Default 1000. | |
| auto_generate_baseline | No | If no same-day baseline exists, generate one (~30s extra). Default True. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |