Skip to content

Commit e0961f8

Browse files
committed
DOC add speed example
1 parent 735dc0c commit e0961f8

File tree

15 files changed

+1243
-338
lines changed

15 files changed

+1243
-338
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ wheels/
2828

2929
# Used by sphinx
3030
doc/_build/
31-
doc/generated/
31+
doc/generated/
32+
doc/auto_examples/
33+
doc/sg_execution_times.rst

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ python:
1111
install:
1212
- method: pip
1313
path: .
14-
extra_requirements: [doc]
14+
extra_requirements: [docs]

README.rst

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FastCan: A Fast Canonical-Correlation-Based Feature Selection Method
2-
====================================================================
1+
FastCan: A Fast Canonical-Correlation-Based Feature Selection Algorithm
2+
=======================================================================
33
|conda| |Codecov| |CI| |Doc| |PythonVersion| |PyPi| |Black| |ruff| |pixi|
44

55
.. |conda| image:: https://img.shields.io/conda/vn/conda-forge/fastcan.svg
@@ -29,6 +29,16 @@ FastCan: A Fast Canonical-Correlation-Based Feature Selection Method
2929
.. |pixi| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json&style=flat-square
3030
:target: https://pixi.sh
3131

32+
FastCan is a feature selection method, which has following advantages:
33+
34+
#. Extremely **fast**. See :ref:`sphx_glr_auto_examples_plot_speed.py`.
35+
36+
#. Support unsupervised feature selection.
37+
38+
#. Support multioutput feature selection.
39+
40+
#. Skip redundant features.
41+
3242

3343
Installation
3444
------------
@@ -41,25 +51,22 @@ Or via conda-forge:
4151

4252
* Run ``conda install -c conda-forge fastcan``
4353

44-
Examples
45-
--------
54+
Getting Started
55+
---------------
4656
>>> from fastcan import FastCan
47-
>>> X = [[ 0.87, -1.34, 0.31 ],
48-
... [-2.79, -0.02, -0.85 ],
49-
... [-1.34, -0.48, -2.55 ],
50-
... [ 1.92, 1.48, 0.65 ]]
51-
>>> y = [0, 1, 0, 1]
52-
>>> selector = FastCan(n_features_to_select=2, verbose=0).fit(X, y)
53-
>>> selector.get_support()
54-
array([ True, True, False])
57+
>>> X = [[1, 0], [0, 1]]
58+
>>> y = [1, 0]
59+
>>> FastCan(verbose=0).fit(X, y).get_support()
60+
array([ True, False])
5561

62+
Check :ref:`User Guild <user_guide>` and :ref:`Examples <examples>` for more information.
5663

5764
Citation
5865
--------
5966

6067
FastCan is a Python implementation of the following papers.
6168

62-
If you use the `h-correlation` algorithm in your work please cite the following reference:
69+
If you use the `h-correlation` method in your work please cite the following reference:
6370

6471
.. code:: bibtex
6572
@@ -76,7 +83,7 @@ If you use the `h-correlation` algorithm in your work please cite the following
7683
keywords = {Feature selection, Orthogonal least squares, Canonical correlation analysis, Linear discriminant analysis, Multi-label, Multivariate time series, Feature interaction},
7784
}
7885
79-
If you use the `eta-cosine` algorithm in your work please cite the following reference:
86+
If you use the `eta-cosine` method in your work please cite the following reference:
8087

8188
.. code:: bibtex
8289

doc/conf.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
"sphinx.ext.napoleon",
4141
# Link to other project's documentation (see mapping below)
4242
"sphinx.ext.intersphinx",
43+
"sphinx_gallery.gen_gallery",
44+
"sphinx_design",
4345
]
4446

4547
# List of patterns, relative to source directory, that match files and
@@ -67,14 +69,7 @@
6769
"sklearn": ("https://scikit-learn.org/stable", None),
6870
}
6971

70-
# add substitutions that should be available in every file
71-
rst_prolog = """
72-
.. |numpy_dtype| replace:: numpy data type
73-
.. _numpy_dtype: https://numpy.org/doc/stable/user/basics.types.html
74-
75-
.. |sklearn_cython_dtype| replace:: sklearn cython data type
76-
.. _sklearn_cython_dtype: https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/utils/_typedefs.pxd
77-
78-
.. |sphinx_link| replace:: rst Markup Spec
79-
.. _sphinx_link: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html
80-
"""
72+
sphinx_gallery_conf = {
73+
"examples_dirs": ["../examples"],
74+
"gallery_dirs": ["auto_examples"],
75+
}

doc/index.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,21 @@
1313

1414

1515
FastCan Class
16-
~~~~~~~~~~~~~
16+
-------------
1717
.. autosummary::
1818
:toctree: generated/
1919

2020
FastCan
2121

22+
Useful Links
23+
------------
24+
.. toctree::
2225

23-
...................
26+
User Guild <user_guide>
27+
Examples <auto_examples/index>
28+
29+
API Compatibility
30+
-----------------
2431

2532
The API of this package is align with scikit-learn.
2633

doc/intuitive.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.. currentmodule:: fastcan
2+
3+
.. _intuitive:
4+
5+
=======================
6+
Intuitively explanation
7+
=======================
8+
9+
Let's intuitively understand the two methods, h-correlation and eta-cosine, in :class:`FastCan`.
10+
11+
The computational speed comparison between h-correlation method and eta-cosine method.
12+
13+
.. figure:: ./auto_examples/images/sphx_glr_plot_speed_001.png
14+
:target: ./auto_examples/plot_speed.html
15+
:align: center
16+
:scale: 70%

doc/multioutput.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.. currentmodule:: fastcan
2+
3+
.. _multioutput:
4+
5+
==============================
6+
Multioutput feature selection
7+
==============================
8+
9+
We can use :class:`FastCan` for multioutput feature selection.

doc/redundancy.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.. currentmodule:: fastcan
2+
3+
.. _redundancy:
4+
5+
==================
6+
Feature redundancy
7+
==================
8+
9+
:class:`FastCan` can effectively skip the redundant features.

doc/unsupervised.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.. currentmodule:: fastcan
2+
3+
.. _unsupervised:
4+
5+
==============================
6+
Unsupervised feature selection
7+
==============================
8+
9+
We can use :class:`FastCan` to do unsupervised feature selection.

doc/user_guide.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.. _user_guide:
2+
3+
==========
4+
User Guide
5+
==========
6+
7+
.. toctree::
8+
:numbered:
9+
10+
intuitive.rst
11+
unsupervised.rst
12+
multioutput.rst
13+
redundancy.rst

0 commit comments

Comments
 (0)