Skip to content

Commit

Permalink
Solved issue cokelaer#23: Lack of Clarity on the Parameters of the Di…
Browse files Browse the repository at this point in the history
…stribution
  • Loading branch information
Asraful Kabir committed Aug 24, 2021
1 parent 5cf01d3 commit fd7873c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/fitter/fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,13 @@ def get_best(self, method='sumsquare_error'):
# self.df should be sorted, so then us take the first one as the best
name = self.df_errors.sort_values(method).iloc[0].name
params = self.fitted_param[name]
return {name: params}
distribution = getattr(scipy.stats, name)
param_names = (distribution.shapes + ', loc, scale').split(', ') if distribution.shapes else ['loc', 'scale']

param_dict= {}
for d_key, d_val in zip (param_names,params):
param_dict[d_key]= d_val
return {name:param_dict}

def summary(self, Nbest=5, lw=2, plot=True, method="sumsquare_error"):
"""Plots the distribution of the data and Nbest distribution
Expand Down

0 comments on commit fd7873c

Please sign in to comment.