Skip to content

Commit

Permalink
Cleanup docstrings and add basic docs-linter
Browse files Browse the repository at this point in the history
  • Loading branch information
PicoCentauri committed May 3, 2024
1 parent bd54517 commit 4662d5b
Show file tree
Hide file tree
Showing 47 changed files with 906 additions and 1,465 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ __pycache__
build/
dist/
docs/src/examples
sg_execution_times.rst
21 changes: 10 additions & 11 deletions examples/reconstruction/PlotGFRE.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@
"""
Global Feature Reconstruction Error (GFRE) and Distortion (GFRD)
================================================================
Example for the usage of the :class:`skmatter.metrics.global_reconstruction_error`
as global feature reconstruction error (GFRE) and
Example for the usage of the :class:`skmatter.metrics.global_reconstruction_error` as
global feature reconstruction error (GFRE) and
:class:`skmatter.metrics.global_reconstruction_distortion` global feature reconstruction
distortion (GFRD). We apply the global reconstruction measures on the degenerate
CH4 manifold dataset. This dataset was specifically constructed to be
representable by a 4-body features (bispectrum) but not by a 3-body features
(power spectrum). In other words the dataset contains environments which are
different, but have the same 3-body features. For more details about the dataset
please refer to `Pozdnyakov 2020 <https://doi.org/10.1103/PhysRevLett.125.166001>`_.
distortion (GFRD). We apply the global reconstruction measures on the degenerate CH4
manifold dataset. This dataset was specifically constructed to be representable by a
4-body features (bispectrum) but not by a 3-body features (power spectrum). In other
words the dataset contains environments which are different, but have the same 3-body
features. For more details about the dataset please refer to `Pozdnyakov 2020
<https://doi.org/10.1103/PhysRevLett.125.166001>`_.
The ``skmatter`` dataset already contains the 3 and 4-body features computed with
`librascal <https://github.com/lab-cosmo/librascal>`_ so we can load it and
compare it with the GFRE/GFRD.
`librascal <https://github.com/lab-cosmo/librascal>`_ so we can load it and compare it
with the GFRE/GFRD.
"""
# %%
#
Expand Down
7 changes: 3 additions & 4 deletions examples/reconstruction/PlotLFRE.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""
Pointwise Local Reconstruction Error
====================================
Example for the usage of the
:class:`skmatter.metrics.pointwise_local_reconstruction_error` as pointwise local
reconstruction error (LFRE) on the degenerate CH4 manifold. We apply the local
Expand All @@ -14,9 +13,9 @@
dataset please refer to `Pozdnyakov 2020
<https://doi.org/10.1103/PhysRevLett.125.166001>`_.
The skmatter dataset already contains the 3 and 4-body features computed with
`librascal <https://github.com/lab-cosmo/librascal>`_ so we can load it and compare it
with the LFRE.
The skmatter dataset already contains the 3 and 4-body features computed with `librascal
<https://github.com/lab-cosmo/librascal>`_ so we can load it and compare it with the
LFRE.
"""
# %%
#
Expand Down
3 changes: 1 addition & 2 deletions examples/reconstruction/PlotPointwiseGFRE.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

"""
Pointwise GFRE applied on RKHS features
================================================================
=======================================
Example for the usage of the
:class:`skmatter.metrics.pointwise_global_reconstruction_error` as the pointwise global
feature reconstruction error (pointwise GFRE). We apply the pointwise global feature
Expand Down
1 change: 0 additions & 1 deletion examples/regression/OrthogonalRegressionNonAnalytic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
r"""
Regression with orthogonal projector/matrices
=============================================
In this example, we explain how when using
:class:`skmatter.linear_model.OrthogonalRegression` the option
``use_orthogonal_projector`` can result in non-analytic behavior. In
Expand Down
20 changes: 10 additions & 10 deletions examples/regression/Ridge2FoldCVRegularization.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# %%

r"""
Ridge2FoldCV for data with low effective rank
=======================================================
In this notebook we explain in more detail how
:class:`skmatter.linear_model.Ridge2FoldCV` speeds up the
cross-validation optimizing the regularitzation parameter :param alpha: and
compare it with existing solution for that in scikit-learn
:class:`slearn.linear_model.RidgeCV`.
:class:`skmatter.linear_model.Ridge2FoldCV` was designed to predict
efficiently feature matrices, but it can be also useful for the prediction
single targets.
Ridge2FoldCV for data with low effective rank
=============================================
In this notebook we explain in more detail how
:class:`skmatter.linear_model.Ridge2FoldCV` speeds up the cross-validation optimizing
the regularitzation parameter :param alpha: and compare it with existing solution for
that in scikit-learn :class:`slearn.linear_model.RidgeCV`.
:class:`skmatter.linear_model.Ridge2FoldCV` was designed to predict efficiently feature
matrices, but it can be also useful for the prediction single targets.
"""
# %%
#
Expand Down Expand Up @@ -128,6 +126,7 @@


def micro_bench(ridge):
"""A small benchmark function."""
global N_REPEAT_MICRO_BENCH, X, y
timings = []
train_mse = []
Expand Down Expand Up @@ -177,6 +176,7 @@ def micro_bench(ridge):


def get_train_test_error(estimator):
"""The train tets error based on the estimator."""
global X_train, y_train, X_test, y_test
estimator = estimator.fit(X_train, y_train)
return (
Expand Down
Loading

0 comments on commit 4662d5b

Please sign in to comment.