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()
相关推荐
张登杰踩13 小时前
工业图像序列识别实战:基于PyTorch的OCR模型训练与优化
人工智能·pytorch·ocr
QYR-分析13 小时前
2026全球及中国全向自动引导车(AGV)市场发展分析报
人工智能
小饕13 小时前
如果AI是电力,你手里拿的是发电机还是电冰箱?
人工智能
ID_1800790547313 小时前
超详细:Python 调用淘宝商品详情 API 完整教程
开发语言·python
逻辑君13 小时前
Research in Brain-inspired Computing [7]-带关节小人(3个)推箱的类意识报告
c++·人工智能·神经网络·机器学习
QWsin13 小时前
【LangGraph Server】 LangGraph Server是什么?
人工智能·langchain·langgraph·langsmith
SUNNY_SHUN13 小时前
ICLR 2026 | Judo: 7B小模型工业缺陷问答超越GPT-4o,用对比学习+强化学习注入领域知识
论文阅读·人工智能·学习·视觉检测·github
沫儿笙13 小时前
Kasawaki川崎焊接机器人智能气阀
人工智能·物联网·机器人
DO_Community13 小时前
教程:让OpenClaw一次接入Claude、Qwen、DeepSeek 多个模型
人工智能·aigc·ai编程·ai推理
虹科网络安全13 小时前
保障 AI 代理安全:Mend.io(原WhiteSource)推出 AI 代理配置静态扫描
人工智能·安全