Skip to content

Commit

Permalink
Update Docstrings for PEP 257.
Browse files Browse the repository at this point in the history
  • Loading branch information
asnelt committed Nov 27, 2021
1 parent a81c4ca commit 1982552
Show file tree
Hide file tree
Showing 13 changed files with 282 additions and 319 deletions.
34 changes: 18 additions & 16 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,28 @@ mixedvines Package for Python
=============================

Package for canonical vine copula trees with mixed continuous and discrete
marginals. If you use this software for publication, please cite [ONKEN2016]_.
marginals. If you use this software for publication, please cite
[ONKEN2016]_.


Description
-----------

This package contains a complete framework based on canonical vine copulas for
modelling multivariate data that are partly discrete and partly continuous. The
resulting multivariate distributions are flexible with rich dependence
modelling multivariate data that are partly discrete and partly continuous.
The resulting multivariate distributions are flexible with rich dependence
structures and marginals.

For continuous marginals, implementations of the normal and the gamma
distributions are provided. For discrete marginals, Poisson, binomial and
negative binomial distributions are provided. As bivariate copula building
blocks, the Gaussian, Frank and Clayton families as well as rotation transformed
families are provided. Additional marginal and pair copula distributions can be
added easily.
blocks, the Gaussian, Frank and Clayton families as well as rotation
transformed families are provided. Additional marginal and pair copula
distributions can be added easily.

The package includes methods for sampling, likelihood calculation and inference,
all of which have quadratic complexity. These procedures are combined to
estimate entropy by means of Monte Carlo integration.
The package includes methods for sampling, likelihood calculation and
inference, all of which have quadratic complexity. These procedures are
combined to estimate entropy by means of Monte Carlo integration.

Please see [ONKEN2016]_ for a more detailed description of the framework.

Expand Down Expand Up @@ -55,11 +56,11 @@ To install the mixedvines package, run::
Usage
-----

Suppose that data are given in a NumPy array ``samples`` with shape ``(n, d)``,
where ``n`` is the number of samples and ``d`` is the number of elements per
sample. First, specify which of the elements are continuous. If, for instance,
the distribution has three elements and the first and last element are
continuous whereas the second element is discrete:
Suppose that data are given in a NumPy array ``samples`` with shape
``(n, d)``, where ``n`` is the number of samples and ``d`` is the number of
elements per sample. First, specify which of the elements are continuous.
If, for instance, the distribution has three elements and the first and last
element are continuous whereas the second element is discrete:

.. code-block:: python
Expand All @@ -72,8 +73,9 @@ To fit a mixed vine to the samples:
from mixedvines.mixedvine import MixedVine
vine = MixedVine.fit(samples, is_continuous)
``vine`` is now a ``MixedVine`` object. To draw samples from the distribution,
calculate their density and estimate the distribution entropy in units of bits:
``vine`` is now a ``MixedVine`` object. To draw samples from the
distribution, calculate their density and estimate the distribution entropy in
units of bits:

.. code-block:: python
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __getattr__(cls, name):
# The short X.Y version.
version = u'1.3'
# The full version, including alpha/beta/rc tags.
release = u'1.3.0'
release = u'1.3.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -151,7 +151,7 @@ def __getattr__(cls, name):
# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#
# html_title = u'mixedvines v1.3.0'
# html_title = u'mixedvines v1.3.1'

# A shorter title for the navigation bar. Default is the same as html_title.
#
Expand Down
16 changes: 8 additions & 8 deletions docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ Introduction


This packge contains a complete framework based on canonical vine copulas for
modelling multivariate data that are partly discrete and partly continuous. The
resulting multivariate distributions are flexible with rich dependence
modelling multivariate data that are partly discrete and partly continuous.
The resulting multivariate distributions are flexible with rich dependence
structures and marginals.

For continuous marginals, implementations of the normal and the gamma
distributions are provided. For discrete marginals, Poisson, binomial and
negative binomial distributions are provided. As bivariate copula building
blocks, the Gaussian, Frank and Clayton families as well as rotation transformed
families are provided. Additional marginal and pair copula distributions can be
added easily.
blocks, the Gaussian, Frank and Clayton families as well as rotation
transformed families are provided. Additional marginal and pair copula
distributions can be added easily.

The package includes methods for sampling, likelihood calculation and inference,
all of which have quadratic complexity. These procedures are combined to
estimate entropy by means of Monte Carlo integration.
The package includes methods for sampling, likelihood calculation and
inference, all of which have quadratic complexity. These procedures are
combined to estimate entropy by means of Monte Carlo integration.
36 changes: 18 additions & 18 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ Usage
=====


Suppose that data are given in a NumPy array ``samples`` with shape ``(n, d)``,
where ``n`` is the number of samples and ``d`` is the number of elements per
sample. First, specify which of the elements are continuous. If, for instance,
the distribution has three elements and the first and last element are
continuous whereas the second element is discrete:
Suppose that data are given in a NumPy array ``samples`` with shape
``(n, d)``, where ``n`` is the number of samples and ``d`` is the number of
elements per sample. First, specify which of the elements are continuous.
If, for instance, the distribution has three elements and the first and last
element are continuous whereas the second element is discrete:

.. code-block:: python
Expand All @@ -21,19 +21,19 @@ To fit a mixed vine to the samples:
``vine`` is now a ``MixedVine`` object. Note that for the canonical vine, the
order of elements is important. Elements should be sorted according to the
importance of their dependencies to other elements where elements with important
dependencies to many other elements should come first. A heuristic way to
select the order of elements is to calculate Kendall's tau between all element
pairs, to obtain a score for each element by summing the taus of the pairs the
element occurs in and to sort elements in descending order according to their
scores. This is what the ``MixedVine.fit`` method does internally by default to
construct an improved canonical vine tree. This internal sorting is used to
construct the vine tree only, so the order of elements is not changed in a user
visible way. To prevent this internal sorting, set the ``keep_order`` argument
to ``True``.

To draw samples from the distribution, calculate their density and estimate the
distribution entropy in units of bits:
importance of their dependencies to other elements where elements with
important dependencies to many other elements should come first. A heuristic
way to select the order of elements is to calculate Kendall's tau between all
element pairs, to obtain a score for each element by summing the taus of the
pairs the element occurs in and to sort elements in descending order according
to their scores. This is what the ``MixedVine.fit`` method does internally by
default to construct an improved canonical vine tree. This internal sorting
is used to construct the vine tree only, so the order of elements is not
changed in a user visible way. To prevent this internal sorting, set the
``keep_order`` argument to ``True``.

To draw samples from the distribution, calculate their density and estimate
the distribution entropy in units of bits:

.. code-block:: python
Expand Down
18 changes: 18 additions & 0 deletions mixedvines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
"""
mixedvines
==========
Provides canonical vine copula trees with mixed continuous and discrete
marginals. The main class is `MixedVine` implementing a copula vine model with
mixed marginals.
Modules
-------
mixedvine
Copula vine model with mixed marginals.
copula
Bivariate copula distributions.
marginal
Univariate marginal distributions.
"""
from . import marginal
from . import copula
from . import mixedvine
Expand Down
Loading

0 comments on commit 1982552

Please sign in to comment.