yohou.testing¶
Testing utilities for Yohou estimators.
Functions¶
| Name | Description |
|---|---|
check_class_proba_classes_attribute |
Check classes_ and n_classes_ attributes are populated correctly after fit. |
check_class_proba_predict_returns_labels |
Check predict() returns argmax class labels, not probabilities. |
check_class_proba_prediction_bounds |
Check all probability values are in [0, 1]. |
check_class_proba_prediction_structure |
Check class-probability predictions have correct column structure. |
check_class_proba_prediction_sums |
Check probabilities sum to 1.0 per row per target (tolerance: 1e-6). |
check_class_proba_prediction_types |
Check class-proba forecaster has 'class_proba' in forecaster_type tag. |
check_metadata_routing_default_request |
Check that by default metadata routing request is empty. |
check_metadata_routing_get_metadata_routing |
Check that get_metadata_routing() is implemented correctly. |
check_composite_combination_validation |
Check an unknown combination raises. |
check_composite_rejects_bare_list |
Check a bare [estimator, ...] list (no names) is rejected. |
check_composite_weights_length_validation |
Check a weights list of the wrong length raises. |
check_clone_preserves_params |
Check clone() preserves shallow params and freshens nested estimators. |
check_composition_clone_deep_clones_components |
Check clone(compositor) produces fresh same-type components. |
check_composition_nested_param_addressable |
Check nested <name>__<param> get/set on a _BaseComposition. |
check_get_set_params_round_trip |
Check set_params(**get_params(deep=True)) is a no-op. |
check_init_no_param_mutation |
Check __init__ stores constructor arguments verbatim. |
check_clone_preserves_forecaster_params |
Check sklearn's clone() preserves init parameters. |
check_fit_predict_with_X_forecast |
Check fit + predict works with X_forecast provided. |
check_fit_predict_with_X_future |
Check fit + predict works with X_future provided. |
check_fit_predict_without_exogenous |
Check forecaster behavior when X_actual=None at fit time. |
check_fit_sets_forecaster_attributes |
Check fit() sets required forecaster attributes. |
check_forecaster_methods_call_check_is_fitted |
Check all forecaster methods (except fit) raise NotFittedError when unfitted. |
check_forecaster_not_fitted_error |
Check accessing fitted attributes before fit() raises NotFittedError. |
check_forecaster_tags_accessible_before_fit |
Check sklearn_tags() is accessible before fit(). |
check_forecaster_tags_match_capabilities |
Check forecaster tags accurately reflect capabilities. |
check_forecaster_tags_static_after_fit |
Check forecaster tags remain static after fit(). |
check_forecasting_horizon_validation |
Check forecasting_horizon < 1 raises ValueError. |
check_mixed_cadence_X_forecast_resolves |
Check that a channel on a slower schedule survives step-column derivation. |
check_observe_auto_rederives_step_columns |
Check observe() re-derives step columns from stored raws. |
check_observe_extends_observations |
Check observe() extends observation buffers correctly. |
check_observe_predict_interval_with_step_columns |
Check observe_predict_interval works with step columns (lightweight). |
check_observe_predict_with_step_columns |
Check observe_predict works with step columns (lightweight). |
check_predict_time_columns |
Check predictions have vintage_time and time columns. |
check_predict_X_forecast_override |
Check predict with X_forecast override produces different results. |
check_prediction_types_property |
Check forecaster_type tag is None or a frozenset of known prediction types. |
check_requires_exogenous_warns_on_X_future_X_forecast |
Check that a forecaster with requires_exogenous=False warns when X_future/X_forecast provided. |
check_rewind_propagates_to_transformers |
Check rewind() propagates to transformers in forecaster. |
check_rewind_replaces_observations |
Check rewind() replaces observation buffers correctly. |
check_coverage_rates_parameter |
Check fit_coverage_rates_ fitted attribute is a non-empty list of floats in [0, 1]. |
check_coverage_rates_validation |
Check invalid coverage_rates raise ValueError during fit and predict. |
check_interval_bounds |
Check upper >= lower for all coverage rates and time steps. |
check_interval_prediction_columns |
Check interval predictions have {col}lower} and {colupper format. |
check_interval_prediction_types |
Check interval forecaster has 'interval' in forecaster_type tag. |
assert_request_equal |
Assert metadata request matches expected dictionary. |
assert_request_is_empty |
Check if a metadata request dict is empty. |
check_recorded_metadata |
Check whether the expected metadata is passed to the object's method. |
record_metadata |
Store passed metadata to a method of obj. |
check_panel_data |
Check cross-learning with panel data predicts all groups by default. |
check_panel_invalid_group_raises |
Check that an invalid group name raises ValueError. |
check_panel_single_group |
Check cross-learning filters to specified panel group. |
check_point_prediction_structure |
Check point predictions have correct column structure. |
check_point_prediction_types |
Check point forecaster has 'point' in forecaster_type tag. |
check_estimator_parameter |
Check estimator parameter is sklearn BaseEstimator. |
check_reduction_strategy |
Check reduction_strategy is one of 'direct', 'dir-rec', 'multi-output'. |
check_scorer_aggregation_methods |
Check all aggregation_method combinations produce valid output. |
check_scorer_component_subselection |
Check components filtering works correctly. |
check_scorer_coverage_rate_subselection |
Check coverage parameter filters interval predictions correctly. |
check_scorer_lower_is_better |
Check the lower_is_better tag is a boolean. |
check_scorer_methods_call_check_is_fitted |
Check all scorer methods (except fit) raise NotFittedError when unfitted. |
check_scorer_multi_vintage |
Check that scorer produces a finite result on multi-vintage input. |
check_scorer_panel_subselection |
Check groups filtering works correctly. |
check_scorer_parameter_validation |
Check parameter validation raises ValueError for invalid inputs. |
check_scorer_prediction_type_compatibility |
Check scorer works with correct forecaster output type. |
check_scorer_tags_accessible_before_fit |
Check sklearn_tags() is callable on scorer instance. |
check_scorer_tags_match_capabilities |
Check tag values match actual scorer behavior. |
check_scorer_tags_static_after_fit |
Check tags remain unchanged after fit. |
check_grid_search_exhaustive |
Check GridSearchCV evaluates all parameter combinations. |
check_grid_search_param_grid_validation |
Check param_grid format is validated (dict or list of dicts). |
check_randomized_search_distributions |
Check scipy.stats distributions work for parameter sampling. |
check_randomized_search_n_iter |
Check n_iter controls number of parameter combinations evaluated. |
check_randomized_search_reproducibility |
Check random_state produces same parameter samples. |
check_search_clone_preserves_params |
Check sklearn clone() preserves search CV parameters. |
check_search_cv_results_structure |
Check cv_results_ has required structure. |
check_search_error_score_handling |
Check error_score parameter handles failing fits correctly. |
check_search_fit_sets_attributes |
Check fit() sets required search CV attributes. |
check_search_interval_predict_delegates |
Check predict_interval() works after interval search with refit. |
check_search_method_availability |
Check @available_if decorator logic with refit=True/False. |
check_search_multimetric_scoring |
Check multi-metric scoring with dict scorer works correctly. |
check_search_not_fitted_error |
Check fitted attributes before fit() raise NotFittedError. |
check_search_observe_delegates |
Check observe() delegates to best_forecaster_.observe() correctly. |
check_search_panel_data |
Check groups parameter propagates correctly. |
check_search_predict_delegates |
Check predict() delegates to best_forecaster_.predict() correctly. |
check_search_refit_false_no_forecaster |
Check refit=False doesn't create best_forecaster_. |
check_search_return_train_score |
Check return_train_score=True adds train score keys to cv_results_. |
check_search_rewind_delegates |
Check rewind() delegates to best_forecaster_.rewind() correctly. |
check_similarity_methods_call_check_is_fitted |
Check predict, observe, and rewind raise NotFittedError before fit. |
check_similarity_metric_params_verbatim |
Check metric_params=None is stored verbatim (no init-mutation). |
check_similarity_predict_matrix_shape |
Check predict returns an (n_pred, n_calib) weight matrix. |
check_similarity_to_weights_rows_reserve_mass |
Check each predicted weight row is non-negative and sums below 1. |
check_splitter_n_splits_consistency |
Check get_n_splits() matches actual split count. |
check_splitter_non_overlapping_tests |
Check test sets don't overlap if produces_non_overlapping_tests=True. |
check_splitter_panel_data_support |
Check splitter handles panel data if supports_panel_data=True. |
check_splitter_parameter_constraints |
Check parameter constraints are enforced via sklearn validation. |
check_splitter_produces_valid_indices |
Check all train/test indices are valid row positions. |
check_splitter_tags_accessible_before_fit |
Check sklearn_tags() is callable on splitter instance. |
check_splitter_tags_match_capabilities |
Check tag values match actual splitter behavior. |
check_splitter_tags_static_after_fit |
Check tags remain unchanged after fit. |
check_feature_names_out_match |
Check get_feature_names_out() matches transform() output columns. |
check_fit_idempotent |
Check that fit(X).fit(X) equals fit(X). |
check_fit_sets_attributes |
Check fit() sets required attributes. |
check_fit_transform_equivalence |
Check fit_transform(X) == fit(X).transform(X). |
check_insufficient_data_raises |
Check behavior when data length < observation_horizon. |
check_inverse_observe_transform_identity |
Check inverse_transform(observe_transform(X)) ≈ X. |
check_inverse_transform_identity |
Check inverse_transform(transform(X)) ≈ X. |
check_inverse_transform_round_trip |
Check inverse_transform(transform(X)) ≈ X with shape validation. |
check_memory_bounded |
Check memory doesn't grow unbounded with sequential updates. |
check_observation_horizon_after_fit |
Check observation_horizon is valid after fit(). |
check_observation_horizon_not_fitted |
Check observation_horizon behavior before fit(). |
check_observe_concatenates_memory |
Check observe() appends new data and maintains horizon size. |
check_observe_transform_equivalence |
Check observe() does not change transform() output for a fitted transformer. |
check_observe_transform_sequential_consistency |
Check observe_transform(A) then observe_transform(B) == observe_transform(A+B). |
check_panel_data_support |
Check transformer handles panel columns (panel data) correctly. |
check_panel_group_preservation |
Check that transformers preserve panel group names after transformation. |
check_rewind_transform_behavior |
Check rewind_transform() behavior and contract. |
check_rewind_updates_memory |
Check rewind(X) sets _X_observed to X.tail(observation_horizon). |
check_tags_accessible_before_fit |
Check sklearn_tags() is accessible before fit(). |
check_tags_match_capabilities |
Check tags accurately reflect transformer capabilities. |
check_tags_static_after_fit |
Check tags remain static (don't change) after fit(). |
check_transform_drops_warmup_rows |
Check stateful transformers drop exactly observation_horizon rows. |
check_transform_output_structure |
Check transform() output has "time" column and valid structure. |
check_transformer_methods_call_check_is_fitted |
Check all transformer methods (except fit) raise NotFittedError when unfitted. |
check_transformer_preserve_dtypes |
Check transformer preserves input dtypes. |
check_transformers_unfitted_stateless |
Check stateless transformers transform deterministically across fits. |
check_weighter_compute_weights_alignment |
Check compute_weights returns one weight per key element. |
check_weighter_default_constructible |
Check the weighter class is constructible with no arguments. |
check_weighter_fit_noop_returns_self |
Check fit is a no-op returning self that leaves params unchanged. |
check_weighter_resolved_array_validation |
Check resolved-array validation rejects NaN/negative/inf/all-zero. |
check_weighter_tags_accessible_before_fit |
Check __sklearn_tags__() is callable on an unfitted weighter. |
check_weighter_tags_static_after_fit |
Check tags are unchanged by the no-op fit. |