Skip to content

Commit

Permalink
Updated naive_cvmatrix to also account for float epsilon in std compa…
Browse files Browse the repository at this point in the history
…rison.
  • Loading branch information
sm00thix committed Jul 16, 2024
1 parent 7db0c5b commit 120f3b9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cvmatrix/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.2'
__version__ = '1.0.2.post1'
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.2"
version = "1.0.2.post1"
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
4 changes: 2 additions & 2 deletions tests/naive_cvmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def _training_matrices(
X_train = X_train - X_train_mean
if self.scale_X:
X_train_std = X_train.std(axis=0, ddof=1, keepdims=True)
X_train_std[X_train_std == 0] = 1
X_train_std[X_train_std <= self.eps] = 1
X_train = X_train / X_train_std
if return_XTY:
Y_train = self.Y_total[training_indices]
Expand All @@ -148,7 +148,7 @@ def _training_matrices(
Y_train = Y_train - Y_train_mean
if self.scale_Y:
Y_train_std = Y_train.std(axis=0, ddof=1, keepdims=True)
Y_train_std[Y_train_std == 0] = 1
Y_train_std[Y_train_std <= self.eps] = 1
Y_train = Y_train / Y_train_std
if return_XTX and return_XTY:
return X_train.T @ X_train, X_train.T @ Y_train
Expand Down

0 comments on commit 120f3b9

Please sign in to comment.