当前位置:网站首页>Introduction of linear regression 01 - API use cases
Introduction of linear regression 01 - API use cases
2022-08-04 06:05:00 【I'm fine please go away thank you】
- API介绍

- 案例
- 给定一个数据集

- 代码
from sklearn.linear_model import LinearRegression
# 1.获取数据
x = [[80, 86],
[82, 80],
[85, 78],
[90, 90],
[86, 82],
[82, 90],
[78, 80],
[92, 94]]
y = [84.2, 80.6, 80.1, 90, 83.2, 87.6, 79.4, 93.4]
# 2.数据基本处理(略)
# 3.特征工程(略)
# 4.机器学习
# 4.1 创建模型
estimator = LinearRegression()
#4.2 训练模型
estimator.fit(x, y)
#5.模型评估(略)
# 获取回归系数
estimator.coef_
# 回归预测
estimator.predict([[100, 80]])
# get offset (接近于0)
estimator.intercept_
- 部分运行截图

边栏推荐
猜你喜欢
随机推荐
ISCC2021———MISC部分复现(练武)
flink-sql自定义函数
The pipeline mechanism in sklearn
VScode配置PHP环境
Commons Collections1
Simple and clear, the three paradigms of database design
【深度学习21天学习挑战赛】3、使用自制数据集——卷积神经网络(CNN)天气识别
sklearn中的学习曲线learning_curve函数
PostgreSQL模式(Schema)
(九)哈希表
自动化运维工具Ansible(4)变量
WARNING: sql version 9.2, server version 11.0.Some psql features might not work.
剑指 Offer 2022/7/3
剑指 Offer 2022/7/12
对象存储-分布式文件系统-MinIO-1:概念
TensorFlow2 study notes: 4. The first neural network model, iris classification
简单说Q-Q图;stats.probplot(QQ图)
Kubernetes基本入门-元数据资源(四)
【CV-Learning】目标检测&实例分割
flink sql left join数据倾斜问题解决









