Diagnostics API¶
ModelDiagnostics¶
ModelDiagnostics ¶
Diagnostic suite to verify the well-posedness and numerical stability of the CancerRLTOModel.
plot_component_decomposition ¶
- Proves well-posedness by showing the internal trade-off components.
plot_noise_stability ¶
plot_noise_stability(
gene_name: str,
n_evals: int = 10,
grid_points: int = 40,
n_samples: int = 5000,
)
- Checks if Monte Carlo noise overwhelms the peak curvature.
plot_convergence_check ¶
- Verifies the optimizer finds the same peak regardless of starting guess.
plot_bivariate_landscape ¶
plot_bivariate_landscape(
gene1_name: str,
gene2_name: str,
grid_size: int = 40,
n_samples: int = 0,
)
- Checks for infinite ridges or compensation in the 2D global landscape.
plot_sensitivity_profile ¶
- Ensures smooth responses to parameter perturbations (no brittle cliffs).
example_usage¶
Diagnostics guide¶
The plotting methods are intended to answer different questions:
| Method | Intended diagnostic question |
|---|---|
plot_component_decomposition() | do robustness, burden, toxicity, and net fitness produce a well-shaped objective? |
plot_noise_stability() | how sensitive is the local objective region around the optimum? |
plot_convergence_check() | does optimization converge from varied starting points? |
plot_bivariate_landscape() | does the joint landscape show compensation ridges or a clear optimum? |
plot_sensitivity_profile() | does the optimum move smoothly under parameter perturbation? |
Saving plots¶
from rlto_model import ModelDiagnostics
diag = ModelDiagnostics(model)
fig = diag.plot_bivariate_landscape("MYC", "KRAS")
fig.savefig("bivariate_MYC_KRAS.png")
Operational note¶
The example script closes figures after saving them. That pattern is worth preserving in batch runs to avoid figure accumulation.