scikit-learn-contrib / lightning

Large-scale linear classification, regression and ranking in Python
https://contrib.scikit-learn.org/lightning/
1.73k stars 214 forks source link

Fix numpy deprecation warnings #166

Closed StrikerRUS closed 3 years ago

StrikerRUS commented 3 years ago

Fix

  /home/travis/build/scikit-learn-contrib/lightning/lightning/impl/datasets/samples_generator.py:236: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    y = np.zeros(n_samples, dtype=np.int)

and

impl/tests/test_sag.py::test_sag_sample_weights
  /home/travis/build/scikit-learn-contrib/lightning/lightning/impl/tests/test_sag.py:444: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    sample_weights = np.ones(y2.size, dtype=np.float)