ngboost icon indicating copy to clipboard operation
ngboost copied to clipboard

Sympy

Open guyko81 opened this issue 3 years ago • 3 comments

Adding new distribution: Gamma Plus providing 2 working examples with Sympy:

  • a simple one, where the distribution, gradients and Fisher information matrix can be calculated in closed form (Normal distribution)
  • a complicated one, where the Fisher information is not closed (metric is not implemented) and the gradients use non-numpy functions (polygamma => need to import separately and need to use the string version of the lambdify function)

This way the development can speed up significantly and a wider community can contribute.

guyko81 avatar Jan 08 '21 15:01 guyko81

@guyko81 in order to get the build to function properly you'll have to modify https://github.com/stanfordmlgroup/ngboost/blob/master/pyproject.toml instead of the requirements.txt

ryan-wolbeck avatar Jan 08 '21 16:01 ryan-wolbeck

@ryan-wolbeck I can't figure out what's the deal with the failed checks. Nothing on Google that would help. make: *** [lint] Error 1 Makefile:12: recipe for target 'lint' failed And why 2 of the commits have a red X next to them? Test fail is noted there?

What I can tell is that the code runs nicely, and as far as I can tell the found models are the same as before.

guyko81 avatar Jan 08 '21 21:01 guyko81

Thanks for providing this example! I don't think it quite fits the bill of what I'd like for the design, though. It seems like the developer would need to understand/use sympy in order to implement new distributions. More importantly, they still need to understand the idea of differentiating the score of the distribution w.r.t. the parameters and the difference between the internal and user-facing parametrizations. These are straightforward concepts to folks with a lot of experience and formal education but I expect that to many users it is a stretch. That's why the current work on the jax branch has it set up so that the user doesn't even need to implement most of the methods in order to get a working prototype.

alejandroschuler avatar Jan 26 '21 17:01 alejandroschuler