Skip to content

Commit f75c51a

Browse files
Render math without # noqa: W605 comment (#161)
* Fix typo in skmatter/metrics/_reconstruction_measures.py --------- Co-authored-by: agoscinski <[email protected]>
1 parent 0da1520 commit f75c51a

File tree

3 files changed

+34
-14
lines changed

3 files changed

+34
-14
lines changed

skmatter/linear_model/_base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88

99

1010
class OrthogonalRegression(MultiOutputMixin, RegressorMixin):
11-
"""Orthogonal regression by solving the Procrustes problem
11+
r"""Orthogonal regression by solving the Procrustes problem
1212
1313
Linear regression with the additional constraint that the weight matrix
1414
must be an orthogonal matrix/projection. It minimizes the Procrustes
1515
problem:
1616
17-
:math:`\min_\Omega ||y - X\Omega\||_F \quad\mathrm{subject\ to}\quad \Omega^T\Omega=I` % # noqa: W605
17+
.. math::
18+
19+
\min_\Omega ||y - X\Omega\||_F \quad\mathrm{subject\ to}\quad \Omega^T\Omega=I
1820
1921
Parameters
2022
----------

skmatter/linear_model/_ridge.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ class RidgeRegression2FoldCV(MultiOutputMixin, RegressorMixin):
1515
r"""Ridge regression with an efficient 2-fold cross-validation method using the SVD solver.
1616
Minimizes the objective function:
1717
18-
:math: \|y - Xw\|^2_2 + \alpha \|w\|^2_2, % # noqa: W605
18+
.. math::
19+
20+
\|y - Xw\|^2_2 + \alpha \|w\|^2_2,
1921
2022
while the alpha value is determined with a 2-fold cross-validation from a list of
2123
alpha values. It is more efficient than doing a 2-fold cross-validation using

skmatter/metrics/_reconstruction_measures.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ def pointwise_global_reconstruction_error(
2020
scaler=None,
2121
estimator=None,
2222
):
23-
"""Computes the pointwise global reconstruction error using the source X
23+
r"""Computes the pointwise global reconstruction error using the source X
2424
to reconstruct the features or samples of target Y based on a minimization
2525
by linear regression:
2626
27-
:math:`GRE^{(i)}(X,Y) = \min_W ||y_i - x_iW||` % # noqa: W605
27+
.. math::
28+
29+
GRE^{(i)}(X,Y) = \min_W ||y_i - x_iW||
2830
2931
If used with X and Y of shape (n_samples, n_features) it computes the pointwise
3032
global reconstruction error of the features as defined in Ref. [Goscinski2021]_.
@@ -109,11 +111,13 @@ def global_reconstruction_error(
109111
scaler=None,
110112
estimator=None,
111113
):
112-
"""Computes the global reconstruction error using the source X
114+
r"""Computes the global reconstruction error using the source X
113115
to reconstruct the features or samples of target Y based on a minimization
114116
by linear regression:
115117
116-
:math:`GRE(X,Y) = \min_W ||Y - XW||`` % # noqa: W605
118+
.. math::
119+
120+
GRE(X,Y) = \min_W ||Y - XW||
117121
118122
If used with X and Y of shape (n_samples, n_features) it computes the
119123
global reconstruction error of the features as defined in Ref. [Goscinski2021]_.
@@ -186,11 +190,13 @@ def pointwise_global_reconstruction_distortion(
186190
scaler=None,
187191
estimator=None,
188192
):
189-
"""Computes the pointwise global reconstruction distortion using the source X
193+
r"""Computes the pointwise global reconstruction distortion using the source X
190194
to reconstruct the features or samples of target Y based on a minimization
191195
by orthogonal regression:
192196
193-
:math:`GRD^{(i)}(X,Y) = \min_Q ||y_i - x_iQ\|| \quad\mathrm{subject\ to}\quad Q^TQ=I` % # noqa: W605
197+
.. math::
198+
199+
GRD^{(i)}(X,Y) = \min_Q ||y_i - x_iQ\|| \quad\mathrm{subject\ to}\quad Q^TQ=I
194200
195201
If used with X and Y of shape (n_samples, n_features) it computes the pointwise
196202
global reconstruction distortion of the features as defined in Ref. [Goscinski2021]_.
@@ -280,11 +286,13 @@ def global_reconstruction_distortion(
280286
scaler=None,
281287
estimator=None,
282288
):
283-
"""Computes the global reconstruction distortion using the source X
289+
r"""Computes the global reconstruction distortion using the source X
284290
to reconstruct the features or samples of target Y based on a minimization
285291
by orthogonal regression:
286292
287-
:math:`GRD(X,Y) = \min_Q ||y - XQ\|| \quad\mathrm{subject\ to}\quad Q^TQ=I` % # noqa: W605
293+
.. math::
294+
295+
GRD(X,Y) = \min_Q ||y - XQ\|| \quad\mathrm{subject\ to}\quad Q^TQ=I
288296
289297
If used with X and Y of shape (n_samples, n_features) it computes the
290298
global reconstruction distortion of the features as defined in Ref. [Goscinski2021]_.
@@ -363,8 +371,14 @@ def pointwise_local_reconstruction_error(
363371
to reconstruct the features or samples of target Y based on a minimization
364372
by linear regression:
365373
366-
:math:`\tilde{\mathbf{x}}'_i = \bar{\mathbf{x}} + (\mathbf{x}_i - \bar{\mathbf{x}})\mathbf{P}^{(i)}` % # noqa: W605
367-
:math:`LRE^{(i)}(X,Y) = \|\mathbf{x}'_i - \tilde{\mathbf{x}}'_i\|^2` % # noqa: W605
374+
.. math::
375+
376+
\tilde{\mathbf{x}}'_i = \bar{\mathbf{x}} + (\mathbf{x}_i
377+
- \bar{\mathbf{x}})\mathbf{P}^{(i)}
378+
379+
.. math::
380+
381+
LRE^{(i)}(X,Y) = \|\mathbf{x}'_i - \tilde{\mathbf{x}}'_i\|^2
368382
369383
If used with X and Y of shape (n_samples, n_features) it computes the pointwise
370384
local reconstruction error of the features as defined in Ref. [Goscinski2021]_.
@@ -493,7 +507,9 @@ def local_reconstruction_error(
493507
to reconstruct the features or samples of target Y based on a minimization
494508
by linear regression:
495509
496-
:math:`LRE(X,Y) = \sqrt{\sum_i LRE^{(i)}(X,Y)}/\sqrt{n_\text{test}}` % # noqa: W605
510+
.. math::
511+
512+
LRE(X,Y) = \sqrt{\sum_i LRE^{(i)}(X,Y)}/\sqrt{n_\text{test}}
497513
498514
If used with X and Y of shape (n_samples, n_features) it computes the
499515
local reconstruction error of the features as defined in Ref. [Goscinski2021]_.

0 commit comments

Comments
 (0)