berkay-yalin / promethium

Library for calculating statistical distributions, written in pure Python with zero dependencies.
https://pypi.org/project/promethium/
GNU General Public License v3.0
4 stars 3 forks source link

Replace "validate" functions with nan for distributions #9

Open berkay-yalin opened 8 months ago

berkay-yalin commented 8 months ago

Instead of raising exceptions within the "validate" functions when invalid arguments are used with the distribution functions, the nan value should be returned.

The reasoning behind this decision is to support large scale operations on arrays.

This makes identifying invalid arguments much more difficult, as the current "validate" functions provide detailed descriptions for why the arguments are rejected, so a more effective solution is welcome for discussion.

Example "validate" function, where each distribution function has its separate "validate" function: https://github.com/berkay-yalin/promethium/blob/668cc829dfe48595d1f0672f35aa20d427f48d3b/src/promethium/distributions/binomial.py#L6-L18