I'm using statsmodels.nonparametric.KDEMultivariate
to generate continuous probability distributions with kernel density estimation. The distribution is created using statsmodels.nonparametric.KDEMultivariate(data=[time, measurement])
to create a distribution, and then if I want to find a discretised most likely measurement from my distribution for a particular time, I can iterate through with:
for x in range(10):
probability_of_x = distribution.pdf([TIME, x])
Where TIME
is the fixed time value for which I want to obtain a "best prediction".
What I'm struggling with is how to work out the expected value from a distribution like this, as I know that iterating through as I am to find the "best prediction" is the wrong way to go about it.
Is there a python library or something similar that I could use to get the expected value for a fixed time?
Many thanks in advance.