Skip to content

Commit

Permalink
Updated comparison between std and 0 to have a machine epsilon margin…
Browse files Browse the repository at this point in the history
…. Also separated some GitHub Actions workflows and updated README badges accordingly.
  • Loading branch information
sm00thix committed Jul 9, 2024
1 parent f7a20b3 commit 4ec5dc2
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 82 deletions.
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
32 changes: 0 additions & 32 deletions .github/workflows/pull_request.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/pull_request_package_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Pull Request Python Package

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

jobs:
build_package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build
25 changes: 25 additions & 0 deletions .github/workflows/pull_request_test_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Pull Request Tests

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

jobs:
test_package:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
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 }}
25 changes: 25 additions & 0 deletions .github/workflows/test_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Tests

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

jobs:
test_package:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
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 }}
46 changes: 0 additions & 46 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/cvmatrix/badge/?version=latest)](https://cvmatrix.readthedocs.io/en/latest/?badge=latest)

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

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

The [`cvmatrix`](https://pypi.org/project/cvmatrix/) package implements the fast algorithms by Engstrøm [[1]](#references) for computation of training set $\mathbf{X}^{\mathbf{T}}\mathbf{X}$ and $\mathbf{X}^{\mathbf{T}}\mathbf{Y}$ in a cross-validation setting. In addition to correctly handling arbitrary row-wise pre-processing, the algorithms allow for and efficiently and correctly handle any combination of column-wise centering and scaling of `X` and `Y` based on training set statistics.

Expand Down
2 changes: 1 addition & 1 deletion cvmatrix/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.1'
__version__ = '1.0.2'
3 changes: 2 additions & 1 deletion cvmatrix/cvmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def __init__(
self.scale_Y = scale_Y
self.dtype = dtype
self.copy = copy
self.eps = np.finfo(dtype).eps
self.X_total = None
self.Y_total = None
self.N = None
Expand Down Expand Up @@ -533,7 +534,7 @@ def _compute_training_mat_std(
+ train_sum_sq_mat
)
)
mat_train_std[mat_train_std == 0] = 1
mat_train_std[np.abs(mat_train_std) <= self.eps] = 1
return mat_train_std

def _init_mat(self, mat: np.ndarray) -> np.ndarray:
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 = "cvmatrix"
version = "1.0.1"
version = "1.0.2"
description = "Fast computation of possibly centered/scaled training set kernel matrices in a cross-validation setting."
authors = ["Sm00thix <oleemail@icloud.com>"]
maintainers = ["Sm00thix <oleemail@icloud.com>"]
Expand Down

0 comments on commit 4ec5dc2

Please sign in to comment.