-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStat.py
More file actions
44 lines (34 loc) · 915 Bytes
/
Copy pathStat.py
File metadata and controls
44 lines (34 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 18 15:22:52 2018
@author: morten
"""
from MLProj1 import *
from similarity import similarity
means = np.zeros(7)
median = np.median(X, axis=0)
sd = np.zeros(7)
maxes = np.zeros(7)
mins = np.zeros(7)
var = np.var(X,axis=0)
sim1 = np.zeros(7)
for i in range(0,7):
means[i] = X[:,i].mean()
maxes[i] = X[:,i].max()
mins[i] = X[:,i].min()
myvar=np.zeros(7)
for j in range (0,7):
for i in range(0,935):
myvar[j] += ((X[i,j]-means[j]) ** 2)/934
for i in range(0,7):
sd[i] = math.sqrt(myvar[i])
cov = np.zeros((7,7))
for i in range (0,7):
for j in range(0,7):
for k in range(0,935):
cov[i,j] += ((X[k,i]-means[i]) * (X[k,j] - means[j]))/934
corr = np.zeros((7,7))
for i in range (0,7):
for j in range(0,7):
corr[i,j] = (cov[i,j]) / (sd[i] * sd[j])