trainingSet = {
        'header' : ['sex', 'length', 'diameter', 'height', 'whole_weight', 'shucked_weight', 'viscera_weight', 'shell_weight', 'rings'],
        'target' : 'rings+1.5',
        'data' : abaloneData
    }
ge.trainingSet = trainingSet
    
ge.train()
#ge.printAllPhenotype()

#good features should have correlation with the output (done),
#good features should not be correlated each other
bestPhenotype = ge.getBestPhenotype(4, 0)
for phenotype in bestPhenotype:
    print(phenotype)

all_extracted_features = []
all_original_features = []
all_targets = []
trainingHeader = trainingSet['header']
for trainingData in trainingSet['data']:
    sandbox = {}  
    extracted_inputs = []
    original_inputs = []
    targets = []  
    for i in xrange(len(trainingHeader)):
        exec(trainingHeader[i]+'='+str(float(trainingData[i]))) in sandbox
        original_inputs.append(float(sandbox[trainingHeader[i]]))


trainingSet = {
        'header' : ['otsu', 'stdev', 'mean', 't', 'minOtsu'],
        'target' : 't',
        'data' : thresholdingData
    }
ge.trainingSet = trainingSet

ge.train()
ge.printAllPhenotype()

#good features should have correlation with the output (done),
#good features should not be correlated each other
bestPhenotype = ge.getBestPhenotype(5, 0)
for phenotype in bestPhenotype:
    print(phenotype)
    
all_extracted_features = []
all_original_features = []
all_targets = []
trainingHeader = trainingSet['header']
for trainingData in trainingSet['data']:
    sandbox = {}  
    extracted_inputs = []
    original_inputs = []
    targets = []  
    for i in xrange(len(trainingHeader)):
        exec(trainingHeader[i]+'='+str(float(trainingData[i]))) in sandbox
        original_inputs.append(float(sandbox[trainingHeader[i]]))
示例#3
0
        ],
    '<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)