-
Notifications
You must be signed in to change notification settings - Fork 1
/
featurematching.py
77 lines (51 loc) · 1.63 KB
/
featurematching.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# multivariate lineair regression on the plantlet features
import numpy as np
import pandas as pd
import csv
if __name__ == '__main__':
path = './output/saliency3/extfeat2/features_plant0.csv'
features = pd.DataFrame(pd.read_csv(path, sep=','))
correlations = features.corr()
print correlations
corCols = correlations.columns
averages = []
index = len(features.columns)
for co in corCols:
index = index -1
cor = correlations[co]
# average pearson correlations, highest average has higest over all correlations
avrg = np.mean(cor)
averages.append([avrg, index])
newavrg = sorted(averages, reverse=True)
print newavrg
print newavrg[:5]
path = './output/saliency3/extfeat2/features_plant2.csv'
features = pd.DataFrame(pd.read_csv(path, sep=','))
correlations = features.corr()
print correlations
corCols = correlations.columns
averages = []
index = len(features.columns)
for co in corCols:
index = index -1
cor = correlations[co]
# average pearson correlations, highest average has higest over all correlations
avrg = np.mean(cor)
averages.append([avrg, index])
newavrg = sorted(averages, reverse=True)
print newavrg
print newavrg[:5]
#print features.corr()
#amountCol = len(features.columns)
#i = 0
#j = 1
#while i < amountCol:
# while j<amountCol:
# col = features.iloc[:,i:j]
# j = j + 1
# i = i + 1
# print col
#col = features.iloc[:,0:1]
#print col
#rest = features.iloc[:,1:]
#print rest