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_regression_missing_target #754

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_regression_missing_target FAILED

=================================== FAILURES ===================================
_______________ AutoMLTargetsTest.test_regression_missing_target _______________

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

    def test_regression_missing_target(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.rand(self.rows), name="target")
    
        y.iloc[1] = None
    
        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:304: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
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.428266  0.400413  0.520708
1   0.240960  0.342989  0.285674
2   0.041829  0.516...  0.954445  0.989042
47  0.036140  0.744682  0.704169
48  0.647842  0.012628  0.719164
49  0.579543  0.874871  0.058259
y = 0     0.179094
1          NaN
2     0.678937
3     0.052738
4     0.357631
5     0.983330
6     0.233370
7     0.56043...
44    0.117175
45    0.436181
46    0.289724
47    0.862779
48    0.475552
49    0.649819
Name: target, dtype: float64
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_regression_missing_target
============================== 1 failed in 1.90s ===============================
@a-szulc a-szulc changed the title warning in test: tests/tests_automl/test_targets.py::AutoMLTargetsTest::test_regression_missing_target user warning in test: tests/tests_automl/test_targets.py::AutoMLTargetsTest::test_regression_missing_target Aug 23, 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