Multivariate distribution fitting API

Daniel Schmitz via SciPy-Dev <[email protected]> Fri, 21 Jul 2023 11:20:49 +0200
Newsgroups gmane.comp.python.scientific.devel
Message-ID <CALj43ZRiW6q1a36-T-u=kjcftWDSQp_gm5U+BcDFEN9FV8YnzQ@mail.gmail.com>
Hello everyone,

historically, scipy offered a 'fit' function for univariate distributions
but not for the multivariate ones. The univariate `fit` function enables to
fix certain distribution parameters during the fit. For example, specifying
`norm.fit(floc=x`) fixes the location parameter to `x`.

Recently, a `fit` function was added for two multivariate distributions:
multivariate normal and Von Mises Fisher. For both, fixing parameters was
not implemented yet.

My questions are:

1) Do we want to offer this functionality?
2) If we do, what should the API for fixing the parameters?

About 1) I am personally positive, that we should do so because it is a
quite common need.

About 2): I am not a fan of the current univariate namings `floc=`,
`fscale=` as they are not very intuitive. To make things worse, it is also
possible to pass the very similar sounding `loc=` to specify a starting
guess for the fitting optimizer. Of course, this API is very much used in
the wild and might be overhauled with the current infrastructure update.

For the multivariate case, I suggest using a more descriptive name like
`fix_mu` or `fix_mean` for fixing the mean of a multivariate normal during
the fit. This would be a step away from the univariate API but worth it in
my opinion.

Would love to hear your thoughts about this.

Cheers,
Daniel

_______________________________________________
SciPy-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/scipy-dev.python.org/
Member address: [email protected]