Coverage for src/lsqfitgp/copula/__init__.py: 100%
5 statements
« prev ^ index » next coverage.py v7.6.3, created at 2024-10-15 19:54 +0000
« prev ^ index » next coverage.py v7.6.3, created at 2024-10-15 19:54 +0000
1# lsqfitgp/copula/__init__.py
2#
3# Copyright (c) 2023, 2024, Giacomo Petrillo
4#
5# This file is part of lsqfitgp.
6#
7# lsqfitgp is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# lsqfitgp is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with lsqfitgp. If not, see <http://www.gnu.org/licenses/>.
20""" Reparametrize probability distributions as Normal """
22from ._base import DistrBase 1abcdef
23from ._distr import Distr, distribution 1abcdef
24from ._copula import Copula 1abcdef
25from ._makedict import makedict 1abcdef
26from ._copulas import ( 1abcdef
27 beta,
28 dirichlet,
29 gamma,
30 loggamma,
31 invgamma,
32 halfcauchy,
33 halfnorm,
34 uniform,
35 lognorm,
36)
38# TODO I could try to drop BufferDict altogether. It adds more complexity than
39# necessary: won't keep track of dependencies between keys, structure fixed to a
40# dictionary, and global unique transformation names.
41#
42# I need something analogous to carry around both the distribution definition
43# and specific values. Copula.concretize(x) -> ConcreteCopula object. Method
44# .values() returns pytree of transformed values (container-copied),
45# .input_values() the flat input array (readonly view). Prints as:
46# Copula({
47# 'x': beta(1, 2),
48# 'y': gamma(1, <x>),
49# })
50# ConcreteCopula({
51# 'x': 0.1234,
52# 'y': 0.1314,
53# })
54# But there is a description method to list the original values:
55# ConcreteCopula({
56# 'x': 0.1234 <- 0.1442,
57# 'y': 0.1314 <- 0.4124, <x>
58# })
59# or to do comparisons:
60# ConcreteCopula({
61# 'x': 0.1234 | 0.12344 <- 0.1442 | 0.7777,
62# 'y': 0.1314 | 0.4144 <- 0.4124 | 0.1341, <x>
63# })
64#
65# Make empbayes_fit take Copula_like as input, and output ConcreteCopula for
66# the posterior. Attribute .p would be ConcreteCopula.values(), new attribute
67# post would contain everything.
68#
69# I could maintain the BufferDict functionality, listed under a bottom section
70# in the reference.