204 Fit function calculates the cumulative distribution with numpy percentile.
206 :param x: Input distribution
207 :param y: Will not be used in this transformation
209 self.
io.debug(
"Fitting CDF")
210 y_ = np.linspace(0, 100, 2 * self.
n_bins)
211 x_ = pd.Series(np.percentile(x, list(y_)))
214 vc = x_.value_counts()
218 for i, xi
in enumerate(vc):
221 nex_val = vc.index[i + 1]
223 nex_val = vc.index[i] + 0.01
224 fill = np.linspace(vc.index[i], nex_val, xi)
225 x_[x_ == vc.index[i]] = fill
226 self.
spline = InterpolatedUnivariateSpline(x_, y_)