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()
相关推荐
钱栈up几秒前
长安汽车把海外年销钉在100万辆,2030年要翻到200万——出海从故事变成基建
爬虫·python·数据分析
富贵儿99813 分钟前
NL2SQL 实践手记 03:让模型决定下一步——把 Workflow 改造成 SQL Agent
数据库·python·sql·ai·自然语言处理·langchain
九蝶科技25 分钟前
运费分摊的二开实现:BigDecimal 精确分摊 + 尾差补齐 + 暂估调整
开发语言·python
码上观世界26 分钟前
IndexTTS接入实时交互数字人系统实践
人工智能·实时互动
具身AGI28 分钟前
进博会机器人,隔桌对打乒乓球
人工智能·机器人
逐米时代37 分钟前
「制造新解法」行业对标方法:借鉴而不照搬的最佳实践
人工智能·算法·制造
小追兵44 分钟前
Claude Managed Agents 自托管是什么?企业如何控制 Agent Runtime、Session 与数据?
人工智能
Wellijohn1 小时前
上下文工程实战:把大模型 Agent 从「能跑」做到「上线不掉链子」
人工智能·llm·agent
JavaGuide1 小时前
Gemini 杀疯了,反重力给我用爽了!分享 8 个 Antigravity 使用技巧
人工智能·后端
Wellijohn1 小时前
上下文工程实战:把 LLM Agent 从「能跑」做到「可靠」
人工智能·llm·agent