Need clear python code to sample from subranges of a cumulative density function [18€]
Budget: €8 – €30 EUR
I am using the sklearn GaussianMixture library. I got my GMM which is working fine, now I would like to sample from it. According to the docs I can use the model.sample(n) function to get n samples. This works, however I would like to sample, based on the fit probability, from a certain range of of values, not all the values.
To be precise, I want to be able to split the cumulative probability function into k equally probable ranges, like in the attached picture. Meaning, I want to sample from range 5 (0.57~ to 0.71~ in the picture).
if it's possible to get this directly from the GMM package, then even better.
I created a function that takes a list of values and the binsize as input and returns the cdf values (cumulative prob and respective values), as well as the plots.
So I need a new function that takes the cdf values, the number of ranges i want to split the cdf in and the range i want to sample from as input and returns a sample from the range of the cdf (of course based on probability).
To be precise, I want to be able to split the cumulative probability function into k equally probable ranges, like in the attached picture. Meaning, I want to sample from range 5 (0.57~ to 0.71~ in the picture).
if it's possible to get this directly from the GMM package, then even better.
I created a function that takes a list of values and the binsize as input and returns the cdf values (cumulative prob and respective values), as well as the plots.
So I need a new function that takes the cdf values, the number of ranges i want to split the cdf in and the range i want to sample from as input and returns a sample from the range of the cdf (of course based on probability).