[英]OLS Regression with statsmodels giving many coefficients
I'm trying to make a simple regression on encryption time for a given datasize from a dataset.我正在尝试对数据集中给定数据大小的加密时间进行简单的回归。 I'm a beginner with python and statsmodels but I think I'm getting strange results with OLS regression since it provides me a coefficient for every datasize like :
我是 python 和 statsmodels 的初学者,但我认为 OLS 回归得到了奇怪的结果,因为它为我提供了每个数据大小的系数,例如:
DataSize[T.1024] 0.0001
DataSize[T.1040] 0.0003
DataSize[T.1056] 0.0004
DataSize[T.1072] 0.0006
DataSize[T.1088] 0.0007
here is the code I developed:这是我开发的代码:
encrypt_key_16 = select_total_encrypt_time.loc[select_total_encrypt_time['KeySize'] == 16]
y4, X4 = dmatrices('Measure ~ DataSize', data=encrypt_key_16, return_type='dataframe')
mod4 = sm.OLS(y4, X4)
result4 = mod4.fit()
Am I doing something wrong ?难道我做错了什么 ?
Thank you in advance for your answer.预先感谢您的回答。
Okay I think I found what the problem is.好的,我想我找到了问题所在。 When I print the dataframe X4 I'm getting the following output:
当我打印数据帧 X4 时,我得到以下输出:
Output when printing X4打印 X4 时输出
So I need to somehow make it only one column of DataSize.所以我需要以某种方式使它只有一列 DataSize。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.