Skip to content
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
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ include develop.txt
include docs/requirements.txt
include README.rst
include LICENSE.txt
include docs/source/modopt_logo.png
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ModOpt

<img width=400 src="docs/source/modopt_logo.png">
<img width=400 src="https://raw.githubusercontent.com/CEA-COSMIC/ModOpt/master/docs/source/modopt_logo.png">

| Usage | Development | Release |
| ----- | ----------- | ------- |
Expand Down
1 change: 1 addition & 0 deletions develop.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
coverage>=5.5
flake8<4
nose>=1.3.7
pytest>=6.2.2
pytest-cov>=2.11.1
Expand Down
5 changes: 3 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
jupyter==1.0.0
myst-parser==0.16.0
nbsphinx==0.8.7
nbsphinx-link==1.3.0
numpydoc==1.1.0
sphinx==4.3.0
sphinx==4.3.1
sphinxcontrib-bibtex==2.4.1
sphinxawesome-theme==3.2.0
sphinxawesome-theme==3.2.1
13 changes: 8 additions & 5 deletions docs/source/about.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Contributors

You can find a |link-to-contributors|.

|CS_LOGO| |NS_LOGO|

.. |link-to-cosmic| raw:: html

<a href="http://cosmic.cosmostat.org/" target="_blank">COSMIC</a>
Expand All @@ -38,11 +40,12 @@ You can find a |link-to-contributors|.
<a href="https://github.com/CEA-COSMIC/ModOpt/graphs/contributors"
target="_blank">list of ModOpt contributors here</a>


.. image:: cosmostat_logo.jpg
:width: 300
.. |CS_LOGO| image:: cosmostat_logo.jpg
:width: 45%
:alt: CosmoStat Logo
:target: http://www.cosmostat.org/

.. image:: neurospin_logo.png
:width: 300
.. |NS_LOGO| image:: neurospin_logo.png
:width: 45%
:alt: NeuroSpin Logo
:target: https://joliot.cea.fr/drf/joliot/en/Pages/research_entities/NeuroSpin.aspx
35 changes: 31 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
'sphinx.ext.viewcode',
'sphinxawesome_theme',
'sphinxcontrib.bibtex',
'myst_parser',
'nbsphinx',
'nbsphinx_link',
'numpydoc',
Expand Down Expand Up @@ -95,12 +96,25 @@
html_theme_options = {
"nav_include_hidden": True,
"show_nav": True,
"show_breadcrumbs": False,
"breadcrumbs_separator": "/"
"show_breadcrumbs": True,
"breadcrumbs_separator": "/",
"show_prev_next": True,
"show_scrolltop": True,

}
html_collapsible_definitions = True


html_awesome_headerlinks = True
html_logo = 'modopt_logo.jpg'
html_permalinks_icon = (
'<svg xmlns="http://www.w3.org/2000/svg" '
'viewBox="0 0 24 24">'
'<path d="M3.9 12c0-1.71 1.39-3.1 '
"3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 "
"5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 "
"13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 "
"3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 "
'5-5s-2.24-5-5-5z"/></svg>'
)
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = '{0} v{1}'.format(project, version)
Expand Down Expand Up @@ -216,12 +230,25 @@ def add_notebooks(nb_path='../../notebooks'):
'python': ('http://docs.python.org/3', None),
'numpy': ('https://numpy.org/doc/stable/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/reference', None),
'progressbar': ('https://progressbar-2.readthedocs.io/en/latest/', None),
'matplotlib': ('https://matplotlib.org', None),
'astropy': ('http://docs.astropy.org/en/latest/', None),
'cupy': ('https://docs-cupy.chainer.org/en/stable/', None),
'torch': ('https://pytorch.org/docs/stable/', None),
'sklearn': (
'http://scikit-learn.org/stable',
(None, './_intersphinx/sklearn-objects.inv')
),
'tensorflow': (
'https://www.tensorflow.org/api_docs/python',
(
'https://github.com/GPflow/tensorflow-intersphinx/'
+ 'raw/master/tf2_py_objects.inv')
)

}

# -- BibTeX Setting ----------------------------------------------

bibtex_bibfiles = ['refs.bib', 'my_ref.bib']
bibtex_default_style = 'alpha'
13 changes: 10 additions & 3 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
Contributing
============

Read our `Contribution Guidelines <https://github.com/cea-cosmic/modopt/blob/master/CONTRIBUTING.md>`_
Read our |link-to-contrib|.
for details on how to contribute to the development of this package.

All contributors are kindly asked to adhere to the
`Code of Conduct <https://github.com/cea-cosmic/modopt/blob/master/CODE_OF_CONDUCT.md>`_
All contributors are kindly asked to adhere to the |link-to-conduct|
at all times to ensure a safe and inclusive environment for everyone.

.. |link-to-contrib| raw:: html

<a href="https://github.com/cea-cosmic/modopt/blob/master/CONTRIBUTING.md" target="_blank">Contribution Guidelines</a>

.. |link-to-conduct| raw:: html

<a href="https://github.com/cea-cosmic/modopt/blob/master/CODE_OF_CONDUCT.md" target="_blank">Code of Conduct</a>
Binary file modified docs/source/cosmostat_logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/source/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Required Packages

In order to use ModOpt the following packages must be installed:

* |link-to-python| ``[> 3.6]``
* |link-to-python| ``[>= 3.6]``
* |link-to-metadata| ``[>=3.7.0]``
* |link-to-numpy| ``[>=1.19.5]``
* |link-to-scipy| ``[>=1.5.4]``
Expand Down
6 changes: 4 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ ModOpt Documentation
======================

.. image:: modopt_logo.png
:width: 100%
:alt: ModOpt logo

.. Include table of contents
.. include:: toc.rst

:Author: Samuel Farrens `(samuel.farrens@cea.fr) <samuel.farrens@cea.fr>`_
:Version: 1.5.1
:Release Date: 22/04/2021
:Version: 1.6.0
:Release Date: 17/12/2021
:Repository: |link-to-repo|

.. |link-to-repo| raw:: html
Expand Down
Binary file modified docs/source/neurospin_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 32 additions & 19 deletions docs/source/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ @article{condat2013
doi = {10.1007/s10957-012-0245-9}
}

@ARTICLE{defazio2014,
author = {{Defazio}, Aaron and {Bach}, Francis and {Lacoste-Julien}, Simon},
title = "{SAGA: A Fast Incremental Gradient Method With Support for Non-Strongly Convex Composite Objectives}",
journal = {arXiv e-prints},
keywords = {Computer Science - Machine Learning, Mathematics - Optimization and Control, Statistics - Machine Learning},
year = 2014,
month = jul,
eid = {arXiv:1407.0202},
pages = {arXiv:1407.0202},
archivePrefix = {arXiv},
eprint = {1407.0202},
primaryClass = {cs.LG},
adsurl = {https://ui.adsabs.harvard.edu/abs/2014arXiv1407.0202D},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@ARTICLE{figueiredo2014,
author = {Figueiredo, Mario A.~T. and Nowak, Robert D.},
title = {Sparse Estimation with Strongly Correlated Variables using Ordered Weighted L1 Regularization},
Expand Down Expand Up @@ -145,6 +161,22 @@ @ARTICLE{raguet2011
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@ARTICLE{ruder2017,
author = {{Ruder}, Sebastian},
title = "{An overview of gradient descent optimization algorithms}",
journal = {arXiv e-prints},
keywords = {Computer Science - Machine Learning},
year = 2016,
month = sep,
eid = {arXiv:1609.04747},
pages = {arXiv:1609.04747},
archivePrefix = {arXiv},
eprint = {1609.04747},
primaryClass = {cs.LG},
adsurl = {https://ui.adsabs.harvard.edu/abs/2016arXiv160904747R},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

@book{starck2010,
place={Cambridge},
title={Sparse Image and Signal Processing: Wavelets, Curvelets, Morphological Diversity},
Expand Down Expand Up @@ -175,22 +207,3 @@ @article{zou2005
journal = {Journal of the Royal Statistical Society Series B},
doi = {10.1111/j.1467-9868.2005.00527.x}
}

@article{ruder2017,
title = {An overview of gradient descent optimization algorithms},
url = {http://arxiv.org/abs/1609.04747},
journaltitle = {{arXiv}:1609.04747 [cs]},
author = {Ruder, Sebastian},
urldate = {2021-12-09},
date = {2017-06-15},
langid = {english},
eprinttype = {arxiv},
eprint = {1609.04747},
}

@article{defazio2014,
title = {{SAGA}: A Fast Incremental Gradient Method With Support for Non-Strongly Convex Composite Objectives},
pages = {15},
author = {Defazio, Aaron and Bach, Francis and Lacoste-Julien, Simon},
langid = {english},
}
1 change: 0 additions & 1 deletion docs/source/z_ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ References
==========

.. bibliography:: refs.bib
:style: alpha
28 changes: 14 additions & 14 deletions modopt/base/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,26 @@
def get_backend(backend):
"""Get backend.

Returns the backend module for input specified by string
Returns the backend module for input specified by string.

Parameters
----------
backend: str
String holding the backend name. One of `tensorflow`,
`numpy` or `cupy`.
String holding the backend name. One of ``'tensorflow'``,
``'numpy'`` or ``'cupy'``.

Returns
-------
tuple
Returns the module for carrying out calculations and the actual backend
that was reverted towards. If the right libraries are not installed,
the function warns and reverts to `numpy` backend
the function warns and reverts to the ``'numpy'`` backend.
"""
if backend not in LIBRARIES.keys() or LIBRARIES[backend] is None:
msg = (
'{0} backend not possible, please ensure that '
+ 'the optional libraries are installed.\n'
+ 'Reverting to numpy'
+ 'Reverting to numpy.'
)
warn(msg.format(backend))
backend = 'numpy'
Expand All @@ -83,7 +83,7 @@ def get_array_module(input_data):

Parameters
----------
input_data : numpy.ndarray or cupy.ndarray
input_data : numpy.ndarray, cupy.ndarray or tf.experimental.numpy.ndarray
Input data array

Returns
Expand All @@ -104,16 +104,16 @@ def get_array_module(input_data):
def change_backend(input_data, backend='cupy'):
"""Move data to device.

This method changes the backend of an array
This can be used to copy data to GPU or to CPU
This method changes the backend of an array. This can be used to copy data
to GPU or to CPU.

Parameters
----------
input_data : numpy.ndarray or cupy.ndarray
input_data : numpy.ndarray, cupy.ndarray or tf.experimental.numpy.ndarray
Input data array to be moved
backend: str, optional
The backend to use, one among `tensorflow`, `cupy` and
`numpy`. Default is `cupy`.
The backend to use, one among ``'tensorflow'``, ``'cupy'`` and
``'numpy'``. Default is ``'cupy'``.

Returns
-------
Expand All @@ -131,12 +131,12 @@ def change_backend(input_data, backend='cupy'):
def move_to_cpu(input_data):
"""Move data to CPU.

This method moves data from GPU to CPU.
It returns the same data if it is already on CPU.
This method moves data from GPU to CPU. It returns the same data if it is
already on CPU.

Parameters
----------
input_data : cupy.ndarray
input_data : cupy.ndarray or tf.experimental.numpy.ndarray
Input data array to be moved

Returns
Expand Down
5 changes: 3 additions & 2 deletions modopt/base/np_adjust.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def pad2d(input_data, padding):
See Also
--------
numpy.pad : base function

"""
input_data = np.array(input_data)

Expand All @@ -169,7 +170,7 @@ def pad2d(input_data, padding):
def ftr(input_data):
"""Fancy transpose right.

Apply fancy_transpose() to data with roll=1.
Apply ``fancy_transpose`` to data with ``roll=1``.

Parameters
----------
Expand All @@ -192,7 +193,7 @@ def ftr(input_data):
def ftl(input_data):
"""Fancy transpose left.

Apply fancy_transpose() to data with roll=-1.
Apply ``fancy_transpose`` to data with ``roll=-1``.

Parameters
----------
Expand Down
6 changes: 3 additions & 3 deletions modopt/base/observable.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def notify_observers(self, signal, **kwargs):
----------
signal : str
A valid signal
kwargs : dict
**kwargs : dict
The parameters that will be sent to the observers

Returns
Expand Down Expand Up @@ -191,9 +191,9 @@ class MetricObserver(object):
Metric function with this precise signature func(test, ref)
mapping : dict
Define the mapping between the iterate variable and the metric
keyword: {'x_new':'name_var_1', 'y_new':'name_var_2'}. To cancel
keyword: ``{'x_new':'name_var_1', 'y_new':'name_var_2'}``. To cancel
the need of a variable, the dict value should be None:
'y_new':None.
``'y_new': None``.
cst_kwargs : dict
Keywords arguments of constant argument for the metric computation
early_stopping : bool
Expand Down
Loading