Skip to content

Commit

Permalink
Merge pull request #369 from simonpf/qrnn_update
Browse files Browse the repository at this point in the history
Extensions of QRNN code.
  • Loading branch information
olemke authored Sep 30, 2020
2 parents 424e6d1 + 5404c46 commit 309ef18
Show file tree
Hide file tree
Showing 19 changed files with 3,111 additions and 855 deletions.
11 changes: 11 additions & 0 deletions doc/typhon.retrieval.bmci.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Bayesian Monte Carlo Integration (BMCI)
=======================================

.. automodule:: typhon.retrieval.bmci

.. currentmodule:: typhon.retrieval.bmci

.. autosummary::
:toctree: generated

BMCI
11 changes: 11 additions & 0 deletions doc/typhon.retrieval.mcmc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Markov-Chain Monte Carlo (MCMC)
===============================

.. automodule:: typhon.retrieval.mcmc

.. currentmodule:: typhon.retrieval.mcmc

.. autosummary::
:toctree: generated

MCMC
15 changes: 15 additions & 0 deletions doc/typhon.retrieval.oem.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Optimal estimation method (OEM)
===============================

.. automodule:: typhon.retrieval.oem

.. currentmodule:: typhon.retrieval.oem

.. autosummary::
:toctree: generated

error_covariance_matrix
averaging_kernel_matrix
retrieval_gain_matrix
smoothing_error
retrieval_noise
73 changes: 73 additions & 0 deletions doc/typhon.retrieval.qrnn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
Quantile regression neural networks (QRNNs)
===========================================

An implementation of quantile regression neural networks (QRNNs) developed
specifically for remote sensing applications providing a flexible
interface for simple training and evaluation of QRNNs.

Overview
--------

The QRNN implementation consists of two-layers:

- A high-level interface provided by the :py:class:`~typhon.retrieval.qrnn.QRNN`
class
- Backend-specific implementations of different neural network architectures
to be used as models by the high-level implementation


The QRNN class
--------------

The :py:class:`~typhon.retrieval.qrnn.QRNN` class provides the high-level
interface for QRNNs. This is all that is required to train a plain,
fully-connected QRNN. The class itself implments generic functionality related
to the evaluation of QRNNs and the post processing of results such as computing
the PSD or the posterior mean. For the rest it acts as a wrapper around its
model attribute, which encapsules all network- and DL-framework-specific code.

Backends
--------

Currently both `keras <https://keras.io/>`_ and `pytorch <https://pytorch.org/>`_
are supported as backends for neural networks. The QRNN implementation will
automatically use the one that is available on your system. If both are available
you can choose a specific backend using the :py:meth:`~typhon.retrieval.qrnn.set_backend` function.

Neural network models
---------------------

The :py:class:`typhon.retrieva.qrnn.QRNN` has designed to work with any generic
regression neural network model. This aim of this was to make the implementation
sufficiently flexible to allow special network architectures or customization of
the training process.

This gives the user the flexibility to design custom NN models in pytorch
or Keras and use them with the ``QRNN`` class. Some predefined architectures
are defined in the :py:mod:`typhon.retrieval.qrnn.models` submodule.

API documentation
-----------------

.. automodule:: typhon.retrieval.qrnn.qrnn
.. currentmodule:: typhon.retrieval.qrnn.qrnn
.. autosummary::
:toctree: generated

QRNN

.. automodule:: typhon.retrieval.qrnn.models.pytorch
.. currentmodule:: typhon.retrieval.qrnn.models.pytorch
.. autosummary::
:toctree: generated

FullyConnected
UNet

.. automodule:: typhon.retrieval.qrnn.models.keras
.. currentmodule:: typhon.retrieval.qrnn.models.keras
.. autosummary::
:toctree: generated

FullyConnected

96 changes: 19 additions & 77 deletions doc/typhon.retrieval.rst
Original file line number Diff line number Diff line change
@@ -1,87 +1,29 @@
retrieval
=========
The retrieval submodule contains implementations of different retrieval methods
as well as functions for the assessment of their performance.

.. automodule:: typhon.retrieval
.. currentmodule:: typhon.retrieval
Retrieval methods
=================

.. autosummary::
:toctree: generated
.. toctree::
:maxdepth: 1

retrieval.bmci
==============
typhon.retrieval.bmci
typhon.retrieval.mcmc
typhon.retrieval.qrnn
typhon.retrieval.oem

.. automodule:: typhon.retrieval.bmci

.. currentmodule:: typhon.retrieval.bmci

.. autosummary::
:toctree: generated

BMCI

retrieval.mcmc
==============

.. automodule:: typhon.retrieval.mcmc

.. currentmodule:: typhon.retrieval.mcmc

.. autosummary::
:toctree: generated

MCMC

retrieval.oem
=============

.. automodule:: typhon.retrieval.oem

.. currentmodule:: typhon.retrieval.oem

.. autosummary::
:toctree: generated

error_covariance_matrix
averaging_kernel_matrix
retrieval_gain_matrix
smoothing_error
retrieval_noise

retrieval.qrnn
==============

.. automodule:: typhon.retrieval.qrnn

.. currentmodule:: typhon.retrieval.qrnn

.. autosummary::
:toctree: generated

QRNN

retrieval.scores
================

.. automodule:: typhon.retrieval.scores
Retrieval products
==================

.. currentmodule:: typhon.retrieval.scores
.. toctree::
:maxdepth: 1

.. autosummary::
:toctree: generated
typhon.retrieval.spareice

mape
bias
quantile_score
mean_quantile_score

retrieval.spareice
Utility functions
==================
.. toctree::
:maxdepth: 1

.. automodule:: typhon.retrieval.spareice

.. currentmodule:: typhon.retrieval.spareice

.. autosummary::
:toctree: generated

SPAREICE
typhon.retrieval.scores
14 changes: 14 additions & 0 deletions doc/typhon.retrieval.scores.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Retrieval scores
================

.. automodule:: typhon.retrieval.scores

.. currentmodule:: typhon.retrieval.scores

.. autosummary::
:toctree: generated

mape
bias
quantile_score
mean_quantile_score
11 changes: 11 additions & 0 deletions doc/typhon.retrieval.spareice.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
SpareIce
========

.. automodule:: typhon.retrieval.spareice

.. currentmodule:: typhon.retrieval.spareice

.. autosummary::
:toctree: generated

SPAREICE
12 changes: 6 additions & 6 deletions typhon/retrieval/qrnn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
r"""
An implementation of quantile regression neural networks based on the
`Keras <https://github.com/keras-team/keras>` deep learning package.
The implementation has been developed specifically for remote sensing
applications and provides a high level interface allowing for simple
training and evaluation of the QRNNs."""
from typhon.retrieval.qrnn.qrnn import QRNN
Quantile regression neural networks (QRNNs)
The module provides a flexible implementation of QRNNs for remote sensing
retrievals.
"""
from typhon.retrieval.qrnn.qrnn import QRNN, set_backend, get_backend
Empty file.
Loading

0 comments on commit 309ef18

Please sign in to comment.