TNanukem / scikit-net

A framework for machine learning in complex networks
MIT License
20 stars 5 forks source link

Running the tests produces a warning #36

Closed drj11 closed 1 year ago

drj11 commented 2 years ago

The Boston housing prices dataset is deprecated due to an ethical concern. One of the tests uses it.

; pytest
====================================== test session starts ======================================
platform darwin -- Python 3.9.8, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /Users/drj/prj/scikit-net
plugins: cov-2.12.1
collected 27 items                                                                              

sknet/network_construction/tests/test_network_construction.py .........                   [ 33%]
sknet/semi_supervised/tests/test_modularity_label_propagation.py .....                    [ 51%]
sknet/supervised/tests/test_ease_of_access.py ......                                      [ 74%]
sknet/supervised/tests/test_high_level_classification.py ...                              [ 85%]
sknet/unsupervised/tests/test_stochastic_particle_competition.py ..                       [ 92%]
sknet/utils/tests/test_network_types_handler.py ..                                        [100%]

======================================= warnings summary ========================================
sknet/supervised/tests/test_ease_of_access.py::test__stationary_distribution_regressor
sknet/supervised/tests/test_ease_of_access.py::test_predictions_regressor
  /usr/local/lib/python3.9/site-packages/sklearn/utils/deprecation.py:87: FutureWarning: Function load_boston is deprecated; `load_boston` is deprecated in 1.0 and will be removed in 1.2.

      The Boston housing prices dataset has an ethical problem. You can refer to
      the documentation of this function for further details.

      The scikit-learn maintainers therefore strongly discourage the use of this
      dataset unless the purpose of the code is to study and educate about
      ethical issues in data science and machine learning.

      In this special case, you can fetch the dataset from the original
      source::

          import pandas as pd
          import numpy as np

          data_url = "http://lib.stat.cmu.edu/datasets/boston"
          raw_df = pd.read_csv(data_url, sep="\s+", skiprows=22, header=None)
          data = np.hstack([raw_df.values[::2, :], raw_df.values[1::2, :2]])
          target = raw_df.values[1::2, 2]

      Alternative datasets include the California housing dataset (i.e.
      :func:`~sklearn.datasets.fetch_california_housing`) and the Ames housing
      dataset. You can load the datasets as follows::

          from sklearn.datasets import fetch_california_housing
          housing = fetch_california_housing()

      for the California housing dataset and::

          from sklearn.datasets import fetch_openml
          housing = fetch_openml(name="house_prices", as_frame=True)

      for the Ames housing dataset.

    warnings.warn(msg, category=FutureWarning)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
================================ 27 passed, 2 warnings in 37.58s ================================

This is not going to affect my review, but it would be a good idea to use a different dataset as sklearn suggest in the above warning.

TNanukem commented 1 year ago

The dataset was changed for the diabetes one. Therefore the issue is solved.