Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user warning in test: tests/tests_automl/test_targets.py::AutoMLTargetsTest::test_bin_class_AB_missing_targets #752

Closed
a-szulc opened this issue Aug 23, 2024 · 0 comments

Comments

@a-szulc
Copy link
Contributor

a-szulc commented Aug 23, 2024

============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-8.3.2, pluggy-1.5.0 -- /home/adas/mljar/mljar-supervised/venv/bin/python3
cachedir: .pytest_cache
rootdir: /home/adas/mljar/mljar-supervised
configfile: pytest.ini
plugins: cov-5.0.0
collecting ... collected 1 item

tests/tests_automl/test_targets.py::AutoMLTargetsTest::test_bin_class_AB_missing_targets FAILED

=================================== FAILURES ===================================
_____________ AutoMLTargetsTest.test_bin_class_AB_missing_targets ______________

self = <tests.tests_automl.test_targets.AutoMLTargetsTest testMethod=test_bin_class_AB_missing_targets>

    def test_bin_class_AB_missing_targets(self):
        X = np.random.rand(self.rows, 3)
        X = pd.DataFrame(X, columns=[f"f{i}" for i in range(3)])
        y = pd.Series(
            np.random.permutation(["a", "B"] * int(self.rows / 2)), name="target"
        )
    
        y.iloc[1] = None
        y.iloc[3] = np.NaN
        y.iloc[13] = np.nan
    
        automl = AutoML(
            results_path=self.automl_dir,
            total_time_limit=1,
            algorithms=["Xgboost"],
            train_ensemble=False,
            explain_level=0,
            start_random_models=1,
        )
>       automl.fit(X, y)

tests/tests_automl/test_targets.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
supervised/automl.py:432: in fit
    return self._fit(X, y, sample_weight, cv, sensitive_features)
supervised/base_automl.py:967: in _fit
    X, y, sample_weight, sensitive_features = self._build_dataframe(
supervised/base_automl.py:789: in _build_dataframe
    X, y, sample_weight, sensitive_features = ExcludeRowsMissingTarget.transform(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

X =           f0        f1        f2
0   0.219718  0.578841  0.536912
1   0.382829  0.145900  0.430932
2   0.155678  0.482...  0.258146  0.325605
47  0.425501  0.771115  0.633187
48  0.189009  0.472929  0.558061
49  0.760685  0.277196  0.985700
y = 0        B
1     None
2        a
3      NaN
4        a
5        a
6        B
7        B
8        B
9        B
10      ...  B
42       a
43       a
44       B
45       a
46       B
47       a
48       a
49       a
Name: target, dtype: object
sample_weight = None, sensitive_features = None, warn = True

    @staticmethod
    def transform(
        X=None, y=None, sample_weight=None, sensitive_features=None, warn=False
    ):
        if y is None:
            return X, y, sample_weight, sensitive_features
        y_missing = pd.isnull(y)
        if np.sum(np.array(y_missing)) == 0:
            return X, y, sample_weight, sensitive_features
        logger.debug("Exclude rows with missing target values")
        if warn:
>           warnings.warn(
                "There are samples with missing target values in the data which will be excluded for further analysis"
            )
E           UserWarning: There are samples with missing target values in the data which will be excluded for further analysis

supervised/preprocessing/exclude_missing_target.py:25: UserWarning
=========================== short test summary info ============================
FAILED tests/tests_automl/test_targets.py::AutoMLTargetsTest::test_bin_class_AB_missing_targets
============================== 1 failed in 1.92s ===============================
@a-szulc a-szulc changed the title warning in test: tests/tests_automl/test_targets.py::AutoMLTargetsTest::test_bin_class_AB_missing_targets user warning in test: tests/tests_automl/test_targets.py::AutoMLTargetsTest::test_bin_class_AB_missing_targets Aug 23, 2024
pplonski added a commit that referenced this issue Aug 29, 2024
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

No branches or pull requests

1 participant