当前位置:网站首页>Pearson correlation coefficient
Pearson correlation coefficient
2022-07-05 08:50:00 【Python code doctor】
# encoding:utf-8
import pandas as pd
from pandas import DataFrame
import matplotlib.pyplot as plot
import math
#target_url = ("https://archive.ics.uci.edu/ml/machine-learning-databases/undocumented/connectionist-bench/sonar/sonar.all-data")
#rockVMines = pd.read_csv(target_url ,header=None,prefix="V") #prefix Prefix
rockVMines = pd.read_csv('../rockdata.txt',header=None,prefix="V") #prefix Prefix
row2 = rockVMines.iloc[1,0:60]
row3 = rockVMines.iloc[2,0:60]
n = len(row2)
mean2 = row2.mean()
mean3 = row3.mean()
t2=0 ; t3=0;t1=0
for i in range(n):
t2 += (row2[i] - mean2) * (row2[i] - mean2) / n
t3 += (row3[i] - mean3) * (row3[i] - mean3) / n
r23=0
for i in range(n):
r23 += (row2[i] - mean2)*(row3[i] - mean3)/(n* math.sqrt(t2 * t3))
print(r23)
corMat = DataFrame(rockVMines.corr()) #corr Find the correlation coefficient matrix
print(corMat)
plot.pcolor(corMat)
plot.show()
边栏推荐
- Use and programming method of ros-8 parameters
- [牛客网刷题 Day4] JZ32 从上往下打印二叉树
- Several problems to be considered and solved in the design of multi tenant architecture
- Halcon shape_ trans
- The first week of summer vacation
- C [essential skills] use of configurationmanager class (use of file app.config)
- Yolov4 target detection backbone
- How many checks does kubedm series-01-preflight have
- Mathematical modeling: factor analysis
- Latex improve
猜你喜欢

C# LINQ源码分析之Count

C#【必备技能篇】ConfigurationManager 类的使用(文件App.config的使用)

深度学习模型与湿实验的结合,有望用于代谢通量分析

Halcon color recognition_ fuses. hdev:classify fuses by color

Business modeling of software model | vision

Mathematical modeling: factor analysis

Guess riddles (4)

Arduino operation stm32

Digital analog 1: linear programming

猜谜语啦(6)
随机推荐
Guess riddles (9)
Ecmascript6 introduction and environment construction
JS asynchronous error handling
Programming implementation of ROS learning 2 publisher node
Wechat H5 official account to get openid climbing account
How can fresh students write resumes to attract HR and interviewers
Lori remote control LEGO motor
C# LINQ源码分析之Count
[牛客网刷题 Day4] JZ55 二叉树的深度
kubeadm系列-02-kubelet的配置和启动
Search data in geo database
319. 灯泡开关
Business modeling | process of software model
特征工程
[daiy4] copy of JZ35 complex linked list
TypeScript手把手教程,简单易懂
Programming implementation of ROS learning 6 -service node
golang 基础 —— golang 向 mysql 插入的时间数据和本地时间不一致
287. Looking for repeats - fast and slow pointer
319. Bulb switch