首页 > 其他 > 详细

Seaborn实现回归分析

时间:2020-04-24 13:46:25      阅读:74      评论:0      收藏:0      [点我收藏+]
import numpy as np
import pandas as pd
from scipy import stats,integrate
import matplotlib.pyplot as plt
import seaborn as sns

# iris = pd.read_csv("iris.csv")
# # 对角线上是单个数据的情况,旁边的图都是关系分布的情况
# sns.pairplot(iris)
# plt.show()

tips = pd.read_csv("tips.csv")
# print(tips.head())

# # 画图方式 regplot() 和 lmplot
# sns.regplot(x = "total_bill",y = "tip",data = tips)
# x y 都是原数据的列名
# plt.show()

# # lmplot 画图方式,支持更高级的功能,但是规范多
# sns.lmplot(x = "total_bill",y = "tip",data = tips)
# plt.show()

# sns.lmplot(x = "size",y = "tip",data = tips)
# plt.show()

# 加上抖动,使回归更准确
sns.regplot(x = "size",y = "tip",data = tips,x_jitter=0.08)
# x_jitter=0.05 在原始数据集中加上小范围浮动
plt.show()

2020-04-24

Seaborn实现回归分析

原文:https://www.cnblogs.com/hany-postq473111315/p/12766396.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!