diff --git a/.circleci/config.yml b/.circleci/config.yml index b5f679af6..8990d3f22 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,6 +24,7 @@ jobs: - NUMPYDOC_VERSION: 'latest' - SPHINXCONTRIB_BIBTEX_VERSION: 'latest' - PYDATA_SPHINX_THEME_VERSION: 'latest' + - SPHINX_DESIGN_VERSION: 'latest' steps: - add_ssh_keys: fingerprints: diff --git a/build_tools/circle/build_doc.sh b/build_tools/circle/build_doc.sh index 32699e8a8..9601b44aa 100755 --- a/build_tools/circle/build_doc.sh +++ b/build_tools/circle/build_doc.sh @@ -114,6 +114,7 @@ mamba create -n $CONDA_ENV_NAME --yes --quiet \ "$(get_dep sphinxcontrib-bibtex $SPHINXCONTRIB_BIBTEX_VERSION)" \ "$(get_dep sphinx-copybutton $SPHINXCONTRIB_BIBTEX_VERSION)" \ "$(get_dep pydata-sphinx-theme $PYDATA_SPHINX_THEME_VERSION)" \ + "$(get_dep sphinx-design $SPHINX_DESIGN_VERSION)" \ memory_profiler packaging seaborn pytest coverage compilers tensorflow source activate $CONDA_ENV_NAME diff --git a/doc/_static/css/imbalanced-learn.css b/doc/_static/css/imbalanced-learn.css index 6c778540b..3778ee94c 100644 --- a/doc/_static/css/imbalanced-learn.css +++ b/doc/_static/css/imbalanced-learn.css @@ -21,39 +21,44 @@ /* Override some aspects of the pydata-sphinx-theme */ -/* Getting started index page */ +/* Main index page overview cards */ .intro-card { - background: #fff; - border-radius: 0; - padding: 30px 10px 10px 10px; - margin: 10px 0px; -} - -.intro-card .card-text { - margin: 20px 0px; - /*min-height: 150px; */ -} - -.custom-button { - background-color: #dcdcdc; - border: none; - color: #484848; - text-align: center; - text-decoration: none; - display: inline-block; - font-size: 0.9rem; - border-radius: 0.5rem; + padding: 30px 10px 20px 10px; +} + +.intro-card .sd-card-img-top { + margin: 10px; + height: 52px; + background: none !important; +} + +.intro-card .sd-card-title { + color: var(--pst-color-primary); + font-size: var(--pst-font-size-h5); + padding: 1rem 0rem 0.5rem 0rem; +} + +.intro-card .sd-card-footer { + border: none !important; +} + +.intro-card .sd-card-footer p.sd-card-text { max-width: 220px; - padding: 0.5rem 0rem; + margin-left: auto; + margin-right: auto; +} + +.intro-card .sd-btn-secondary { + background-color: #6c757d !important; + border-color: #6c757d !important; } -.custom-button a { - color: #484848; +.intro-card .sd-btn-secondary:hover { + background-color: #5a6268 !important; + border-color: #545b62 !important; } -.custom-button p { - margin-top: 0; - margin-bottom: 0rem; - color: #484848; +.card, .card img { + background-color: var(--pst-color-background); } diff --git a/doc/_static/img/logo_wide_dark.png b/doc/_static/img/logo_wide_dark.png new file mode 100644 index 000000000..38f997886 Binary files /dev/null and b/doc/_static/img/logo_wide_dark.png differ diff --git a/doc/_static/index_api.svg b/doc/_static/index_api.svg new file mode 100644 index 000000000..69f7ba1d2 --- /dev/null +++ b/doc/_static/index_api.svg @@ -0,0 +1,97 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/doc/_static/index_examples.svg b/doc/_static/index_examples.svg new file mode 100644 index 000000000..de3d90237 --- /dev/null +++ b/doc/_static/index_examples.svg @@ -0,0 +1,76 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/doc/_static/index_getting_started.svg b/doc/_static/index_getting_started.svg new file mode 100644 index 000000000..2d36622cb --- /dev/null +++ b/doc/_static/index_getting_started.svg @@ -0,0 +1,66 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/doc/_static/index_user_guide.svg b/doc/_static/index_user_guide.svg new file mode 100644 index 000000000..bd1705351 --- /dev/null +++ b/doc/_static/index_user_guide.svg @@ -0,0 +1,67 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/doc/conf.py b/doc/conf.py index a6361eafd..5561808ab 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -43,6 +43,7 @@ "sphinx_issues", "sphinx_gallery.gen_gallery", "sphinx_copybutton", + "sphinx_design", ] # Specify how to identify the prompt when copying code snippets @@ -106,10 +107,12 @@ html_theme_options = { "external_links": [], "github_url": "https://github.com/scikit-learn-contrib/imbalanced-learn", - # "twitter_url": "https://twitter.com/pandas_dev", "use_edit_page_button": True, "show_toc_level": 1, # "navbar_align": "right", # For testing that the navbar items align properly + "logo": { + "image_dark": "https://imbalanced-learn.org/stable/_static/img/logo_wide_dark.png" + }, } html_context = { @@ -323,15 +326,7 @@ def generate_min_dependency_substitutions(app): # -- Additional temporary hacks ----------------------------------------------- -# Temporary work-around for spacing problem between parameter and parameter -# type in the doc, see https://github.com/numpy/numpydoc/issues/215. The bug -# has been fixed in sphinx (https://github.com/sphinx-doc/sphinx/pull/5976) but -# through a change in sphinx basic.css except rtd_theme does not use basic.css. -# In an ideal world, this would get fixed in this PR: -# https://github.com/readthedocs/sphinx_rtd_theme/pull/747/files - def setup(app): app.connect("builder-inited", generate_min_dependency_table) app.connect("builder-inited", generate_min_dependency_substitutions) - app.add_css_file("basic.css") diff --git a/doc/index.rst b/doc/index.rst index aa3d7a9b2..238786314 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -21,80 +21,82 @@ Imbalanced-learn (imported as :mod:`imblearn`) is an open source, MIT-licensed library relying on scikit-learn (imported as :mod:`sklearn`) and provides tools when dealing with classification with imbalanced classes. -.. raw:: html - -
-
-
-
-
- -
Getting started
-

Check out the getting started guides to install imbalanced-learn. - Some extra information to get started with a new contribution is also provided.

- -.. container:: custom-button - - :ref:`To the installation guideline` - -.. raw:: html - -
-
-
-
-
-
- -
User guide
-

The user guide provides in-depth information on the - key concepts of imbalanced-learn with useful background information and explanation.

- -.. container:: custom-button - - :ref:`To the user guide` - -.. raw:: html - -
-
-
-
-
-
- -
API reference
-

The reference guide contains a detailed description of - the imbalanced-learn API. To known more about methods parameters.

- -.. container:: custom-button - - :ref:`To the reference guide` - -.. raw:: html - -
-
-
-
-
-
- -
Examples
-

The gallery of examples is a good place to see imbalanced-learn in action. - Select an example and dive in.

- -.. container:: custom-button - - :ref:`To the gallery of examples` - -.. raw:: html - -
-
-
-
-
+.. grid:: 1 2 2 2 + :gutter: 4 + :padding: 2 2 0 0 + :class-container: sd-text-center + + .. grid-item-card:: Getting started + :img-top: _static/index_getting_started.svg + :class-card: intro-card + :shadow: md + + Check out the getting started guides to install `imbalanced-learn`. + Some extra information to get started with a new contribution is also provided. + + +++ + + .. button-ref:: getting_started + :ref-type: ref + :click-parent: + :color: secondary + :expand: + + To the installation guideline + + .. grid-item-card:: User guide + :img-top: _static/index_user_guide.svg + :class-card: intro-card + :shadow: md + + The user guide provides in-depth information on the key concepts of + `imbalanced-learn` with useful background information and explanation. + + +++ + + .. button-ref:: user_guide + :ref-type: ref + :click-parent: + :color: secondary + :expand: + + To the user guide + + .. grid-item-card:: API reference + :img-top: _static/index_api.svg + :class-card: intro-card + :shadow: md + + The reference guide contains a detailed description of + the `imbalanced-learn` API. To known more about methods parameters. + + +++ + + .. button-ref:: api + :ref-type: ref + :click-parent: + :color: secondary + :expand: + + To the reference guide + + .. grid-item-card:: Examples + :img-top: _static/index_examples.svg + :class-card: intro-card + :shadow: md + + The gallery of examples is a good place to see `imbalanced-learn` in action. + Select an example and dive in. + + +++ + + .. button-ref:: general_examples + :ref-type: ref + :click-parent: + :color: secondary + :expand: + + To the gallery of examples .. toctree:: diff --git a/examples/api/plot_sampling_strategy_usage.py b/examples/api/plot_sampling_strategy_usage.py index dbb52fcdf..1c76a06b2 100644 --- a/examples/api/plot_sampling_strategy_usage.py +++ b/examples/api/plot_sampling_strategy_usage.py @@ -129,7 +129,7 @@ # %% [markdown] # `sampling_strategy` as a `dict` -# ------------------------------ +# ------------------------------- # # When `sampling_strategy` is a `dict`, the keys correspond to the targeted # classes. The values correspond to the desired number of samples for each diff --git a/examples/ensemble/plot_comparison_ensemble_classifier.py b/examples/ensemble/plot_comparison_ensemble_classifier.py index 602e477e5..8c318e5bc 100644 --- a/examples/ensemble/plot_comparison_ensemble_classifier.py +++ b/examples/ensemble/plot_comparison_ensemble_classifier.py @@ -197,7 +197,7 @@ from imblearn.ensemble import EasyEnsembleClassifier, RUSBoostClassifier -estimator = AdaBoostClassifier(n_estimators=10) +estimator = AdaBoostClassifier(n_estimators=10, algorithm="SAMME") eec = EasyEnsembleClassifier(n_estimators=10, estimator=estimator) eec.fit(X_train, y_train) y_pred_eec = eec.predict(X_test) diff --git a/imblearn/_min_dependencies.py b/imblearn/_min_dependencies.py index 497688765..ec1f5dedb 100644 --- a/imblearn/_min_dependencies.py +++ b/imblearn/_min_dependencies.py @@ -37,6 +37,7 @@ "numpydoc": ("1.5.0", "docs"), "sphinxcontrib-bibtex": ("2.4.1", "docs"), "pydata-sphinx-theme": ("0.13.3", "docs"), + "sphinx-design": ("0.5.0", "docs"), }