Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render math without # noqa: W605 comment #161

Merged
merged 2 commits into from
Mar 9, 2023
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
6 changes: 4 additions & 2 deletions skmatter/linear_model/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@


class OrthogonalRegression(MultiOutputMixin, RegressorMixin):
"""Orthogonal regression by solving the Procrustes problem
r"""Orthogonal regression by solving the Procrustes problem

Linear regression with the additional constraint that the weight matrix
must be an orthogonal matrix/projection. It minimizes the Procrustes
problem:

:math:`\min_\Omega ||y - X\Omega\||_F \quad\mathrm{subject\ to}\quad \Omega^T\Omega=I` % # noqa: W605
.. math::

\min_\Omega ||y - X\Omega\||_F \quad\mathrm{subject\ to}\quad \Omega^T\Omega=I

Parameters
----------
Expand Down
4 changes: 3 additions & 1 deletion skmatter/linear_model/_ridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ class RidgeRegression2FoldCV(MultiOutputMixin, RegressorMixin):
r"""Ridge regression with an efficient 2-fold cross-validation method using the SVD solver.
Minimizes the objective function:

:math: \|y - Xw\|^2_2 + \alpha \|w\|^2_2, % # noqa: W605
.. math::

\|y - Xw\|^2_2 + \alpha \|w\|^2_2,

while the alpha value is determined with a 2-fold cross-validation from a list of
alpha values. It is more efficient than doing a 2-fold cross-validation using
Expand Down
38 changes: 27 additions & 11 deletions skmatter/metrics/_reconstruction_measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ def pointwise_global_reconstruction_error(
scaler=None,
estimator=None,
):
"""Computes the pointwise global reconstruction error using the source X
r"""Computes the pointwise global reconstruction error using the source X
to reconstruct the features or samples of target Y based on a minimization
by linear regression:

:math:`GRE^{(i)}(X,Y) = \min_W ||y_i - x_iW||` % # noqa: W605
.. math::

GRE^{(i)}(X,Y) = \min_W ||y_i - x_iW||

If used with X and Y of shape (n_samples, n_features) it computes the pointwise
global reconstruction error of the features as defined in Ref. [Goscinski2021]_.
Expand Down Expand Up @@ -109,11 +111,13 @@ def global_reconstruction_error(
scaler=None,
estimator=None,
):
"""Computes the global reconstruction error using the source X
r"""Computes the global reconstruction error using the source X
to reconstruct the features or samples of target Y based on a minimization
by linear regression:

:math:`GRE(X,Y) = \min_W ||Y - XW||`` % # noqa: W605
.. math::

GRE(X,Y) = \min_W ||Y - XW||

If used with X and Y of shape (n_samples, n_features) it computes the
global reconstruction error of the features as defined in Ref. [Goscinski2021]_.
Expand Down Expand Up @@ -186,11 +190,13 @@ def pointwise_global_reconstruction_distortion(
scaler=None,
estimator=None,
):
"""Computes the pointwise global reconstruction distortion using the source X
r"""Computes the pointwise global reconstruction distortion using the source X
to reconstruct the features or samples of target Y based on a minimization
by orthogonal regression:

:math:`GRD^{(i)}(X,Y) = \min_Q ||y_i - x_iQ\|| \quad\mathrm{subject\ to}\quad Q^TQ=I` % # noqa: W605
.. math::

GRD^{(i)}(X,Y) = \min_Q ||y_i - x_iQ\|| \quad\mathrm{subject\ to}\quad Q^TQ=I

If used with X and Y of shape (n_samples, n_features) it computes the pointwise
global reconstruction distortion of the features as defined in Ref. [Goscinski2021]_.
Expand Down Expand Up @@ -280,11 +286,13 @@ def global_reconstruction_distortion(
scaler=None,
estimator=None,
):
"""Computes the global reconstruction distortion using the source X
r"""Computes the global reconstruction distortion using the source X
to reconstruct the features or samples of target Y based on a minimization
by orthogonal regression:

:math:`GRD(X,Y) = \min_Q ||y - XQ\|| \quad\mathrm{subject\ to}\quad Q^TQ=I` % # noqa: W605
.. math::

GRD(X,Y) = \min_Q ||y - XQ\|| \quad\mathrm{subject\ to}\quad Q^TQ=I

If used with X and Y of shape (n_samples, n_features) it computes the
global reconstruction distortion of the features as defined in Ref. [Goscinski2021]_.
Expand Down Expand Up @@ -363,8 +371,14 @@ def pointwise_local_reconstruction_error(
to reconstruct the features or samples of target Y based on a minimization
by linear regression:

:math:`\tilde{\mathbf{x}}'_i = \bar{\mathbf{x}} + (\mathbf{x}_i - \bar{\mathbf{x}})\mathbf{P}^{(i)}` % # noqa: W605
:math:`LRE^{(i)}(X,Y) = \|\mathbf{x}'_i - \tilde{\mathbf{x}}'_i\|^2` % # noqa: W605
.. math::

\tilde{\mathbf{x}}'_i = \bar{\mathbf{x}} + (\mathbf{x}_i
- \bar{\mathbf{x}})\mathbf{P}^{(i)}

.. math::

LRE^{(i)}(X,Y) = \|\mathbf{x}'_i - \tilde{\mathbf{x}}'_i\|^2

If used with X and Y of shape (n_samples, n_features) it computes the pointwise
local reconstruction error of the features as defined in Ref. [Goscinski2021]_.
Expand Down Expand Up @@ -493,7 +507,9 @@ def local_reconstruction_error(
to reconstruct the features or samples of target Y based on a minimization
by linear regression:

:math:`LRE(X,Y) = \sqrt{\sum_i LRE^{(i)}(X,Y)}/\sqrt{n_\text{test}}` % # noqa: W605
.. math::

LRE(X,Y) = \sqrt{\sum_i LRE^{(i)}(X,Y)}/\sqrt{n_\text{test}}

If used with X and Y of shape (n_samples, n_features) it computes the
local reconstruction error of the features as defined in Ref. [Goscinski2021]_.
Expand Down