-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.py
More file actions
42 lines (20 loc) · 745 Bytes
/
Copy pathtest.py
File metadata and controls
42 lines (20 loc) · 745 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
import numpy as np
from Fisher import Fisher
from BinnedFisher import BinnedFisher
#make random two classes
class0 = np.random.normal(1,1, (50,5) )
class1 = np.random.normal(-2,0.5, (50,5) )
X = np.vstack( (class0, class1) )
y = np.array( [0 for i in range(50)] + [1 for i in range(50)] )
f = Fisher()
f.fit(X, y, tol = 0.1)
print f.transform(X)
#after fit, can update tolerance
f.update_tol( tol = 0.01 )
print f.transform(X)
#add additional variable to binning, for BinnedFisher
v = np.array( [[0.25 for i in range(25)]+[0.75 for i in range(25)]+[0.25 for i in range(25)]+[0.75 for i in range(25)]] )
X = np.hstack( (v.T, X) )
bf = BinnedFisher( bins = [0.0,0.5,1.0] )
bf.fit(X,y, tol=[0.01, 0.01])
print bf.transform(X)