Copyright | 2021 Dominik Schrempf |
---|---|
License | GPL-3.0-or-later |
Maintainer | dominik.schrempf@gmail.com |
Stability | unstable |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Creation date: Mon Oct 19 15:32:31 2020.
Elements of simplices
An element of a simplex.
A vector of non-negative values summing to one.
The nomenclature is not very consistent, because a K-dimensional simplex is
usually considered to be the set containing all K
-dimensional vectors with
non-negative elements that sum to 1.0. However, I couldn't come up with a
better name. Maybe SimplexElement
, but that was too long.
simplexUniform :: Dimension -> Simplex Source #
Create the uniform element of the K-dimensional simplex.
Set all values to \(1/D\).
simplexFromVector :: Vector Double -> Either String Simplex Source #
Ensure that the value vector is an element of a simplex.
Return Left
if:
- The value vector is empty.
- The value vector contains negative elements.
- The value vector is not normalized.
Proposals on simplices
dirichlet :: PDimension -> PName -> PWeight -> Tune -> Proposal Simplex Source #
Dirichlet proposal on a simplex.
For a given element of a K-dimensional simplex, propose a new element of the K-dimensional simplex. The new element is sampled from the multivariate Dirichlet distribution with parameter vector being proportional to the current element of the simplex.
The tuning parameter is used to determine the concentration of the Dirichlet distribution: the lower the tuning parameter, the higher the concentration.
The proposal dimension, which is the dimension of the simplex, is used to determine the optimal acceptance rate.
For high dimensional simplices, this proposal may have low acceptance rates.
In this case, please see the coordinate wise beta
proposal.
beta :: Dimension -> PName -> PWeight -> Tune -> Proposal Simplex Source #
Beta proposal on a specific coordinate i
on a simplex.
For a given element of a K-dimensional simplex, propose a new element of the
K-dimensional simplex. The coordinate i
of the new element is sampled from
the beta distribution. The other coordinates are normalized such that the
values sum to 1.0. The parameters of the beta distribution are chosen such
that the expected value of the beta distribution is the value of the old
coordinate.
The tuning parameter is used to determine the concentration of the beta distribution: the lower the tuning parameter, the higher the concentration.
See also the dirichlet
proposal.
No "out of bounds" checks are performed during compile time. Run time errors
can occur if i
is negative, or if i-1
is larger than the length of the
element vector of the simplex.
This proposal has been assigned a dimension of 2. See the discussion at
PDimension
.