I am aware that you can use seaborn.distplot to graph data as a histogram and superimpose a distribution on top of it. I'm aware of a parameter that allows you to pass in a pdf function to do so. In the source code, it looks like it internally calls fit() to do the training. I was wondering if there was a way to pre-train the model, and just use it.
I have tried using lambda functions representing my distribution, but I kept getting errors. I have also tried passing parameters into seaborn.distplot to help train with the settings I wanted, but that didn't work either.
Method 1 - Using a lambda for the pretrained model:
import seaborn as sns
from scipy import stats
params = stats.exponweib.fit(data, floc=0, f0=1)
custom_weib = lambda x: stats.exponweib.pdf(x, *params)
sns.distplot(data, bins=bin_count, fit=custom_weib, norm_hist=True, kde=False, hist_kws={'log':True})
I'm seeing this error message: AttributeError: 'function' object has no attribute 'fit' ^ It can't take a pre-trained model.
Method 2 - Attempted to pass parameters as part of the fit method. (I don't know if I'm doing this correctly.)
import seaborn as sns
from scipy import stats
sns.distplot(data, bins=bin_count, norm_hist=True, kde=False, hist_kws=hist_kws, fit=stats.exponweib, floc=0, f0=1)
I get this exception: TypeError: distplot() got an unexpected keyword argument 'floc' ^ It's obvious that I'm not passing in the variables correctly, but I don't know how.
Here's a link to the Seaborn source code if you need it: https://github.com/mwaskom/seaborn/blob/master/seaborn/distributions.py
