sklearn 中皮尔森相关性。

相关性

python 复制代码
import pandas as pd
from pandas import set_option
iris=pd.read_csv('data/iris.csv')
set_option('precision', 2) # 设置数据的精确度
iris.corr(method='pearson') # 皮尔森相关性
python 复制代码
correlations = iris.corr(method='pearson')
names = correlations.columns.tolist()
fig = plt.figure(figsize=(8, 8))
ax = fig.add_subplot(111)
cax = ax.matshow(correlations, vmin=-1, vmax=1)
fig.colorbar(cax)
ticks = np.arange(0, 4, 1)
ax.set_xticks(ticks)
ax.set_yticks(ticks)
ax.set_xticklabels(names)
ax.set_yticklabels(names)
plt.show()
相关推荐
汀丶人工智能3 分钟前
想成为AI绘画高手?打造独一无二的视觉IP!Seedream 4.0 使用指南详解,创意无界,效率翻倍!
人工智能
蚝油菜花8 分钟前
万字深度解析Claude Code的Hook系统:让AI编程更智能、更可控|下篇—实战篇
人工智能·ai编程·claude
中杯可乐多加冰31 分钟前
从创意到应用:秒哒黑客松大赛 用零代码点燃你的创新火花
人工智能
百度Geek说1 小时前
一文解码百度地图AI导航“小度想想”
人工智能
京东零售技术1 小时前
京东零售张科:Data&AI Infra会成为驱动未来的技术基石
人工智能
京东零售技术1 小时前
京东零售张泽华:从营销意图到购买转化,AI重塑广告增长
人工智能
这里有鱼汤2 小时前
【花姐小课堂】新手也能秒懂!用「风险平价」打造扛造的投资组合
后端·python
IT_陈寒3 小时前
Python开发者必须掌握的12个高效数据处理技巧,用过都说香!
前端·人工智能·后端
飞哥数智坊12 小时前
从CodeBuddy翻车到MasterGo救场,我的小程序UI终于焕然一新
人工智能
AKAMAI14 小时前
跳过复杂环节:Akamai应用平台让Kubernetes生产就绪——现已正式发布
人工智能·云原生·云计算