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()
相关推荐
Alter123013 小时前
算力决定下限,存力决定上限:Gartner魔力象限背后的AI存储暗战
大数据·人工智能
geovindu13 小时前
python: Face Recognition
开发语言·后端·python·人脸识别
为自己_带盐13 小时前
AI驱动历史项目安全审查
人工智能·安全
2601_9548118213 小时前
AI科学实验室MHS标准解读:AI智能体如何统一控制实验室设备接口
人工智能·python
一位正在转型AI全栈的前端工程师13 小时前
AI 全栈学习之旅 -Week 9:什么是AI Agent?从Function Calling到LangGraph
前端·python
具身AGI13 小时前
第一视角数据从哪来,物理AI 人类学习路线 的入口
人工智能·深度学习·学习
小白羊丨13 小时前
训练中看哪些指标?chosen/rejected 样本质量怎么保证?
人工智能·深度学习·机器学习
用户03321266636713 小时前
使用 Python 为 PowerPoint 设置背景色和背景图【附代码示例】
python
CypressTel14 小时前
GPT-6 Astra发布:复杂任务执行能力继续提升——赛柏特AI快讯
人工智能·gpt
ever_up97314 小时前
LangChain基础知识概述1
人工智能·python·langchain