Skip to content

Commit

Permalink
ENH make tools to list estimators within the project
Browse files Browse the repository at this point in the history
  • Loading branch information
glemaitre committed May 1, 2024
1 parent 251b4f9 commit f3a7563
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 2 deletions.
12 changes: 12 additions & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,15 @@ Predictor
:template: class.rst

TemplateClassifier


Utilities
=========

.. autosummary::
:toctree: generated/
:template: functions.rst

utils.discovery.all_estimators
utils.discovery.all_displays
utils.discovery.all_functions
3 changes: 3 additions & 0 deletions skltemplate/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Authors: scikit-learn-contrib developers
# License: BSD 3 clause

from ._template import TemplateClassifier, TemplateEstimator, TemplateTransformer
from ._version import __version__

Expand Down
4 changes: 4 additions & 0 deletions skltemplate/_template.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""
This is a module to be used as a reference for building other modules
"""

# Authors: scikit-learn-contrib developers
# License: BSD 3 clause

import numpy as np
from sklearn.base import BaseEstimator, ClassifierMixin, TransformerMixin, _fit_context
from sklearn.metrics import euclidean_distances
Expand Down
3 changes: 3 additions & 0 deletions skltemplate/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Authors: scikit-learn-contrib developers
# License: BSD 3 clause

__version__ = "0.0.4.dev0"
2 changes: 2 additions & 0 deletions skltemplate/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Authors: scikit-learn-contrib developers
# License: BSD 3 clause
7 changes: 5 additions & 2 deletions skltemplate/tests/test_common.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
"""This file shows how to write test based on the scikit-learn common tests."""

# Authors: scikit-learn-contrib developers
# License: BSD 3 clause

from sklearn.utils.estimator_checks import parametrize_with_checks

from skltemplate import TemplateClassifier, TemplateEstimator, TemplateTransformer
from skltemplate.utils.discovery import all_estimators


# parametrize_with_checks allows to get a generator of check that is more fine-grained
# than check_estimator
@parametrize_with_checks([TemplateEstimator(), TemplateTransformer(), TemplateClassifier()])
@parametrize_with_checks([est() for _, est in all_estimators()])
def test_estimators(estimator, check, request):
"""Check the compatibility with scikit-learn API"""
check(estimator)
2 changes: 2 additions & 0 deletions skltemplate/tests/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

from skltemplate import TemplateClassifier, TemplateEstimator, TemplateTransformer

# Authors: scikit-learn-contrib developers
# License: BSD 3 clause

@pytest.fixture
def data():
Expand Down

0 comments on commit f3a7563

Please sign in to comment.