-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test_GEFCS.py
68 lines (62 loc) · 1.84 KB
/
Test_GEFCS.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
# -*- coding: utf-8 -*-
"""
Created on Tue May 8 13:35:47 2012
@author: gofrendi
"""
from Go_GEFCS import Go_GEFCS
from Go_Random import Go_Random
from randomFunction import randomFunction
from thresholdingData import thresholdingData
gfcs = Go_GEFCS()
gfcs.random = Go_Random(randomFunction)
gfcs._grammar = {
'<EXPR>' : [
{'become' : '(<EXPR>)<OP>(<EXPR>)', 'p' : 2},
{'become' : '<VAR>', 'p' : 8},
{'become' : '<NUM>', 'p' : 2}
],
'<OP>' : [
{'become' : '+', 'p' : 4},
{'become' : '-', 'p' : 3},
{'become' : '*', 'p' : 3},
{'become' : '/', 'p' : 3},
{'become' : '**', 'p' : 1}
],
'<VAR>' : [
{'become' : 'otsu', 'p' : 5},
{'become' : 'stdev', 'p' : 5},
{'become' : 'mean', 'p' : 5},
{'become' : 'minOtsu', 'p' : 5},
],
'<NUM>' : [
{'become' : '<DIGIT>.<DIGIT>', 'p' : 2},
{'become' : '<DIGIT>', 'p' : 8}
],
'<DIGIT>' : [
{'become' : '<DIGIT><DIGIT>', 'p' : 1},
{'become' : '0', 'p' : 1},
{'become' : '1', 'p' : 1},
{'become' : '2', 'p' : 1},
{'become' : '3', 'p' : 1},
{'become' : '4', 'p' : 1},
{'become' : '5', 'p' : 1},
{'become' : '6', 'p' : 1},
{'become' : '7', 'p' : 1},
{'become' : '8', 'p' : 1},
{'become' : '9', 'p' : 1}
]
}
gfcs._trainingSet = {
'header' : ['otsu', 'stdev', 'mean', 'minOtsu', 't'],
'target' : 't',
'data' : thresholdingData
}
gfcs.train()
gfcs.printAllPhenotype()
best = gfcs.getBestPhenotype(10,0.0)
trainingSet = {}
trainingSet['target'] = gfcs._trainingSet['target']
trainingSet['header'] = []
trainingSet['data'] = []
for individu in best:
print(individu)