← Về thư mục
tests/pymc/test_scripts.py
- synthetic_posterior · function · L59-L101 — def synthetic_posterior( *, diverging: int = 0, tree_depth: int = 3, with_energy: bool = True, shift_second_chain: float = 0.0, ) -> "xr.DataTree"
- fitted_models · function · L105-L142 — def fitted_models() -> tuple
- fit · function · L116-L138 — def fit(with_slope: bool, seed: int)
- SummaryNumericTests · class · L145-L168 — class SummaryNumericTests(unittest.TestCase)
- test_the_summary_columns_are_numeric_not_formatted_strings · method · L146-L157 — def test_the_summary_columns_are_numeric_not_formatted_strings(self) -> None: # The regression: ArviZ 1.x rounds
summary for display by default, so # summary['r_hat'] > 1.01 raised "'>' not supported between instances # of 'str' and 'float'".
- test_the_summary_describes_the_draws_it_was_given · method · L159-L168 — def test_the_summary_describes_the_draws_it_was_given(self) -> None: # Standard-normal draws: mean near 0, sd near 1, and -- because the draws # are independent -- an effective sample size close to the draw count.
- DiagnosticBranchTests · class · L171-L226 — class DiagnosticBranchTests(unittest.TestCase)
- test_a_healthy_posterior_raises_no_issues · method · L172-L178 — def test_a_healthy_posterior_raises_no_issues(self) -> None: # The direction a suite of broken inputs would never prove: a clean fit # must come back clean.
- test_disagreeing_chains_are_flagged_as_a_convergence_failure · method · L180-L188 — def test_disagreeing_chains_are_flagged_as_a_convergence_failure(self) -> None: # Offsetting one chain by three standard deviations is exactly the # situation R-hat is designed to detect.
- test_a_stricter_ess_threshold_flags_a_posterior_that_otherwise_passes · method · L190-L199 — def test_a_stricter_ess_threshold_flags_a_posterior_that_otherwise_passes(self) -> None
- test_every_divergent_transition_is_counted · method · L201-L205 — def test_every_divergent_transition_is_counted(self) -> None
- test_hitting_the_maximum_tree_depth_is_reported · method · L207-L212 — def test_hitting_the_maximum_tree_depth_is_reported(self) -> None: # PyMC's default max_treedepth is 10. This costs sampling efficiency # rather than validity, so it is listed as an issue without setting the # has_issues flag that divergences and bad R-hat do.
- test_a_posterior_without_energy_statistics_is_still_checked · method · L214-L219 — def test_a_posterior_without_energy_statistics_is_still_checked(self) -> None: # Non-NUTS samplers record no energy; the checker must not require it.
- test_var_names_restricts_the_summary · method · L221-L226 — def test_var_names_restricts_the_summary(self) -> None
- DiagnosticReportTests · class · L229-L289 — class DiagnosticReportTests(unittest.TestCase)
- setUp · method · L230-L231 — def setUp(self) -> None
- test_the_report_writes_every_documented_artefact · method · L233-L259 — def test_the_report_writes_every_documented_artefact(self) -> None
- test_the_report_leaves_no_open_figures · method · L261-L267 — def test_the_report_leaves_no_open_figures(self) -> None
- test_the_output_directory_is_created_if_it_is_missing · method · L269-L276 — def test_the_output_directory_is_created_if_it_is_missing(self) -> None
- test_the_prior_and_posterior_are_overlaid_in_one_figure · method · L278-L289 — def test_the_prior_and_posterior_are_overlaid_in_one_figure(self) -> None
- ModelComparisonTests · class · L292-L345 — class ModelComparisonTests(unittest.TestCase)
- setUpClass · method · L294-L297 — def setUpClass(cls) -> None
- test_the_model_that_matches_the_data_generating_process_wins · method · L299-L309 — def test_the_model_that_matches_the_data_generating_process_wins(self) -> None: # The data is y = 2x + noise, so dropping the slope must cost predictive # accuracy. This is known before the code runs.
- test_the_stacking_weights_form_a_distribution · method · L311-L314 — def test_the_stacking_weights_form_a_distribution(self) -> None
- test_the_comparison_columns_are_numeric · method · L316-L321 — def test_the_comparison_columns_are_numeric(self) -> None: # Same display-formatting trap as az.summary: the interpretation block # compares elpd_diff against dse.
- test_the_difference_is_large_relative_to_its_own_standard_error · method · L323-L325 — def test_the_difference_is_large_relative_to_its_own_standard_error(self) -> None
- test_loo_is_accepted_under_either_spelling_and_any_case · method · L327-L333 — def test_loo_is_accepted_under_either_spelling_and_any_case(self) -> None
- test_an_unsupported_criterion_is_refused_with_a_way_forward · method · L335-L339 — def test_an_unsupported_criterion_is_refused_with_a_way_forward(self) -> None
- test_the_verbose_report_names_the_winner · method · L341-L345 — def test_the_verbose_report_names_the_winner(self) -> None: # verbose=True is the default, so it must not raise on the way through # the interpretation and reliability blocks.
- LooReliabilityTests · class · L348-L383 — class LooReliabilityTests(unittest.TestCase)
- setUpClass · method · L350-L354 — def setUpClass(cls) -> None
- test_one_pareto_k_is_reported_per_observation · method · L356-L357 — def test_one_pareto_k_is_reported_per_observation(self) -> None
- test_the_counts_agree_with_the_threshold_they_were_given · method · L359-L363 — def test_the_counts_agree_with_the_threshold_they_were_given(self) -> None
- test_a_well_specified_model_has_no_problem_observations · method · L365-L368 — def test_a_well_specified_model_has_no_problem_observations(self) -> None: # Correct model, 40 well-behaved points: PSIS must be reliable.
- test_lowering_the_threshold_flags_more_observations · method · L370-L383 — def test_lowering_the_threshold_flags_more_observations(self) -> None
- ModelAveragingTests · class · L386-L419 — class ModelAveragingTests(unittest.TestCase)
- setUpClass · method · L388-L390 — def setUpClass(cls) -> None
- test_explicit_weights_are_normalised_and_applied_exactly · method · L392-L400 — def test_explicit_weights_are_normalised_and_applied_exactly(self) -> None
- test_derived_weights_come_from_the_comparison_and_sum_to_one · method · L402-L412 — def test_derived_weights_come_from_the_comparison_and_sum_to_one(self) -> None
- test_a_variable_no_model_predicts_is_skipped_rather_than_raising · method · L414-L419 — def test_a_variable_no_model_predicts_is_skipped_rather_than_raising(self) -> None
- ComparisonPlotTests · class · L422-L439 — class ComparisonPlotTests(unittest.TestCase)
- setUp · method · L423-L424 — def setUp(self) -> None
- test_the_comparison_plot_is_saved_and_is_not_blank · method · L426-L439 — def test_the_comparison_plot_is_saved_and_is_not_blank(self) -> None
- CrossValidationGuidanceTests · class · L442-L446 — class CrossValidationGuidanceTests(unittest.TestCase)
- test_the_guidance_names_the_fold_count_it_was_asked_about · method · L443-L446 — def test_the_guidance_names_the_fold_count_it_was_asked_about(self) -> None: # Documentation-only helper: it must not touch the posteriors it is # handed, so passing an empty dict has to be safe.