Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow passing scipy.stats univariate distributions to the lmo.l_* functions #183

@jorenham

Description

@jorenham

The current monkey-patched methods have several issues:

  • type annotations are impossible for extensions methods, and I've seen no attempts at a PEP that plans to add the required functionality
  • relies on undocumented scipy.stats.rv_* internals, which can break without warning
  • not guaranteed to work when using multiprocessing (it might be fine when using fork, but with e.g. spawn or joblib+loky I suspect it could break, although I have yet to test this).
  • difficult to document properly within mkdocs (hacks required), especially when considering that the docstring styles of scipy and lmo are incompatible.
  • negatively affects the performance of import lmo (the first time)

Instead, it'd be better to extend the lmo.l_* moment functions, making them accept the rv_ instances directly.

  • implement for discrete RV's
  • implement for continuous RV's
  • document the usage, and add (doctest) examples
  • write (hypothesis) tests for the discrete/continuous RV's in lmo.distributions and scipy.stats
  • use two sepearate TypedDict's for **kwargs for specifying extra options to the underlying sample- and population- L-moments estimators
  • add appropriate @overload's.
  • remove lmo.contrib.scipy_stats.l_rv_generic and the related monkey-patch machinery

Metadata

Metadata

Assignees

Labels

contribIntegration with 3rd party packagesenhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions