Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 4 additions & 51 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,64 +8,17 @@ on:
branches: ["main"]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
environments: default
cache: true

- name: Re-install local
run: |
pixi run rebuild

- name: Lint with ruff
run: |
pixi run lint
- name: Lint with cython-lint
run: |
pixi run cython-lint
- name: Format with black
run: |
pixi run fmt
- name: Type check with mypy
run: |
pixi run type
- name: Test with pytest
run: |
pixi run test
- name: Test with doctest
shell: bash
run: |
pixi run doc
CMD=doctest pixi run doc
- name: Test coverage
shell: bash
run: |
FMT=xml pixi run test-coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build SDist
run: |
pixi run build-sdist
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
call-test:
uses: ./.github/workflows/test.yml
secrets: inherit

build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
needs: test
needs: call-test
steps:
- uses: actions/checkout@v4
- name: Build wheels
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Test

on:
workflow_call:
push:
branches: ["*.X"]
pull_request:
branches: ["*.X"]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
environments: default
cache: true

- name: Re-install local
run: |
pixi run rebuild

- name: Lint with ruff
run: |
pixi run lint
- name: Lint with cython-lint
run: |
pixi run cython-lint
- name: Format with black
run: |
pixi run fmt
- name: Type check with mypy
run: |
pixi run type
- name: Test with pytest
run: |
pixi run test
- name: Test with doctest
shell: bash
run: |
pixi run doc
CMD=doctest pixi run doc
- name: Test coverage
shell: bash
run: |
FMT=xml pixi run test-coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build SDist
run: |
pixi run build-sdist
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
10 changes: 5 additions & 5 deletions examples/plot_pruning.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from sklearn.linear_model import LogisticRegression

data, labels = load_iris(return_X_y=True)
baseline_lr = LogisticRegression(max_iter=110).fit(data, labels)
baseline_lr = LogisticRegression(max_iter=1000).fit(data, labels)

# %%
# Random data pruning
Expand All @@ -40,7 +40,7 @@
def _random_pruning(X, y, n_samples_to_select: int, random_state: int):
rng = np.random.default_rng(random_state)
ids_random = rng.choice(y.size, n_samples_to_select, replace=False)
pruned_lr = LogisticRegression(max_iter=110).fit(X[ids_random], y[ids_random])
pruned_lr = LogisticRegression(max_iter=1000).fit(X[ids_random], y[ids_random])
return pruned_lr.coef_, pruned_lr.intercept_


Expand Down Expand Up @@ -72,9 +72,9 @@ def _fastcan_pruning(
).fit(X)
atoms = kmeans.cluster_centers_
ids_fastcan = minibatch(
X.T, atoms.T, n_samples_to_select, batch_size=batch_size, tol=1e-6, verbose=0
X.T, atoms.T, n_samples_to_select, batch_size=batch_size, verbose=0
)
pruned_lr = LogisticRegression(max_iter=110).fit(X[ids_fastcan], y[ids_fastcan])
pruned_lr = LogisticRegression(max_iter=1000).fit(X[ids_fastcan], y[ids_fastcan])
return pruned_lr.coef_, pruned_lr.intercept_


Expand Down Expand Up @@ -111,4 +111,4 @@ def plot_box(X, y, baseline, n_samples_to_select: int, n_random: int):
plt.show()


plot_box(data, labels, baseline_lr, n_samples_to_select=100, n_random=10)
plot_box(data, labels, baseline_lr, n_samples_to_select=100, n_random=100)
69 changes: 34 additions & 35 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.