-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfindcol.py
77 lines (66 loc) · 1.52 KB
/
findcol.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
import threading
import time
import ref_4_mifs as mifs
from sklearn.externals import joblib
def SelectSubSetmRMR(vectors, classes):
X = vectors
y = classes
# define MI_FS feature selection method
feat_selector = mifs.MutualInformationFeatureSelector()
# find all relevant features
feat_selector.fit(X, y)
# check selected features
feat_selector.support_
# check ranking of features
return feat_selector.ranking_
"""
TEST PROGRAM
"""
from GlobalUtils import *
import scipy
from MachineSpecificSettings import Settings
import scipy.io
import numpy
from DataSetLoaderLib import DataSetLoader
import csv
#variables =joblib.load('DatasetA_Validation.joblib.pkl')
#targets =joblib.load('DatasetA_ValidationClasses.joblib.pkl')
d = DataSetLoader();
variables = d.LoadDataSet("A");
targets = d.LoadDataSetClasses("A");
def test_range(start,end,G,targets,half):
try:
print "first"
print start
print end-half
SelectSubSetmRMR(G[:,start:end-half],targets)
except:
return 1
try:
print "second"
print start+half
print end
SelectSubSetmRMR(G[:,start+half:end],targets)
except:
return 2
return 3
vals=545756
original=668
start=vals-original
half=original/2
Error=1
variables=numpy.asarray(variables)
print variables.shape
G=numpy.delete(variables,545089,1)
while Error!=2:
print half
test=test_range(start,vals,G,targets,half)
if test==1:
vals=vals-half
half=int((vals-start)/2)
continue
if test==2:
start=start+half
half=int((vals-start)/2)
continue
print "Exiting Main Thread"