拟合分布的线性组合 [英] Fitting a linear combination of distributions

查看:76
本文介绍了拟合分布的线性组合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有5个数组(一个熊猫数据框的列)我想计算线性分布到指数分布的线性组合的最佳拟合.例如:

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

其中Y具有指数分布(据我所知),而a,b,c,d,e是要拟合的系数.

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

我尝试使用curve_fit或lmfit python库,但是没有有效地做到这一点.

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

推荐答案

您要描述的是线性模型.使用软件包 scikit-learn :

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()

这篇关于拟合分布的线性组合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆