如何解决Python - 概率
我有以下数据集,它是更大数据集的一部分,但我进行了隔离以简化计算(整个数据有 200 多行,但我选择了前 20 行作为样本):
Length CTR
0 3 0.20
1 4 0.22
2 3 0.09
3 3 0.16
4 2 0.04
5 10 0.64
6 3 0.14
7 3 0.13
8 2 0.01
9 4 0.21
10 1 0.00
11 2 0.02
12 2 0.01
13 3 0.01
14 4 0.16
15 3 0.09
16 1 0.01
17 2 0.09
18 3 0.02
19 6 0.63
我的想法是计算给定长度 (1,2,3 ...) 的 CTR 为 5%、10%、20% 等的概率。我用交叉表做了一些测试,但我不确定这是否是正确的方法。我也做了回归分析
#Clicks and installs
from sklearn.linear_model import LinearRegression
# Build linear regression model using installs
# Split data into predictors X and output Y
predictors = ['length']
X1 = df_num[predictors]
y1 = df_num['CTR']
# Initialise and fit model
lm = LinearRegression()
model = lm.fit(X1,y1)
print(f'alpha = {model.intercept_}')
print(f'betas = {model.coef_}')
new_X = [[3]]
print({"Clicks":model.predict(new_X)})
但这仅向我显示给定长度数字的预测点击率是多少。 到目前为止,我已经制作了一个热图,其中包含我拥有的所有变量之间的相关性,而那些 02 是具有最高相关性 (0.72) 的变量,如果该信息有用的话。 有人知道这里的解决方案是什么吗?
谢谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。