Skip to content

Commit 1066748

Browse files
Merge pull request #88 from MatthewSZhang/0.3.X
DOC remove as_frame to avoid readthedocs install pandas
1 parent b459004 commit 1066748

35 files changed

+9974
-3611
lines changed

.github/pull_request_template.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Checklist
2+
3+
- [ ] Used a personal fork to propose changes
4+
- [ ] A reference to a related issue:
5+
- [ ] A description of the changes

.github/workflows/ci.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,29 @@ jobs:
1111
call-test:
1212
uses: ./.github/workflows/test.yml
1313
secrets: inherit
14+
15+
build-sdist:
16+
runs-on: ubuntu-latest
17+
needs: call-test
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: prefix-dev/[email protected]
21+
with:
22+
environments: dev
23+
cache: true
24+
- name: Re-install local
25+
run: |
26+
pixi reinstall -e dev --frozen fastcan
27+
- name: Build SDist
28+
run: |
29+
pixi run build-sdist
30+
- name: Store artifacts
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: cibw-sdist
34+
path: dist/*.tar.gz
1435

15-
build:
36+
build-wheels:
1637
strategy:
1738
fail-fast: false
1839
matrix:
@@ -22,7 +43,7 @@ jobs:
2243
steps:
2344
- uses: actions/checkout@v4
2445
- name: Build wheels
25-
uses: pypa/cibuildwheel@v2.22.0
46+
uses: pypa/cibuildwheel@v2.23.3
2647
env:
2748
CIBW_BUILD: cp3*-*
2849
CIBW_SKIP: pp* *i686* *musllinux* *-macosx_universal2 *-manylinux_ppc64le *-manylinux_s390x
@@ -31,8 +52,6 @@ jobs:
3152
CIBW_ARCHS_MACOS: x86_64 arm64
3253
CIBW_ARCHS_WINDOWS: auto64
3354
CIBW_BEFORE_ALL_LINUX: yum install -y ninja-build python3-devel
34-
CIBW_BEFORE_ALL_WINDOWS: choco install ninja
35-
CIBW_BEFORE_ALL_MACOS: brew install ninja
3655
# Needed on Windows CI to compile with Visual Studio compiler
3756
# otherwise Meson detects a MINGW64 platform and use MINGW64
3857
# toolchain

.github/workflows/static.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Static
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
static:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: prefix-dev/[email protected]
13+
with:
14+
environments: static
15+
cache: true
16+
17+
- name: Re-install local
18+
run: |
19+
pixi reinstall -e static --frozen fastcan
20+
21+
- name: Linter
22+
run: |
23+
pixi run lint
24+
- name: Lint Cython
25+
run: |
26+
pixi run cython-lint
27+
- name: Formatter
28+
run: |
29+
pixi run fmt
30+
- name: Type check
31+
run: |
32+
pixi run type
33+
- name: Spell check
34+
run: |
35+
pixi run spell

.github/workflows/test.yml

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,30 @@ on:
88
branches: ["*.X"]
99

1010
jobs:
11+
call-lint:
12+
uses: ./.github/workflows/static.yml
13+
1114
test:
12-
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-latest, windows-latest, macos-latest]
19+
runs-on: ${{ matrix.os }}
1320

1421
steps:
1522
- uses: actions/checkout@v4
16-
- uses: prefix-dev/[email protected].3
23+
- uses: prefix-dev/[email protected].8
1724
with:
18-
environments: default
25+
environments: dev
1926
cache: true
2027

2128
- name: Re-install local
2229
run: |
23-
pixi run rebuild
30+
# Needed on Windows CI to compile with Visual Studio compiler
31+
# otherwise Meson detects a MINGW64 platform and use MINGW64
32+
# toolchain
33+
pixi reinstall -e dev --frozen fastcan -- -Csetup-args=--vsenv
2434
25-
- name: Lint with ruff
26-
run: |
27-
pixi run lint
28-
- name: Lint with cython-lint
29-
run: |
30-
pixi run cython-lint
31-
- name: Format with black
32-
run: |
33-
pixi run fmt
34-
- name: Type check with mypy
35-
run: |
36-
pixi run type
3735
- name: Test with pytest
3836
run: |
3937
pixi run test
@@ -42,19 +40,16 @@ jobs:
4240
run: |
4341
pixi run doc
4442
CMD=doctest pixi run doc
43+
- name: Test nogil
44+
run: |
45+
pixi run nogil-eta
4546
- name: Test coverage
47+
if: runner.os == 'Linux'
4648
shell: bash
4749
run: |
4850
FMT=xml pixi run test-coverage
4951
- name: Upload coverage reports to Codecov
52+
if: runner.os == 'Linux'
5053
uses: codecov/codecov-action@v5
5154
with:
5255
token: ${{ secrets.CODECOV_TOKEN }}
53-
- name: Build SDist
54-
run: |
55-
pixi run build-sdist
56-
- name: Store artifacts
57-
uses: actions/upload-artifact@v4
58-
with:
59-
name: cibw-sdist
60-
path: dist/*.tar.gz

doc/multioutput.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ MIMO (Multi-Input Multi-Output) data. For classification, it can be used for
1212
multilabel data. Actually, for multiclass classification, which has one output with
1313
multiple categories, multioutput feature selection can also be useful. The multiclass
1414
classification can be converted to multilabel classification by one-hot encoding
15-
target ``y``. The cannonical correaltion coefficient between the features ``X`` and the
15+
target ``y``. The canonical correaltion coefficient between the features ``X`` and the
1616
one-hot encoded target ``y`` has equivalent relationship with Fisher's criterion in
1717
LDA (Linear Discriminant Analysis) [1]_. Applying :class:`FastCan` to the converted
1818
multioutput data may result in better accuracy in the following classification task

doc/narx.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ It should also be noted the different types of predictions in model training.
8282
ARX and OE model
8383
----------------
8484

85-
To better understant the two types of training, it is helpful to know two linear time series model structures,
85+
To better understand the two types of training, it is helpful to know two linear time series model structures,
8686
i.e., `ARX (AutoRegressive eXogenous) model <https://www.mathworks.com/help/ident/ref/arx.html>`_ and
8787
`OE (output error) model <https://www.mathworks.com/help/ident/ref/oe.html>`_.
8888

doc/ols_and_omp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The detailed difference between OLS and OMP can be found in [3]_.
1212
Here, let's briefly compare the three methods.
1313

1414

15-
Assume we have a feature matrix :math:`X_s \in \mathbb{R}^{N\times t}`, which constains
15+
Assume we have a feature matrix :math:`X_s \in \mathbb{R}^{N\times t}`, which contains
1616
:math:`t` selected features, and a target vector :math:`y \in \mathbb{R}^{N\times 1}`.
1717
Then the residual :math:`r \in \mathbb{R}^{N\times 1}` of the least-squares can be
1818
found by

doc/pruning.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ should be selected, as any additional samples can be represented by linear combi
2222
Therefore, the number to select has to be set to small.
2323

2424
To solve this problem, we use :func:`minibatch` to loose the redundancy check of :class:`FastCan`.
25-
The original :class:`FastCan` checks the redunancy within :math:`X_s \in \mathbb{R}^{n\times t}`,
25+
The original :class:`FastCan` checks the redundancy within :math:`X_s \in \mathbb{R}^{n\times t}`,
2626
which contains :math:`t` selected samples and n features,
27-
and the redunancy within :math:`Y \in \mathbb{R}^{n\times m}`, which contains :math:`m` atoms :math:`y_i`.
27+
and the redundancy within :math:`Y \in \mathbb{R}^{n\times m}`, which contains :math:`m` atoms :math:`y_i`.
2828
:func:`minibatch` ranks samples with multiple correlation coefficients between :math:`X_b \in \mathbb{R}^{n\times b}` and :math:`y_i`,
2929
where :math:`b` is batch size and :math:`b <= t`, instead of canonical correlation coefficients between :math:`X_s` and :math:`Y`,
3030
which is used in :class:`FastCan`.

examples/plot_fisher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
.. currentmodule:: fastcan
77
8-
In this examples, we will demonstrate the cannonical correaltion coefficient
8+
In this examples, we will demonstrate the canonical correaltion coefficient
99
between the features ``X`` and the one-hot encoded target ``y`` has equivalent
1010
relationship with Fisher's criterion in LDA (Linear Discriminant Analysis).
1111
"""

examples/plot_intuitive.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
# the predicted target by a linear regression model) and the target to describe its
2323
# usefulness, the results are shown in the following figure. It can be seen that
2424
# Feature 2 is the most useful and Feature 8 is the second. However, does that mean
25-
# that the total usefullness of Feature 2 + Feature 8 is the sum of their R-squared
25+
# that the total usefulness of Feature 2 + Feature 8 is the sum of their R-squared
2626
# scores? Probably not, because there may be redundancy between Feature 2 and Feature 8.
2727
# Actually, what we want is a kind of usefulness score which has the **superposition**
28-
# property, so that the usefullness of each feature can be added together without
28+
# property, so that the usefulness of each feature can be added together without
2929
# redundancy.
3030

3131
import matplotlib.pyplot as plt
@@ -125,7 +125,7 @@ def plot_bars(ids, r2_left, r2_selected):
125125
# Select the third feature
126126
# ------------------------
127127
# Again, let's compute the R-squared between Feature 2 + Feature 8 + Feature i and
128-
# the target, and the additonal R-squared contributed by the rest of the features is
128+
# the target, and the additional R-squared contributed by the rest of the features is
129129
# shown in following figure. It can be found that after selecting Features 2 and 8, the
130130
# rest of the features can provide a very limited contribution.
131131

@@ -145,8 +145,8 @@ def plot_bars(ids, r2_left, r2_selected):
145145
# at the RHS of the dashed lines. The fast computational speed is achieved by
146146
# orthogonalization, which removes the redundancy between the features. We use the
147147
# orthogonalization first to makes the rest of features orthogonal to the selected
148-
# features and then compute their additonal R-squared values. ``eta-cosine`` uses
149-
# the samilar idea, but has an additonal preprocessing step to compress the features
148+
# features and then compute their additional R-squared values. ``eta-cosine`` uses
149+
# the similar idea, but has an additional preprocessing step to compress the features
150150
# :math:`X \in \mathbb{R}^{N\times n}` and the target
151151
# :math:`X \in \mathbb{R}^{N\times n}` to :math:`X_c \in \mathbb{R}^{(m+n)\times n}`
152152
# and :math:`Y_c \in \mathbb{R}^{(m+n)\times m}`.

0 commit comments

Comments
 (0)