How do I put a constraint on SciPy curve fit?

前端 未结 5 1991
旧巷少年郎
旧巷少年郎 2020-11-30 10:11

I\'m trying to fit the distribution of some experimental values with a custom probability density function. Obviously, the integral of the resulting function should always b

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-30 10:32

    If you are able normalise your probability fitting function in advance then you can use this information to constrain your fit. A very simple example of this would be fitting a Gaussian to data. If one were to fit the following three-parameter (A, mu, sigma) Gaussian then it would be unnormalised in general:

    Gaussian

    however, if one instead enforces the normalisation condition on A:

    Normalised

    then the Gaussian is only two parameter and is automatically normalised.

提交回复
热议问题