当前位置:网站首页>线性回归简介01---API使用案例
线性回归简介01---API使用案例
2022-08-04 05:28:00 【我很好请走开谢谢】
- 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]])
# 获取偏置 (接近于0)
estimator.intercept_
- 部分运行截图

边栏推荐
猜你喜欢
随机推荐
Kubernetes基本入门-名称空间资源(三)
flink问题整理
(十五)B-Tree树(B-树)与B+树
flink-sql所有表连接器
thymeleaf中onclick事件动态传递参数问题
编程Go:return、break、continue
k3s-轻量级Kubernetes
Shell(2)数值运算与判断
Thread 、Handler和IntentService的用法
Delphi-C side interesting menu operation interface design
对象存储-分布式文件系统-MinIO-3:MinIo Client(mc)
对象存储-分布式文件系统-MinIO-1:概念
Vulnhub:Sar-1
完美解决keyby造成的数据倾斜导致吞吐量降低的问题
scrapy 爬取当当图书名字图片
自动化运维工具Ansible(6)Jinja2模板
postgres 递归查询
MySql的concat和group_concat的区别
(TensorFlow)——tf.variable_scope和tf.name_scope详解
实际开发中左菜单自定义图标点击切换









