Skip to content

Commit

Permalink
Changing workflows and adding badges in relation to #26 (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sm00thix authored Jun 20, 2024
1 parent e1c3922 commit 0c2ebab
Show file tree
Hide file tree
Showing 16 changed files with 176 additions and 122 deletions.
4 changes: 2 additions & 2 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ runs:
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 ikpls/ --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
flake8 ikpls/ --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
shell: bash

- name: Install IKPLS dependencies
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/package_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Python Package

on:
workflow_run:
workflows: ["Tests"]
types:
- completed

jobs:
build_package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build

publish_package:
needs: build_package
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/publish
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/p/ikpls
17 changes: 17 additions & 0 deletions .github/workflows/pull_request_package_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Pull Request Python Package

on:
pull_request:
branches: [ "main" ]
paths:
- 'ikpls/**'
- 'tests/**'
- '.github/**'
- 'pyproject.toml'

jobs:
build_package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package
name: Pull Request Tests

on:
pull_request:
branches: [ "main" ]
paths:
- 'ikpls/**'
- 'tests/**'
- '.github/**'
- 'pyproject.toml'

jobs:
Expand All @@ -23,10 +21,4 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/test
with:
PYTHON_VERSION: ${{ matrix.python-version }}

build_package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build
PYTHON_VERSION: ${{ matrix.python-version }}
24 changes: 24 additions & 0 deletions .github/workflows/test_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Tests

on:
push:
branches: [ "main" ]
paths:
- 'ikpls/**'
- 'tests/**'
- '.github/**'
- 'pyproject.toml'

jobs:
test_package:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-12]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/test
with:
PYTHON_VERSION: ${{ matrix.python-version }}
45 changes: 0 additions & 45 deletions .github/workflows/workflow.yml

This file was deleted.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

[![Documentation Status](https://readthedocs.org/projects/ikpls/badge/?version=latest)](https://ikpls.readthedocs.io/en/latest/?badge=latest)

[![Build Status](https://github.com/Sm00thix/IKPLS/actions/workflows/workflow.yml/badge.svg)](https://github.com/Sm00thix/IKPLS/actions/workflows/workflow.yml)
[![Tests Status](https://github.com/Sm00thix/IKPLS/actions/workflows/test_workflow.yml/badge.svg)](https://github.com/Sm00thix/IKPLS/actions/workflows/test_workflow.yml)

[![Package Status](https://github.com/Sm00thix/IKPLS/actions/workflows/package_workflow.yml/badge.svg)](https://github.com/Sm00thix/IKPLS/actions/workflows/package_workflow.yml)

[![JOSS Status](https://joss.theoj.org/papers/ac559cbcdc6e6551f58bb3e573a73afc/status.svg)](https://joss.theoj.org/papers/ac559cbcdc6e6551f58bb3e573a73afc)

Expand Down
3 changes: 2 additions & 1 deletion examples/fast_cross_val_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def mse_for_each_target(Y_true, Y_pred):
best_num_components = np.asarray(
[
[
np_pls_alg_1_fast_cv_results[split][f'num_components_lowest_mse_target_{i}']
np_pls_alg_1_fast_cv_results[split]
[f'num_components_lowest_mse_target_{i}']
for split in unique_splits
]
for i in range(M)
Expand Down
2 changes: 1 addition & 1 deletion ikpls/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.2.2.post2"
__version__ = "1.2.2.post3"
10 changes: 5 additions & 5 deletions ikpls/fast_cross_validation/numpy_ikpls.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ class PLS:
Whether to center `X` before fitting by subtracting its row of
column-wise means from each row. The row of column-wise means is computed on
the training set for each fold to avoid data leakage.
center_Y : bool, optional default=True
Whether to center `Y` before fitting by subtracting its row of
column-wise means from each row. The row of column-wise means is computed on
the training set for each fold to avoid data leakage.
scale_X : bool, optional default=True
Whether to scale `X` before fitting by dividing each row with the row of `X`'s
column-wise standard deviations. Bessel's correction for the unbiased estimate
of the sample standard deviation is used. The row of column-wise standard
deviations is computed on the training set for each fold to avoid data leakage.
scale_Y : bool, optional default=True
Whether to scale `Y` before fitting by dividing each row with the row of `X`'s
column-wise standard deviations. Bessel's correction for the unbiased estimate
Expand All @@ -64,7 +64,7 @@ class PLS:
------
ValueError
If `algorithm` is not 1 or 2.
Notes
-----
Any centering and scaling is undone before returning predictions to ensure that
Expand Down Expand Up @@ -482,7 +482,7 @@ def _stateless_predict(
predictions for that specific number of components is used. If
`n_components` is None, returns a prediction for each number of components
up to `A`.
Notes
-----
"""
Expand Down
8 changes: 4 additions & 4 deletions ikpls/jax_ikpls_alg_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class PLS(PLSBase):
center_X : bool, default=True
Whether to center `X` before fitting by subtracting its row of
column-wise means from each row.
center_Y : bool, default=True
Whether to center `Y` before fitting by subtracting its row of
column-wise means from each row.
scale_X : bool, default=True
Whether to scale `X` before fitting by dividing each row with the row of `X`'s
column-wise standard deviations. Bessel's correction for the unbiased estimate
Expand Down Expand Up @@ -413,11 +413,11 @@ def stateless_fit(
center_X : bool, default=True
Whether to center `X` before fitting by subtracting its row of
column-wise means from each row.
center_Y : bool, default=True
Whether to center `Y` before fitting by subtracting its row of
column-wise means from each row.
scale_X : bool, default=True
Whether to scale `X` before fitting by dividing each row with the row of
`X`'s column-wise standard deviations. Bessel's correction for the unbiased
Expand Down
8 changes: 4 additions & 4 deletions ikpls/jax_ikpls_alg_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class PLS(PLSBase):
center_X : bool, default=True
Whether to center `X` before fitting by subtracting its row of
column-wise means from each row.
center_Y : bool, default=True
Whether to center `Y` before fitting by subtracting its row of
column-wise means from each row.
scale_X : bool, default=True
Whether to scale `X` before fitting by dividing each row with the row of `X`'s
column-wise standard deviations. Bessel's correction for the unbiased estimate
Expand Down Expand Up @@ -389,11 +389,11 @@ def stateless_fit(
center_X : bool, default=True
Whether to center `X` before fitting by subtracting its row of
column-wise means from each row.
center_Y : bool, default=True
Whether to center `Y` before fitting by subtracting its row of
column-wise means from each row.
scale_X : bool, default=True
Whether to scale `X` before fitting by dividing each row with the row of
`X`'s column-wise standard deviations. Bessel's correction for the unbiased
Expand Down
14 changes: 7 additions & 7 deletions ikpls/jax_ikpls_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Implementations of concrete classes exist for both Improved Kernel PLS Algorithm #1
and Improved Kernel PLS Algorithm #2.
For more details, refer to the paper:
For more details, refer to the paper:
"Improved Kernel Partial Least Squares Regression" by Dayal and MacGregor.
Author: Ole-Christian Galbo Engstrøm
Expand Down Expand Up @@ -669,11 +669,11 @@ def stateless_fit(
center_X : bool, default=True
Whether to center `X` before fitting by subtracting its row of
column-wise means from each row.
center_Y : bool, default=True
Whether to center `Y` before fitting by subtracting its row of
column-wise means from each row.
scale_X : bool, default=True
Whether to scale `X` before fitting by dividing each row with the row of
`X`'s column-wise standard deviations. Bessel's correction for the unbiased
Expand Down Expand Up @@ -949,11 +949,11 @@ def stateless_fit_predict_eval(
center_X : bool, default=True
Whether to center `X` before fitting by subtracting its row of
column-wise means from each row.
center_Y : bool, default=True
Whether to center `Y` before fitting by subtracting its row of
column-wise means from each row.
scale_X : bool, default=True
Whether to scale `X` before fitting by dividing each row with the row of
`X`'s column-wise standard deviations. Bessel's correction for the unbiased
Expand Down Expand Up @@ -1167,11 +1167,11 @@ def _inner_cross_validate(
center_X : bool, default=True
Whether to center `X` before fitting by subtracting its row of
column-wise means from each row.
center_Y : bool, default=True
Whether to center `Y` before fitting by subtracting its row of
column-wise means from each row.
scale_X : bool, default=True
Whether to scale `X` before fitting by dividing each row with the row of
`X`'s column-wise standard deviations. Bessel's correction for the unbiased
Expand Down
6 changes: 3 additions & 3 deletions ikpls/numpy_ikpls.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class PLS(BaseEstimator):
----------
algorithm : int, default=1
Whether to use Improved Kernel PLS Algorithm #1 or #2.
center_X : bool, default=True
Whether to center `X` before fitting by subtracting its row of
column-wise means from each row.
center_Y : bool, default=True
Whether to center `Y` before fitting by subtracting its row of
column-wise means from each row.
scale_X : bool, default=True
Whether to scale `X` before fitting by dividing each row with the row of `X`'s
column-wise standard deviations. Bessel's correction for the unbiased estimate
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ikpls"
version = "1.2.2.post2"
version = "1.2.2.post3"
description = "Improved Kernel PLS and Fast Cross-Validation."
authors = ["Sm00thix <oleemail@icloud.com>"]
maintainers = ["Sm00thix <oleemail@icloud.com>"]
Expand Down
Loading

0 comments on commit 0c2ebab

Please sign in to comment.