45 m 2 s

: 47 total, 9 failed, 38 passed

  • Collapse |
  • Expand
  • 45 m 2 s
    boruta
    • 45 m 2 s
      test
      • 45 m 2 s
        test_sklearn_compatibility
        • 45 m 2 s
          test_sklearn_compatible_imputer
          • 2 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_estimator_cloneable0)
            • PASSED [ 2%]
          • 1 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_estimator_cloneable1)
            • PASSED [ 4%]
          • 0 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_estimator_tags_renamed)
            • PASSED [ 6%]
          • 0 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_valid_tag_types)
            • PASSED [ 8%]
          • 3 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_estimator_repr)
            • PASSED [ 10%]
          • 20 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_no_attributes_set_in_init)
            • PASSED [ 12%]
          • 8 m 30 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_fit_score_takes_y)
            • PASSED [ 14%]
          • 24.51 s
            failed(BorutaPy(estimator=RandomForestClassifier())-check_estimators_overwrite_params)
            • FAILED [ 17%]
            • boruta/test/test_sklearn_compatibility.py:10 (test_sklearn_compatible_imputer[BorutaPy(estimator=RandomForestClassifier())-check_estimators_overwrite_params])estimator = BorutaPy(estimator=RandomForestClassifier())
              check = functools.partial(, 'BorutaPy')
              @parametrize_with_checks([BorutaPy(RandomForestClassifier())])
              def test_sklearn_compatible_imputer(estimator, check):
              > check(estimator)
              test_sklearn_compatibility.py:13:
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_testing.py:147: in wrapper
              return fn(*args, **kwargs)
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              name = 'BorutaPy', estimator_orig = BorutaPy(estimator=RandomForestClassifier())
              @ignore_warnings(category=FutureWarning)
              def check_estimators_overwrite_params(name, estimator_orig):
              X, y = make_blobs(random_state=0, n_samples=21)
              X = _enforce_estimator_tags_X(estimator_orig, X, kernel=rbf_kernel)
              estimator = clone(estimator_orig)
              y = _enforce_estimator_tags_y(estimator, y)

              set_random_state(estimator)

              # Make a physical copy of the original estimator parameters before fitting.
              params = estimator.get_params()
              original_params = deepcopy(params)

              # Fit the model
              estimator.fit(X, y)

              # Compare the state of the model parameters with the original parameters
              new_params = estimator.get_params()
              for param_name, original_value in original_params.items():
              new_value = new_params[param_name]

              # We should never change or mutate the internal state of input
              # parameters by default. To check this we use the joblib.hash function
              # that introspects recursively any subobjects to compute a checksum.
              # The only exception to this rule of immutable constructor parameters
              # is possible RandomState instance but in this check we explicitly
              # fixed the random_state params recursively to be integer seeds.
              > assert joblib.hash(new_value) == joblib.hash(original_value), (
              "Estimator %s should not change or mutate "
              " the parameter %s from %s to %s during fit."
              % (name, param_name, original_value, new_value)
              )
              E AssertionError: Estimator BorutaPy should not change or mutate the parameter estimator__n_estimators from 100 to 1000 during fit.
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:3629: AssertionError
          • 46.56 s
            failed(BorutaPy(estimator=RandomForestClassifier())-check_dont_overwrite_parameters)
            • FAILED [ 19%]
            • boruta/test/test_sklearn_compatibility.py:10 (test_sklearn_compatible_imputer[BorutaPy(estimator=RandomForestClassifier())-check_dont_overwrite_parameters])estimator = BorutaPy(estimator=RandomForestClassifier())
              check = functools.partial(, 'BorutaPy')
              @parametrize_with_checks([BorutaPy(RandomForestClassifier())])
              def test_sklearn_compatible_imputer(estimator, check):
              > check(estimator)
              test_sklearn_compatibility.py:13:
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_testing.py:147: in wrapper
              return fn(*args, **kwargs)
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              name = 'BorutaPy', estimator_orig = BorutaPy(estimator=RandomForestClassifier())
              @ignore_warnings(category=FutureWarning)
              def check_dont_overwrite_parameters(name, estimator_orig):
              # check that fit method only changes or sets private attributes
              if hasattr(estimator_orig.__init__, "deprecated_original"):
              # to not check deprecated classes
              return
              estimator = clone(estimator_orig)
              rnd = np.random.RandomState(0)
              X = 3 * rnd.uniform(size=(20, 3))
              X = _enforce_estimator_tags_X(estimator_orig, X)
              y = X[:, 0].astype(int)
              y = _enforce_estimator_tags_y(estimator, y)

              if hasattr(estimator, "n_components"):
              estimator.n_components = 1
              if hasattr(estimator, "n_clusters"):
              estimator.n_clusters = 1

              set_random_state(estimator, 1)
              dict_before_fit = estimator.__dict__.copy()
              estimator.fit(X, y)

              dict_after_fit = estimator.__dict__

              public_keys_after_fit = [
              key for key in dict_after_fit.keys() if _is_public_parameter(key)
              ]

              attrs_added_by_fit = [
              key for key in public_keys_after_fit if key not in dict_before_fit.keys()
              ]

              # check that fit doesn't add any public attribute
              assert not attrs_added_by_fit, (
              "Estimator adds public attribute(s) during"
              " the fit method."
              " Estimators are only allowed to add private attributes"
              " either started with _ or ended"
              " with _ but %s added" % ", ".join(attrs_added_by_fit)
              )

              # check that fit doesn't change any public attribute
              attrs_changed_by_fit = [
              key
              for key in public_keys_after_fit
              if (dict_before_fit[key] is not dict_after_fit[key])
              ]

              > assert not attrs_changed_by_fit, (
              "Estimator changes public attribute(s) during"
              " the fit method. Estimators are only allowed"
              " to change attributes started"
              " or ended with _, but"
              " %s changed" % ", ".join(attrs_changed_by_fit)
              )
              E AssertionError: Estimator changes public attribute(s) during the fit method. Estimators are only allowed to change attributes started or ended with _, but random_state changed
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:1762: AssertionError
          • 22.71 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_estimators_fit_returns_self)
            • PASSED [ 21%]
          • 26.01 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_readonly_memmap_input)
            • PASSED [ 23%]
          • 8 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_estimators_unfitted)
            • PASSED [ 25%]
          • 1 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_do_not_raise_errors_in_init_or_set_params)
            • PASSED [ 27%]
          • 32.95 s
            failed(BorutaPy(estimator=RandomForestClassifier())-check_n_features_in_after_fitting)
            • FAILED [ 29%]
            • boruta/test/test_sklearn_compatibility.py:10 (test_sklearn_compatible_imputer[BorutaPy(estimator=RandomForestClassifier())-check_n_features_in_after_fitting])name = 'BorutaPy', estimator_orig = BorutaPy(estimator=RandomForestClassifier())
              @ignore_warnings(category=FutureWarning)
              def check_n_features_in_after_fitting(name, estimator_orig):
              # Make sure that n_features_in are checked after fitting
              tags = get_tags(estimator_orig)

              is_supported_X_types = tags.input_tags.two_d_array or tags.input_tags.categorical

              if not is_supported_X_types or tags.no_validation:
              return

              rng = np.random.RandomState(0)

              estimator = clone(estimator_orig)
              set_random_state(estimator)
              if "warm_start" in estimator.get_params():
              estimator.set_params(warm_start=False)

              n_samples = 10
              X = rng.normal(size=(n_samples, 4))
              X = _enforce_estimator_tags_X(estimator, X)

              if is_regressor(estimator):
              y = rng.normal(size=n_samples)
              else:
              y = rng.randint(low=0, high=2, size=n_samples)
              y = _enforce_estimator_tags_y(estimator, y)

              err_msg = (
              "`{name}.fit()` does not set the `n_features_in_` attribute. "
              "You might want to use `sklearn.utils.validation.validate_data` instead "
              "of `check_array` in `{name}.fit()` which takes care of setting the "
              "attribute.".format(name=name)
              )

              estimator.fit(X, y)
              assert hasattr(estimator, "n_features_in_"), err_msg
              assert estimator.n_features_in_ == X.shape[1], err_msg

              # check methods will check n_features_in_
              check_methods = [
              "predict",
              "transform",
              "decision_function",
              "predict_proba",
              "score",
              ]
              X_bad = X[:, [1]]

              err_msg = """\
              `{name}.{method}()` does not check for consistency between input number
              of features with {name}.fit(), via the `n_features_in_` attribute.
              You might want to use `sklearn.utils.validation.validate_data` instead
              of `check_array` in `{name}.fit()` and {name}.{method}()`. This can be done
              like the following:
              from sklearn.utils.validation import validate_data
              ...
              class MyEstimator(BaseEstimator):
              ...
              def fit(self, X, y):
              X, y = validate_data(self, X, y, ...)
              ...
              return self
              ...
              def {method}(self, X):
              X = validate_data(self, X, ..., reset=False)
              ...
              return X
              """
              err_msg = textwrap.dedent(err_msg)

              msg = f"X has 1 features, but \\w+ is expecting {X.shape[1]} features as input"
              for method in check_methods:
              if not hasattr(estimator, method):
              continue

              callable_method = getattr(estimator, method)
              if method == "score":
              callable_method = partial(callable_method, y=y)

              with raises(
              ValueError, match=msg, err_msg=err_msg.format(name=name, method=method)
              ):
              > callable_method(X_bad)
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:4501:
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_set_output.py:319: in wrapped
              data_to_wrap = f(self, X, *args, **kwargs)
              ../boruta_py.py:249: in transform
              return self._transform(X, weak, return_df)
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              self = BorutaPy(estimator=RandomForestClassifier(n_estimators=1000,
              random_state=RandomState(MT19937) at 0x101E68B40),
              random_state=RandomState(MT19937) at 0x101E68B40)
              X = array([[ 0.40015721],
              [-0.97727788],
              [ 0.4105985 ],
              [ 0.12167502],
              [-0.20515826],
              [ 0.6536186 ],
              [-1.45436567],
              [ 1.46935877],
              [-1.98079647],
              [ 1.20237985]])
              weak = False, return_df = False
              def _transform(self, X, weak=False, return_df=False):
              # sanity check
              try:
              self.ranking_
              except AttributeError:
              raise ValueError('You need to call the fit(X, y) method first.')

              if weak:
              indices = self.support_ + self.support_weak_
              else:
              indices = self.support_

              if return_df:
              X = X.iloc[:, indices]
              else:
              > X = X[:, indices]
              E IndexError: boolean index did not match indexed array along axis 1; size of axis is 1 but size of corresponding boolean axis is 4
              ../boruta_py.py:464: IndexError
              The above exception was the direct cause of the following exception:
              estimator = BorutaPy(estimator=RandomForestClassifier())
              check = functools.partial(, 'BorutaPy')
              @parametrize_with_checks([BorutaPy(RandomForestClassifier())])
              def test_sklearn_compatible_imputer(estimator, check):
              > check(estimator)
              test_sklearn_compatibility.py:13:
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_testing.py:147: in wrapper
              return fn(*args, **kwargs)
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:4498: in check_n_features_in_after_fitting
              with raises(
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              self =
              exc_type =
              exc_value = IndexError('boolean index did not match indexed array along axis 1; size of axis is 1 but size of corresponding boolean axis is 4')
              _ =
              def __exit__(self, exc_type, exc_value, _):
              # see
              # https://docs.python.org/2.5/whatsnew/pep-343.html#SECTION000910000000000000000

              if exc_type is None: # No exception was raised in the block
              if self.may_pass:
              return True # CM is happy
              else:
              err_msg = self.err_msg or f"Did not raise: {self.expected_exc_types}"
              raise AssertionError(err_msg)

              if not any(
              issubclass(exc_type, expected_type)
              for expected_type in self.expected_exc_types
              ):
              if self.err_msg is not None:
              > raise AssertionError(self.err_msg) from exc_value
              E AssertionError: `BorutaPy.transform()` does not check for consistency between input number
              E of features with BorutaPy.fit(), via the `n_features_in_` attribute.
              E You might want to use `sklearn.utils.validation.validate_data` instead
              E of `check_array` in `BorutaPy.fit()` and BorutaPy.transform()`. This can be done
              E like the following:
              E from sklearn.utils.validation import validate_data
              E ...
              E class MyEstimator(BaseEstimator):
              E ...
              E def fit(self, X, y):
              E X, y = validate_data(self, X, y, ...)
              E ...
              E return self
              E ...
              E def transform(self, X):
              E X = validate_data(self, X, ..., reset=False)
              E ...
              E return X
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_testing.py:1104: AssertionError
          • 0 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_mixin_order)
            • PASSED [ 31%]
          • 25.39 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_positive_only_tag_during_fit)
            • PASSED [ 34%]
          • 8 m 36 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_estimators_dtypes)
            • PASSED [ 36%]
          • 47 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_complex_data)
            • PASSED [ 38%]
          • 4 m 48 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_dtype_object)
            • PASSED [ 40%]
          • 1 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_estimators_empty_data_messages)
            • PASSED [ 42%]
          • 1 m 16 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_pipeline_consistency)
            • PASSED [ 44%]
          • 52.05 s
            failed(BorutaPy(estimator=RandomForestClassifier())-check_estimators_nan_inf)
            • FAILED [ 46%]
            • boruta/test/test_sklearn_compatibility.py:10 (test_sklearn_compatible_imputer[BorutaPy(estimator=RandomForestClassifier())-check_estimators_nan_inf])estimator = BorutaPy(estimator=RandomForestClassifier())
              check = functools.partial(, 'BorutaPy')
              @parametrize_with_checks([BorutaPy(RandomForestClassifier())])
              def test_sklearn_compatible_imputer(estimator, check):
              > check(estimator)
              test_sklearn_compatibility.py:13:
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_testing.py:147: in wrapper
              return fn(*args, **kwargs)
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:2371: in check_estimators_nan_inf
              with raises(
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              self = , exc_type = None
              exc_value = None, _ = None
              def __exit__(self, exc_type, exc_value, _):
              # see
              # https://docs.python.org/2.5/whatsnew/pep-343.html#SECTION000910000000000000000

              if exc_type is None: # No exception was raised in the block
              if self.may_pass:
              return True # CM is happy
              else:
              err_msg = self.err_msg or f"Did not raise: {self.expected_exc_types}"
              > raise AssertionError(err_msg)
              E AssertionError: Estimator BorutaPy doesn't check for NaN and inf in transform.
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_testing.py:1097: AssertionError
          • 7 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_estimator_sparse_tag)
            • PASSED [ 48%]
          • 26 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_estimator_sparse_array)
            • PASSED [ 51%]
          • 15 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_estimator_sparse_matrix)
            • PASSED [ 53%]
          • 19.17 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_estimators_pickle)
            • PASSED [ 55%]
          • 23.40 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_estimators_pickle(readonly_memmap=True))
            • PASSED [ 57%]
          • 37.69 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_f_contiguous_array_estimator)
            • PASSED [ 59%]
          • 5 ms
            failed(BorutaPy(estimator=RandomForestClassifier())-check_transformer_data_not_an_array)
            • FAILED [ 61%]
            • boruta/test/test_sklearn_compatibility.py:10 (test_sklearn_compatible_imputer[BorutaPy(estimator=RandomForestClassifier())-check_transformer_data_not_an_array])self = BorutaPy(estimator=RandomForestClassifier(), random_state=0)
              arg =
              def _validate_pandas_input(self, arg):
              try:
              > return arg.values
              E AttributeError: '_NotAnArray' object has no attribute 'values'
              ../boruta_py.py:282: AttributeError
              During handling of the above exception, another exception occurred:
              estimator = BorutaPy(estimator=RandomForestClassifier())
              check = functools.partial(, 'BorutaPy')
              @parametrize_with_checks([BorutaPy(RandomForestClassifier())])
              def test_sklearn_compatible_imputer(estimator, check):
              > check(estimator)
              test_sklearn_compatibility.py:13:
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_testing.py:147: in wrapper
              return fn(*args, **kwargs)
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:2017: in check_transformer_data_not_an_array
              _check_transformer(name, transformer, this_X, this_y)
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:2069: in _check_transformer
              transformer.fit(X, y_)
              ../boruta_py.py:224: in fit
              return self._fit(X, y)
              ../boruta_py.py:299: in _fit
              X = self._validate_pandas_input(X)
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              self = BorutaPy(estimator=RandomForestClassifier(), random_state=0)
              arg =
              def _validate_pandas_input(self, arg):
              try:
              return arg.values
              except AttributeError:
              > raise ValueError(
              "input needs to be a numpy array or pandas data frame."
              )
              E ValueError: input needs to be a numpy array or pandas data frame.
              ../boruta_py.py:284: ValueError
          • 56.81 s
            failed(BorutaPy(estimator=RandomForestClassifier())-check_transformer_general)
            • FAILED [ 63%]
            • boruta/test/test_sklearn_compatibility.py:10 (test_sklearn_compatible_imputer[BorutaPy(estimator=RandomForestClassifier())-check_transformer_general])name = 'BorutaPy'
              transformer_orig = BorutaPy(estimator=RandomForestClassifier())
              X = array([[ 1.02755117, 1.15874525, 1.06413313],
              [-0.8140135 , -0.81598721, -1.01671279],
              [-0.98512836, -...8566698, 1.24725421],
              [ 0.87374976, 0.8271145 , 0.92407539],
              [-1.13395007, -1.28256903, -1.22104978]])
              y = array([1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1,
              0, 1, 1, 1, 0, 1, 1, 0])
              def _check_transformer(name, transformer_orig, X, y):
              n_samples, n_features = np.asarray(X).shape
              transformer = clone(transformer_orig)
              set_random_state(transformer)

              # fit

              if name in CROSS_DECOMPOSITION:
              y_ = np.c_[np.asarray(y), np.asarray(y)]
              y_[::2, 1] *= 2
              if isinstance(X, _NotAnArray):
              y_ = _NotAnArray(y_)
              else:
              y_ = y

              transformer.fit(X, y_)
              # fit_transform method should work on non fitted estimator
              transformer_clone = clone(transformer)
              X_pred = transformer_clone.fit_transform(X, y=y_)

              if isinstance(X_pred, tuple):
              for x_pred in X_pred:
              assert x_pred.shape[0] == n_samples
              else:
              # check for consistent n_samples
              assert X_pred.shape[0] == n_samples

              if hasattr(transformer, "transform"):
              if name in CROSS_DECOMPOSITION:
              X_pred2 = transformer.transform(X, y_)
              X_pred3 = transformer.fit_transform(X, y=y_)
              else:
              X_pred2 = transformer.transform(X)
              X_pred3 = transformer.fit_transform(X, y=y_)

              if get_tags(transformer_orig).non_deterministic:
              msg = name + " is non deterministic"
              raise SkipTest(msg)
              if isinstance(X_pred, tuple) and isinstance(X_pred2, tuple):
              for x_pred, x_pred2, x_pred3 in zip(X_pred, X_pred2, X_pred3):
              assert_allclose_dense_sparse(
              x_pred,
              x_pred2,
              atol=1e-2,
              err_msg="fit_transform and transform outcomes not consistent in %s"
              % transformer,
              )
              assert_allclose_dense_sparse(
              x_pred,
              x_pred3,
              atol=1e-2,
              err_msg="consecutive fit_transform outcomes not consistent in %s"
              % transformer,
              )
              else:
              assert_allclose_dense_sparse(
              X_pred,
              X_pred2,
              err_msg="fit_transform and transform outcomes not consistent in %s"
              % transformer,
              atol=1e-2,
              )
              assert_allclose_dense_sparse(
              X_pred,
              X_pred3,
              atol=1e-2,
              err_msg="consecutive fit_transform outcomes not consistent in %s"
              % transformer,
              )
              assert _num_samples(X_pred2) == n_samples
              assert _num_samples(X_pred3) == n_samples

              # raises error on malformed input for transform
              if (
              hasattr(X, "shape")
              and get_tags(transformer).requires_fit
              and X.ndim == 2
              and X.shape[1] > 1
              ):
              # If it's not an array, it does not have a 'T' property
              with raises(
              ValueError,
              err_msg=(
              f"The transformer {name} does not raise an error "
              "when the number of features in transform is different from "
              "the number of features in fit."
              ),
              ):
              > transformer.transform(X[:, :-1])
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:2142:
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_set_output.py:319: in wrapped
              data_to_wrap = f(self, X, *args, **kwargs)
              ../boruta_py.py:249: in transform
              return self._transform(X, weak, return_df)
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              self = BorutaPy(estimator=RandomForestClassifier(n_estimators=1000,
              random_state=RandomState(MT19937) at 0x11E25FA40),
              random_state=RandomState(MT19937) at 0x11E25FA40)
              X = array([[ 1.02755117, 1.15874525],
              [-0.8140135 , -0.81598721],
              [-0.98512836, -1.03536313],
              [ 0.67...-1.13733757],
              [ 0.97914709, 0.78566698],
              [ 0.87374976, 0.8271145 ],
              [-1.13395007, -1.28256903]])
              weak = False, return_df = False
              def _transform(self, X, weak=False, return_df=False):
              # sanity check
              try:
              self.ranking_
              except AttributeError:
              raise ValueError('You need to call the fit(X, y) method first.')

              if weak:
              indices = self.support_ + self.support_weak_
              else:
              indices = self.support_

              if return_df:
              X = X.iloc[:, indices]
              else:
              > X = X[:, indices]
              E IndexError: boolean index did not match indexed array along axis 1; size of axis is 2 but size of corresponding boolean axis is 3
              ../boruta_py.py:464: IndexError
              The above exception was the direct cause of the following exception:
              estimator = BorutaPy(estimator=RandomForestClassifier())
              check = functools.partial(, 'BorutaPy')
              @parametrize_with_checks([BorutaPy(RandomForestClassifier())])
              def test_sklearn_compatible_imputer(estimator, check):
              > check(estimator)
              test_sklearn_compatibility.py:13:
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_testing.py:147: in wrapper
              return fn(*args, **kwargs)
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:2001: in check_transformer_general
              _check_transformer(name, transformer, X, y)
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:2134: in _check_transformer
              with raises(
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              self =
              exc_type =
              exc_value = IndexError('boolean index did not match indexed array along axis 1; size of axis is 2 but size of corresponding boolean axis is 3')
              _ =
              def __exit__(self, exc_type, exc_value, _):
              # see
              # https://docs.python.org/2.5/whatsnew/pep-343.html#SECTION000910000000000000000

              if exc_type is None: # No exception was raised in the block
              if self.may_pass:
              return True # CM is happy
              else:
              err_msg = self.err_msg or f"Did not raise: {self.expected_exc_types}"
              raise AssertionError(err_msg)

              if not any(
              issubclass(exc_type, expected_type)
              for expected_type in self.expected_exc_types
              ):
              if self.err_msg is not None:
              > raise AssertionError(self.err_msg) from exc_value
              E AssertionError: The transformer BorutaPy does not raise an error when the number of features in transform is different from the number of features in fit.
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_testing.py:1104: AssertionError
          • 47.01 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_transformer_preserve_dtypes)
            • PASSED [ 65%]
          • 1 m 17 s
            failed(BorutaPy(estimator=RandomForestClassifier())-check_transformer_general(readonly_memmap=True))
            • FAILED [ 68%]
            • boruta/test/test_sklearn_compatibility.py:10 (test_sklearn_compatible_imputer[BorutaPy(estimator=RandomForestClassifier())-check_transformer_general(readonly_memmap=True)])name = 'BorutaPy'
              transformer_orig = BorutaPy(estimator=RandomForestClassifier())
              X = memmap([[ 1.02755117, 1.15874525, 1.06413313],
              [-0.8140135 , -0.81598721, -1.01671279],
              [-0.98512836...66698, 1.24725421],
              [ 0.87374976, 0.8271145 , 0.92407539],
              [-1.13395007, -1.28256903, -1.22104978]])
              y = memmap([1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1,
              0, 1, 1, 1, 0, 1, 1, 0])
              def _check_transformer(name, transformer_orig, X, y):
              n_samples, n_features = np.asarray(X).shape
              transformer = clone(transformer_orig)
              set_random_state(transformer)

              # fit

              if name in CROSS_DECOMPOSITION:
              y_ = np.c_[np.asarray(y), np.asarray(y)]
              y_[::2, 1] *= 2
              if isinstance(X, _NotAnArray):
              y_ = _NotAnArray(y_)
              else:
              y_ = y

              transformer.fit(X, y_)
              # fit_transform method should work on non fitted estimator
              transformer_clone = clone(transformer)
              X_pred = transformer_clone.fit_transform(X, y=y_)

              if isinstance(X_pred, tuple):
              for x_pred in X_pred:
              assert x_pred.shape[0] == n_samples
              else:
              # check for consistent n_samples
              assert X_pred.shape[0] == n_samples

              if hasattr(transformer, "transform"):
              if name in CROSS_DECOMPOSITION:
              X_pred2 = transformer.transform(X, y_)
              X_pred3 = transformer.fit_transform(X, y=y_)
              else:
              X_pred2 = transformer.transform(X)
              X_pred3 = transformer.fit_transform(X, y=y_)

              if get_tags(transformer_orig).non_deterministic:
              msg = name + " is non deterministic"
              raise SkipTest(msg)
              if isinstance(X_pred, tuple) and isinstance(X_pred2, tuple):
              for x_pred, x_pred2, x_pred3 in zip(X_pred, X_pred2, X_pred3):
              assert_allclose_dense_sparse(
              x_pred,
              x_pred2,
              atol=1e-2,
              err_msg="fit_transform and transform outcomes not consistent in %s"
              % transformer,
              )
              assert_allclose_dense_sparse(
              x_pred,
              x_pred3,
              atol=1e-2,
              err_msg="consecutive fit_transform outcomes not consistent in %s"
              % transformer,
              )
              else:
              assert_allclose_dense_sparse(
              X_pred,
              X_pred2,
              err_msg="fit_transform and transform outcomes not consistent in %s"
              % transformer,
              atol=1e-2,
              )
              assert_allclose_dense_sparse(
              X_pred,
              X_pred3,
              atol=1e-2,
              err_msg="consecutive fit_transform outcomes not consistent in %s"
              % transformer,
              )
              assert _num_samples(X_pred2) == n_samples
              assert _num_samples(X_pred3) == n_samples

              # raises error on malformed input for transform
              if (
              hasattr(X, "shape")
              and get_tags(transformer).requires_fit
              and X.ndim == 2
              and X.shape[1] > 1
              ):
              # If it's not an array, it does not have a 'T' property
              with raises(
              ValueError,
              err_msg=(
              f"The transformer {name} does not raise an error "
              "when the number of features in transform is different from "
              "the number of features in fit."
              ),
              ):
              > transformer.transform(X[:, :-1])
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:2142:
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_set_output.py:319: in wrapped
              data_to_wrap = f(self, X, *args, **kwargs)
              ../boruta_py.py:249: in transform
              return self._transform(X, weak, return_df)
              ../boruta_py.py:464: in _transform
              X = X[:, indices]
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              self = memmap([[ 1.02755117, 1.15874525],
              [-0.8140135 , -0.81598721],
              [-0.98512836, -1.03536313],
              [ ...13733757],
              [ 0.97914709, 0.78566698],
              [ 0.87374976, 0.8271145 ],
              [-1.13395007, -1.28256903]])
              index = (slice(None, None, None), array([ True, True, True]))
              def __getitem__(self, index):
              > res = super().__getitem__(index)
              E IndexError: boolean index did not match indexed array along axis 1; size of axis is 2 but size of corresponding boolean axis is 3
              ../../../envs/boruta_py/lib/python3.11/site-packages/numpy/_core/memmap.py:358: IndexError
              The above exception was the direct cause of the following exception:
              estimator = BorutaPy(estimator=RandomForestClassifier())
              check = functools.partial(, 'BorutaPy', readonly_memmap=True)
              @parametrize_with_checks([BorutaPy(RandomForestClassifier())])
              def test_sklearn_compatible_imputer(estimator, check):
              > check(estimator)
              test_sklearn_compatibility.py:13:
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_testing.py:147: in wrapper
              return fn(*args, **kwargs)
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:2001: in check_transformer_general
              _check_transformer(name, transformer, X, y)
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:2134: in _check_transformer
              with raises(
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              self =
              exc_type =
              exc_value = IndexError('boolean index did not match indexed array along axis 1; size of axis is 2 but size of corresponding boolean axis is 3')
              _ =
              def __exit__(self, exc_type, exc_value, _):
              # see
              # https://docs.python.org/2.5/whatsnew/pep-343.html#SECTION000910000000000000000

              if exc_type is None: # No exception was raised in the block
              if self.may_pass:
              return True # CM is happy
              else:
              err_msg = self.err_msg or f"Did not raise: {self.expected_exc_types}"
              raise AssertionError(err_msg)

              if not any(
              issubclass(exc_type, expected_type)
              for expected_type in self.expected_exc_types
              ):
              if self.err_msg is not None:
              > raise AssertionError(self.err_msg) from exc_value
              E AssertionError: The transformer BorutaPy does not raise an error when the number of features in transform is different from the number of features in fit.
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_testing.py:1104: AssertionError
          • 1 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_transformers_unfitted)
            • PASSED [ 70%]
          • 24.94 s
            failed(BorutaPy(estimator=RandomForestClassifier())-check_transformer_n_iter)
            • FAILED [ 72%]
            • boruta/test/test_sklearn_compatibility.py:10 (test_sklearn_compatible_imputer[BorutaPy(estimator=RandomForestClassifier())-check_transformer_n_iter])estimator = BorutaPy(estimator=RandomForestClassifier())
              check = functools.partial(, 'BorutaPy')
              @parametrize_with_checks([BorutaPy(RandomForestClassifier())])
              def test_sklearn_compatible_imputer(estimator, check):
              > check(estimator)
              test_sklearn_compatibility.py:13:
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_testing.py:147: in wrapper
              return fn(*args, **kwargs)
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              name = 'BorutaPy', estimator_orig = BorutaPy(estimator=RandomForestClassifier())
              @ignore_warnings(category=FutureWarning)
              def check_transformer_n_iter(name, estimator_orig):
              # Test that transformers with a parameter max_iter, return the
              # attribute of n_iter_ at least 1.
              estimator = clone(estimator_orig)
              if hasattr(estimator, "max_iter"):
              if name in CROSS_DECOMPOSITION:
              # Check using default data
              X = [[0.0, 0.0, 1.0], [1.0, 0.0, 0.0], [2.0, 2.0, 2.0], [2.0, 5.0, 4.0]]
              y_ = [[0.1, -0.2], [0.9, 1.1], [0.1, -0.5], [0.3, -0.2]]

              else:
              X, y_ = make_blobs(
              n_samples=30,
              centers=[[0, 0, 0], [1, 1, 1]],
              random_state=0,
              n_features=2,
              cluster_std=0.1,
              )
              X = _enforce_estimator_tags_X(estimator_orig, X)
              set_random_state(estimator, 0)
              estimator.fit(X, y_)

              # These return a n_iter per component.
              if name in CROSS_DECOMPOSITION:
              for iter_ in estimator.n_iter_:
              assert iter_ >= 1
              else:
              > assert estimator.n_iter_ >= 1
              E AttributeError: 'BorutaPy' object has no attribute 'n_iter_'
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:4079: AttributeError
          • 2 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_parameters_default_constructible)
            • PASSED [ 74%]
          • 49.51 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_methods_sample_order_invariance)
            • PASSED [ 76%]
          • 51.37 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_methods_subset_invariance)
            • PASSED [ 78%]
          • 22.68 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_fit2d_1sample)
            • PASSED [ 80%]
          • 22.99 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_fit2d_1feature)
            • PASSED [ 82%]
          • 2 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_get_params_invariance)
            • PASSED [ 85%]
          • 46 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_set_params)
            • PASSED [ 87%]
          • 45.32 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_dict_unchanged)
            • PASSED [ 89%]
          • 2 m 2 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_fit_idempotent)
            • PASSED [ 91%]
          • 6 m 40 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_fit_check_is_fitted)
            • PASSED [ 93%]
          • 37.15 s
            passed(BorutaPy(estimator=RandomForestClassifier())-check_n_features_in)
            • PASSED [ 95%]
          • 2 ms
            passed(BorutaPy(estimator=RandomForestClassifier())-check_fit1d)
            • PASSED [ 97%]
          • 43.30 s
            failed(BorutaPy(estimator=RandomForestClassifier())-check_fit2d_predict1d)
            • FAILED [100%]
            • boruta/test/test_sklearn_compatibility.py:10 (test_sklearn_compatible_imputer[BorutaPy(estimator=RandomForestClassifier())-check_fit2d_predict1d])estimator = BorutaPy(estimator=RandomForestClassifier())
              check = functools.partial(, 'BorutaPy')
              > ???
              test_sklearn_compatibility.py:13:
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_testing.py:147: in wrapper
              return fn(*args, **kwargs)
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/estimator_checks.py:1792: in check_fit2d_predict1d
              getattr(estimator, method)(X[0])
              ../../../envs/boruta_py/lib/python3.11/site-packages/sklearn/utils/_set_output.py:319: in wrapped
              data_to_wrap = f(self, X, *args, **kwargs)
              ../boruta_py.py:249: in transform
              ???
              _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
              self = BorutaPy(estimator=RandomForestClassifier(n_estimators=1000,
              random_state=RandomState(MT19937) at 0x101E68E40),
              random_state=RandomState(MT19937) at 0x101E68E40)
              X = array([1.64644051, 2.1455681 , 1.80829013]), weak = False, return_df = False

              def _transform(self, X, weak=False, return_df=False):
              # sanity check
              try:
              self.ranking_
              except AttributeError:
              raise ValueError('You need to call the fit(X, y) method first.')

              if weak:
              indices = self.support_ + self.support_weak_
              else:
              indices = self.support_

              if return_df:
              X = X.iloc[:, indices]
              > else:
              E IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
              ../boruta_py.py:464: IndexError

Generated by PyCharm on 12/11/2025, 23:23