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

Scikit-Learn 1.3 support #680

Closed
cngmid opened this issue Sep 25, 2023 · 1 comment · Fixed by #693
Closed

Scikit-Learn 1.3 support #680

cngmid opened this issue Sep 25, 2023 · 1 comment · Fixed by #693
Labels
enhancement New feature or request

Comments

@cngmid
Copy link

cngmid commented Sep 25, 2023

Is your feature request related to a problem? Please describe.
scikit-learn 1.3 is released and has deprecated sklearn.utils.metaestimators.if_delegate_has_method for sklearn.utils.metaestimators.available_if

Describe the solution you'd like
It seems to be enough to modify the file gtda.pipeline.py.
In the header, the line from sklearn.utils.metaestimators import if_delegate_has_method shall be replaced with from sklearn.utils.metaestimators import available_if.
The lines 254 and 410 @if_delegate_has_method(delegate='_final_estimator') shall be replaced with @available_if(pipeline.Pipeline._final_estimator)

Describe alternatives you've considered

Additional context

@cngmid cngmid added the enhancement New feature or request label Sep 25, 2023
@dbl001
Copy link

dbl001 commented Oct 11, 2023

Same ...

% pip show scikit-learn
Name: scikit-learn
Version: 1.3.0
Summary: A set of python modules for machine learning and data mining
Home-page: http://scikit-learn.org
Author: 
Author-email: 
License: new BSD
Location: /Users/davidlaxer/anaconda3/envs/ai/lib/python3.8/site-packages
Requires: joblib, numpy, scipy, threadpoolctl
Required-by: cdt, CellProfiler, giotto-ph, giotto-tda, giotto-tda-nightly, gplearn, hdbscan, librosa, openml, pynndescent, pysr, sentence-transformers, shap, skrebate, torch-geometric, umap-learn

% pytest gtda
============================= test session starts ==============================
platform darwin -- Python 3.8.13, pytest-7.4.0, pluggy-1.0.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /Users/davidlaxer/giotto-tda
configfile: setup.cfg
plugins: anyio-3.5.0, hypothesis-6.82.0, typeguard-2.13.0, cov-4.1.0, hydra-core-1.0.7, azurepipelines-1.0.5, benchmark-4.0.0, lazy-fixture-0.6.3, nunit-1.0.4
collected 1299 items / 2 errors                                                
##vso[task.logissue type=warning;]Jupyter is migrating its paths to use standard platformdirs
given by the platformdirs library.  To remove this warning and
see the appropriate new directories, set the environment variable
`JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`.
The use of platformdirs will be the default in `jupyter_core` v6
##vso[results.publish type=NUnit;runTitle='Pytest results';publishRunAttachments=true;]/Users/davidlaxer/giotto-tda/test-output.xml
##vso[task.logissue type=error;]2 test(s) failed, 1299 test(s) collected.
##vso[task.logissue type=warning;]Coverage XML was not created, skipping upload.

==================================== ERRORS ====================================
__ ERROR collecting gtda/metaestimators/tests/test_collection_transformer.py ___
ImportError while importing test module '/Users/davidlaxer/giotto-tda/gtda/metaestimators/tests/test_collection_transformer.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../anaconda3/envs/ai/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
gtda/metaestimators/__init__.py:4: in <module>
    from .collection_transformer import CollectionTransformer
gtda/metaestimators/collection_transformer.py:12: in <module>
    from sklearn.utils.metaestimators import if_delegate_has_method
E   ImportError: cannot import name 'if_delegate_has_method' from 'sklearn.utils.metaestimators' (/Users/davidlaxer/anaconda3/envs/ai/lib/python3.8/site-packages/sklearn/utils/metaestimators.py)
_________________ ERROR collecting gtda/tests/test_pipeline.py _________________
ImportError while importing test module '/Users/davidlaxer/giotto-tda/gtda/tests/test_pipeline.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../anaconda3/envs/ai/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
gtda/tests/test_pipeline.py:6: in <module>
    from gtda.pipeline import Pipeline
gtda/pipeline.py:7: in <module>
    from sklearn.utils.metaestimators import if_delegate_has_method
E   ImportError: cannot import name 'if_delegate_has_method' from 'sklearn.utils.metaestimators' (/Users/davidlaxer/anaconda3/envs/ai/lib/python3.8/site-packages/sklearn/utils/metaestimators.py)
=============================== warnings summary ===============================
../anaconda3/envs/ai/lib/python3.8/site-packages/jupyter_client/connect.py:27
  /Users/davidlaxer/anaconda3/envs/ai/lib/python3.8/site-packages/jupyter_client/connect.py:27: DeprecationWarning:
  
  Jupyter is migrating its paths to use standard platformdirs
  given by the platformdirs library.  To remove this warning and
  see the appropriate new directories, set the environment variable
  `JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`.
  The use of platformdirs will be the default in `jupyter_core` v6

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
---- generated Nunit xml file: /Users/davidlaxer/giotto-tda/test-output.xml ----
=========================== short test summary info ============================
ERROR gtda/metaestimators/tests/test_collection_transformer.py
ERROR gtda/tests/test_pipeline.py
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
========================= 1 warning, 2 errors in 7.43s =========================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants