Fitting a linear combination of distributions

余生颓废 提交于 2021-01-28 14:03:42

问题


I have 5 arrays (columns of a pandas data frame) and I want calculate the best fit for a linear combination of the distributions to an exponential distribution. for example:

a*(d1)+b*(d2)+c*(d3)+d*(d4)+e*(d5)=Y

where Y has an exponential distribution (which i know) and a,b,c,d,e are the coefficients to fit.

I tried using curve_fit or lmfit python libraries but didn't get how to do it effectively.


回答1:


What you're describing is a linear model. Use the package scikit-learn:

from sklearn.linear_model import LinearRegression

X = df[['d1', 'd2', 'd3', 'd4', 'd5']]
reg = LinearRegression().fit(X, Y)
reg.get_params()


来源:https://stackoverflow.com/questions/61878031/fitting-a-linear-combination-of-distributions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!