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()
相关推荐
EatFan25 分钟前
AI Agent 工程化元年:从单体智能到 Agent 集群的架构演进与落地路径
人工智能·架构·ai agent·autogen·crewai·agent集群·记忆工程
2601_9679801139 分钟前
python pytest如何编写测试
python·测试用例·pytest·函数·assert
泯泷39 分钟前
别再“裸聊”大模型了!你家的 AI 为什么总胡说八道?根子在 RAG
人工智能·算法·架构
玖米GEO运营王总监1 小时前
成都AI数字人视频怎么批量生产?流程与合规标注
大数据·人工智能·音视频
f6m274dww2cmd1 小时前
拆一个类目第一的20个曝光词:43% 的搜索量来自第二页
人工智能
2601_967980112 小时前
Python中heapq模块的各种用法实例
数据结构·python·算法·应用实例·heapq模块
大胖爱学习_MJ2 小时前
超越向量检索:用 Spring Boot + Neo4j 手搓 GraphRAG 知识图谱记忆
java·后端·python
RobinDevNotes2 小时前
24GB Mac 做数字人:声音放本地,画面租云端
人工智能·python·macos·开发工具
user4465117917913 小时前
Agent 也能「过安检」:AgentScope 权限系统设计拆解
人工智能
烟小栀3 小时前
Windows下的深度学习环境配置参考及配置教程
人工智能