Skip to content

Update Ruff workflow to remove type checking#148

Open
hadarshavit wants to merge 1 commit into
mainfrom
hadarshavit-patch-9
Open

Update Ruff workflow to remove type checking#148
hadarshavit wants to merge 1 commit into
mainfrom
hadarshavit-patch-9

Conversation

@hadarshavit
Copy link
Copy Markdown
Owner

Removed type checking step from Ruff workflow.

Removed type checking step from Ruff workflow.
Copilot AI review requested due to automatic review settings May 2, 2026 18:10
@codecov
Copy link
Copy Markdown

codecov Bot commented May 2, 2026

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
585 3 582 8
View the top 3 failed test(s) by shortest run time
test/selectors/test_tuner.py::test_selector_tuner
Stack Traces | 0.149s run time
dummy_performance =     algo1  algo2
0     1.0    5.0
1     2.0    4.0
2     3.0    3.0
3     4.0    2.0
4     5.0    1.0
5     1.2    4.8...
13    3.8    2.2
14    4.8    1.2
15    1.5    4.5
16    2.5    3.5
17    3.5    2.5
18    4.5    1.5
19    5.5    0.5
dummy_features =      f1
0   1.0
1   2.0
2   3.0
3   4.0
4   5.0
5   1.2
6   2.2
7   3.2
8   4.2
9   5.2
10  0.8
11  1.8
12  2.8
13  3.8
14  4.8
15  1.5
16  2.5
17  3.5
18  4.5
19  5.5
validate_predictions = <function validate_predictions.<locals>._validate at 0x7fca5b8bd1c0>

    def test_selector_tuner(dummy_performance, dummy_features, validate_predictions):
        """Test selector tuner with basic dummy data."""
        # Create dummy feature running time
        features_running_time = pd.DataFrame(
            np.random.exponential(0.1, dummy_features.shape),
            columns=dummy_features.columns,
            index=dummy_features.index,
        )
    
        output_dir = "./smac_test_output"
        try:
>           tuned_pipeline = tune_selector(
                X=dummy_features,
                y=dummy_performance,
                features_running_time=features_running_time,
                selector_class=[PairwiseClassifier, PairwiseRegressor],
                runcount_limit=2,
                cv=2,
                seed=42,
                output_dir=output_dir,
                budget=450.0,
            )

test/selectors/test_tuner.py:84: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
asf/selectors/selector_tuner.py:226: in tune_selector
    best_config = smac.optimize()
                  ^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/facade/abstract_facade.py:331: in optimize
    incumbents = self._optimizer.optimize(data_to_scatter=data_to_scatter)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/main/smbo.py:315: in optimize
    trial_info = self.ask()
                 ^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/main/smbo.py:162: in ask
    trial_info = next(self._trial_generator)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/intensifier/intensifier.py:236: in __iter__
    config = next(self.config_generator)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/main/config_selector.py:192: in __iter__
    self._model.train(X, Y)
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/model/abstract_model.py:152: in train
    return self._train(X, Y)
           ^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../model/random_forest/random_forest.py:749: in _train
    self._rf.fit(X, y)
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../model/random_forest/random_forest.py:468: in fit
    super().fit(X=X, y=y, sample_weight=sample_weight)
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../site-packages/sklearn/base.py:1336: in wrapper
    return fit_method(estimator, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/ensemble/_forest.py:359: in fit
    X, y = validate_data(
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:2919: in validate_data
    X, y = check_X_y(X, y, **check_params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:1331: in check_X_y
    y = _check_y(y, multi_output=multi_output, y_numeric=y_numeric, estimator=estimator)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:1341: in _check_y
    y = check_array(
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:1074: in check_array
    _assert_all_finite(
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:133: in _assert_all_finite
    _assert_all_finite_element_wise(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

X = array([nan])

    def _assert_all_finite_element_wise(
        X, *, xp, allow_nan, msg_dtype=None, estimator_name=None, input_name=""
    ):
        # Cython implementation doesn't support FP16 or complex numbers
        use_cython = (
            xp is np and X.data.contiguous and X.dtype.type in {np.float32, np.float64}
        )
        if use_cython:
            out = cy_isfinite(X.reshape(-1), allow_nan=allow_nan)
            has_nan_error = False if allow_nan else out == FiniteStatus.has_nan
            has_inf = out == FiniteStatus.has_infinite
        else:
            has_inf = xp.any(xp.isinf(X))
            has_nan_error = False if allow_nan else xp.any(xp.isnan(X))
        if has_inf or has_nan_error:
            if has_nan_error:
                type_err = "NaN"
            else:
                msg_dtype = msg_dtype if msg_dtype is not None else X.dtype
                type_err = f"infinity or a value too large for {msg_dtype!r}"
            padded_input_name = input_name + " " if input_name else ""
            msg_err = f"Input {padded_input_name}contains {type_err}."
            if estimator_name and input_name == "X" and has_nan_error:
                # Improve the error message on how to handle missing values in
                # scikit-learn.
                msg_err += (
                    f"\n{estimator_name} does not accept missing values"
                    " encoded as NaN natively. For supervised learning, you might want"
                    " to consider sklearn.ensemble.HistGradientBoostingClassifier and"
                    " Regressor which accept missing values encoded as NaNs natively."
                    " Alternatively, it is possible to preprocess the data, for"
                    " instance by using an imputer transformer in a pipeline or drop"
                    " samples with missing values. See"
                    " https://scikit-learn..../stable/modules/impute.html"
                    " You can find a list of all estimators that handle NaN values"
                    " at the following page:"
                    " https://scikit-learn..../stable/modules/impute.html"
                    "#estimators-that-handle-nan-values"
                )
>           raise ValueError(msg_err)
E           ValueError: Input y contains NaN.

.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:182: ValueError
test/selectors/test_tuner.py::test_tune_selector_with_preprocessing
Stack Traces | 0.41s run time
dummy_data = (         f1        f2        f3
0  0.087047 -0.299007  0.091761
1 -1.987569 -0.219672  0.357113
2  1.477894 -0.518270...33  0.107876  0.169948
7  0.081013  0.075428  0.027688
8  0.009773  0.227512  0.230677
9  0.100267  0.041405  0.042957)

    def test_tune_selector_with_preprocessing(dummy_data):
        """Test tune_selector with preprocessors."""
        features, performance, features_running_time = dummy_data
        preprocessors = [StandardScaler, MinMaxScaler]
    
        output_dir = tempfile.mkdtemp()
    
        try:
>           selector = tune_selector(
                features,
                performance,
                features_running_time=features_running_time,
                selector_class=[
                    (PairwiseClassifier, {"model_class": [SVMClassifierWrapper]}),
                    (PairwiseRegressor, {"model_class": [SVMRegressorWrapper]}),
                ],
                budget=10.0,
                runcount_limit=2,
                preprocessing_class=preprocessors,
                cv=2,
                seed=42,
                output_dir=output_dir,
            )

test/selectors/test_tuner.py:43: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
asf/selectors/selector_tuner.py:226: in tune_selector
    best_config = smac.optimize()
                  ^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/facade/abstract_facade.py:331: in optimize
    incumbents = self._optimizer.optimize(data_to_scatter=data_to_scatter)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/main/smbo.py:315: in optimize
    trial_info = self.ask()
                 ^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/main/smbo.py:162: in ask
    trial_info = next(self._trial_generator)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/intensifier/intensifier.py:236: in __iter__
    config = next(self.config_generator)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/main/config_selector.py:192: in __iter__
    self._model.train(X, Y)
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/model/abstract_model.py:152: in train
    return self._train(X, Y)
           ^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../model/random_forest/random_forest.py:749: in _train
    self._rf.fit(X, y)
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../model/random_forest/random_forest.py:468: in fit
    super().fit(X=X, y=y, sample_weight=sample_weight)
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../site-packages/sklearn/base.py:1336: in wrapper
    return fit_method(estimator, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/ensemble/_forest.py:359: in fit
    X, y = validate_data(
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:2919: in validate_data
    X, y = check_X_y(X, y, **check_params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:1331: in check_X_y
    y = _check_y(y, multi_output=multi_output, y_numeric=y_numeric, estimator=estimator)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:1341: in _check_y
    y = check_array(
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:1074: in check_array
    _assert_all_finite(
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:133: in _assert_all_finite
    _assert_all_finite_element_wise(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

X = array([nan])

    def _assert_all_finite_element_wise(
        X, *, xp, allow_nan, msg_dtype=None, estimator_name=None, input_name=""
    ):
        # Cython implementation doesn't support FP16 or complex numbers
        use_cython = (
            xp is np and X.data.contiguous and X.dtype.type in {np.float32, np.float64}
        )
        if use_cython:
            out = cy_isfinite(X.reshape(-1), allow_nan=allow_nan)
            has_nan_error = False if allow_nan else out == FiniteStatus.has_nan
            has_inf = out == FiniteStatus.has_infinite
        else:
            has_inf = xp.any(xp.isinf(X))
            has_nan_error = False if allow_nan else xp.any(xp.isnan(X))
        if has_inf or has_nan_error:
            if has_nan_error:
                type_err = "NaN"
            else:
                msg_dtype = msg_dtype if msg_dtype is not None else X.dtype
                type_err = f"infinity or a value too large for {msg_dtype!r}"
            padded_input_name = input_name + " " if input_name else ""
            msg_err = f"Input {padded_input_name}contains {type_err}."
            if estimator_name and input_name == "X" and has_nan_error:
                # Improve the error message on how to handle missing values in
                # scikit-learn.
                msg_err += (
                    f"\n{estimator_name} does not accept missing values"
                    " encoded as NaN natively. For supervised learning, you might want"
                    " to consider sklearn.ensemble.HistGradientBoostingClassifier and"
                    " Regressor which accept missing values encoded as NaNs natively."
                    " Alternatively, it is possible to preprocess the data, for"
                    " instance by using an imputer transformer in a pipeline or drop"
                    " samples with missing values. See"
                    " https://scikit-learn..../stable/modules/impute.html"
                    " You can find a list of all estimators that handle NaN values"
                    " at the following page:"
                    " https://scikit-learn..../stable/modules/impute.html"
                    "#estimators-that-handle-nan-values"
                )
>           raise ValueError(msg_err)
E           ValueError: Input y contains NaN.

.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:182: ValueError
test/selectors/test_selectors.py::test_selector_tuner
Stack Traces | 0.786s run time
dummy_performance =     algo1  algo2  algo3
0     800    250      5
1     200    800    130
2     120    170    500
3     160    150    70...15    480    470    100
16    100    540    560
17    530    100    330
18     25    250    610
19    580    200     10
dummy_features =     feature1  feature2  feature3
0       10.0       5.0       1.0
1       20.0      10.0       2.0
2       15.0       ...      45.0       9.0
17      95.0      48.0       9.5
18     100.0      50.0      10.0
19     105.0      52.0      10.5

    def test_selector_tuner(dummy_performance, dummy_features):
        # Keep runcount_limit and cv low for fast testing
        # Create dummy feature running time (same shape as features)
        features_running_time = pd.DataFrame(
            np.random.exponential(0.1, dummy_features.shape),
            columns=dummy_features.columns,
            index=dummy_features.index,
        )
    
>       tuned_pipeline = tune_selector(
            X=dummy_features,
            y=dummy_performance,
            features_running_time=features_running_time,
            selector_class=[PairwiseClassifier, PairwiseRegressor],
            runcount_limit=2,
            cv=2,
            seed=42,
            output_dir="./smac_test_output",  # Use a test-specific output dir
            smac_scenario_kwargs={},
            budget=450.0,
        )

test/selectors/test_selectors.py:363: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
asf/selectors/selector_tuner.py:226: in tune_selector
    best_config = smac.optimize()
                  ^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/facade/abstract_facade.py:331: in optimize
    incumbents = self._optimizer.optimize(data_to_scatter=data_to_scatter)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/main/smbo.py:315: in optimize
    trial_info = self.ask()
                 ^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/main/smbo.py:162: in ask
    trial_info = next(self._trial_generator)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/intensifier/intensifier.py:236: in __iter__
    config = next(self.config_generator)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/main/config_selector.py:192: in __iter__
    self._model.train(X, Y)
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../smac/model/abstract_model.py:152: in train
    return self._train(X, Y)
           ^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../model/random_forest/random_forest.py:749: in _train
    self._rf.fit(X, y)
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../model/random_forest/random_forest.py:468: in fit
    super().fit(X=X, y=y, sample_weight=sample_weight)
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../site-packages/sklearn/base.py:1336: in wrapper
    return fit_method(estimator, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/ensemble/_forest.py:359: in fit
    X, y = validate_data(
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:2919: in validate_data
    X, y = check_X_y(X, y, **check_params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:1331: in check_X_y
    y = _check_y(y, multi_output=multi_output, y_numeric=y_numeric, estimator=estimator)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:1341: in _check_y
    y = check_array(
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:1074: in check_array
    _assert_all_finite(
.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:133: in _assert_all_finite
    _assert_all_finite_element_wise(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

X = array([nan])

    def _assert_all_finite_element_wise(
        X, *, xp, allow_nan, msg_dtype=None, estimator_name=None, input_name=""
    ):
        # Cython implementation doesn't support FP16 or complex numbers
        use_cython = (
            xp is np and X.data.contiguous and X.dtype.type in {np.float32, np.float64}
        )
        if use_cython:
            out = cy_isfinite(X.reshape(-1), allow_nan=allow_nan)
            has_nan_error = False if allow_nan else out == FiniteStatus.has_nan
            has_inf = out == FiniteStatus.has_infinite
        else:
            has_inf = xp.any(xp.isinf(X))
            has_nan_error = False if allow_nan else xp.any(xp.isnan(X))
        if has_inf or has_nan_error:
            if has_nan_error:
                type_err = "NaN"
            else:
                msg_dtype = msg_dtype if msg_dtype is not None else X.dtype
                type_err = f"infinity or a value too large for {msg_dtype!r}"
            padded_input_name = input_name + " " if input_name else ""
            msg_err = f"Input {padded_input_name}contains {type_err}."
            if estimator_name and input_name == "X" and has_nan_error:
                # Improve the error message on how to handle missing values in
                # scikit-learn.
                msg_err += (
                    f"\n{estimator_name} does not accept missing values"
                    " encoded as NaN natively. For supervised learning, you might want"
                    " to consider sklearn.ensemble.HistGradientBoostingClassifier and"
                    " Regressor which accept missing values encoded as NaNs natively."
                    " Alternatively, it is possible to preprocess the data, for"
                    " instance by using an imputer transformer in a pipeline or drop"
                    " samples with missing values. See"
                    " https://scikit-learn..../stable/modules/impute.html"
                    " You can find a list of all estimators that handle NaN values"
                    " at the following page:"
                    " https://scikit-learn..../stable/modules/impute.html"
                    "#estimators-that-handle-nan-values"
                )
>           raise ValueError(msg_err)
E           ValueError: Input y contains NaN.

.../hostedtoolcache/Python/3.11.15................................................/x64/lib/python3.11.../sklearn/utils/validation.py:182: ValueError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants