Skip to content

feat: transformations base primitives#78

Open
LeonidElkin wants to merge 4 commits intomainfrom
transformations/init
Open

feat: transformations base primitives#78
LeonidElkin wants to merge 4 commits intomainfrom
transformations/init

Conversation

@LeonidElkin
Copy link
Copy Markdown
Collaborator

Base primitives and affine transformation for check. There is also an approximation, but it is very raw for now

@LeonidElkin LeonidElkin force-pushed the transformations/init branch from 033d336 to 1be0adf Compare March 9, 2026 19:11
@LeonidElkin
Copy link
Copy Markdown
Collaborator Author

LeonidElkin commented Mar 9, 2026

This is a base prototype. What surely needs to get done

  • A flyweight pattern for base distributions in transformation tree which will be generated as operations progress
  • ArithmeticalMixin for "injecting" operations in any Distribution like class e.g. ParametricFamilyDistribution
  • Improve the approximation. Make simple interpolation instead of Chebyshev
  • And, of course, test it all

@Desiment
Copy link
Copy Markdown
Contributor

Summary after on-line call:

We decided to re-consider architecture of the graph (yes, again); from new POV one can see analytical computations as loops with different labels is such graph. This will allow to

  • Make choice between analytical computations in complex distributions, such as genhyperbolic
  • Allow to control, how characteristics are computed in DerivedDistribution

More specifically, we assume that

  1. Analytical calculations inside Distribution now declared as:
dict[GenericCharacteristicName, dict[Label, AnalyticalComputation]]

NOTE: options are still needed, because some of them may take values in continuous domain, or have discrete set of values, but it would be quite sad to redefine them in every transformation; labels and options should be orthogonal in that sense;
2. Graph view considers analytical calculations as loops. The default strategy task is to achieve the first characteristic that have such loops.
3. Since we can have multiple analytical calculations, we need to solve them in a strategy. For now, choice the random one, in the future switch to the preferred-label method.
4. In the future, we'll need a separate strategy for DerivedDistribution (ideally,each transformation will have its own strategy, or one large strategy that observes which operation was performed)

@LeonidElkin LeonidElkin force-pushed the transformations/init branch 3 times, most recently from 7d315a6 to 3297870 Compare March 22, 2026 18:21
@Desiment
Copy link
Copy Markdown
Contributor

Desiment commented Mar 22, 2026

  1. Remove TransformOperationMixin from base ABC distribution, since the latter one can be used not only for numeric distribution, but for e.g. strings; this also should solve cyclic import problem
  2. Exploit the fact, that if one works with derived distribution in the form $f(\xi)$ or $g(\xi, \eta)$, when sampling, one can sample $x_1, \ldots, x_n$ from $\xi$ and compute $f(x_1), \ldots, f(x_n)$ (and sample $y_1, \ldots, y_n$, from $\eta$, then $g(x_1, y_1), \ldots, g(x_n, y_n)$ is sample from $g(\xi, \eta)$)
  3. Interpolation should be characteristic-based rather that distribution based. I.e. one can have interpolation method for PDF, and for CDF, and for PPF, and then approximation consumes those specific interpolation methods; Probably can move out from transformations

@LeonidElkin LeonidElkin force-pushed the transformations/init branch from 3297870 to 4d798c1 Compare March 28, 2026 19:47
@LeonidElkin LeonidElkin marked this pull request as ready for review March 28, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants