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 2, 2024
1 parent 916c37f commit 9799243
Show file tree
Hide file tree
Showing 47 changed files with 824 additions and 1,231 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
73 changes: 73 additions & 0 deletions docs/src/sg_execution_times.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

:orphan:

.. _sphx_glr_sg_execution_times:


Computation times
=================
**01:30.435** total execution time for 13 files **from all galleries**:

.. container::

.. raw:: html

<style scoped>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap5.min.css" rel="stylesheet" />
</style>
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap5.min.js"></script>
<script type="text/javascript" class="init">
$(document).ready( function () {
$('table.sg-datatable').DataTable({order: [[1, 'desc']]});
} );
</script>

.. list-table::
:header-rows: 1
:class: table table-striped sg-datatable

* - Example
- Time
- Mem (MB)
* - :ref:`sphx_glr_examples_regression_Ridge2FoldCVRegularization.py` (``../../examples/regression/Ridge2FoldCVRegularization.py``)
- 01:25.321
- 0.0
* - :ref:`sphx_glr_examples_reconstruction_PlotLFRE.py` (``../../examples/reconstruction/PlotLFRE.py``)
- 00:02.805
- 0.0
* - :ref:`sphx_glr_examples_regression_OrthogonalRegressionNonAnalytic.py` (``../../examples/regression/OrthogonalRegressionNonAnalytic.py``)
- 00:01.885
- 0.0
* - :ref:`sphx_glr_examples_reconstruction_PlotPointwiseGFRE.py` (``../../examples/reconstruction/PlotPointwiseGFRE.py``)
- 00:00.268
- 0.0
* - :ref:`sphx_glr_examples_reconstruction_PlotGFRE.py` (``../../examples/reconstruction/PlotGFRE.py``)
- 00:00.156
- 0.0
* - :ref:`sphx_glr_examples_pcovr_PCovR-WHODataset.py` (``../../examples/pcovr/PCovR-WHODataset.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_examples_pcovr_PCovR.py` (``../../examples/pcovr/PCovR.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_examples_pcovr_PCovR_Regressors.py` (``../../examples/pcovr/PCovR_Regressors.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_examples_pcovr_PCovR_Scaling.py` (``../../examples/pcovr/PCovR_Scaling.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_examples_selection_FeatureSelection-WHODataset.py` (``../../examples/selection/FeatureSelection-WHODataset.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_examples_selection_FeatureSelection.py` (``../../examples/selection/FeatureSelection.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_examples_selection_GCH-ROY.py` (``../../examples/selection/GCH-ROY.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_examples_selection_Selectors-Pipelines.py` (``../../examples/selection/Selectors-Pipelines.py``)
- 00:00.000
- 0.0
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 9799243

Please sign in to comment.