Example #1
0
                           y=list(y.queue),
                           z=list(z.queue),
                           besties=list(besties.queue),
                           names=list(names.queue),
                           iters=list(iters.queue),
                           metric=metric,
                           path=self.path2,
                           n_gen=n_gen - 1,
                           self=self)


if __name__ == '__main__':
    createDummies = False
    normalize = False

    name = 'madelon'
    var = 'Class'
    d = data.Data(name, var, [], [])

    d2, target, copy, copy2, copy3, copy4, dummiesLst, ratio, chi2, anova2, originLst =\
        d.ready(deleteCols=True, dropna=True, thresholdDrop=70, createDummies=True, normalize=False)

    pso = PSO(d2, d, ['lr'], target, originLst, name)
    pop = 5
    gen = 5
    w = 0.5
    c1 = 0.5
    c2 = 0.5
    g1, g2, g3, g4, g5 = pso.init(pop, gen, w, c1, c2, copy2, dummiesLst,
                                  createDummies, normalize, 'accuracy')
Example #2
0
import machineLearning.config as cfg

from machineLearning import data, genetic, differential, swarm, hill, tabu, simulated, vns, iterated

if __name__ == '__main__':
    d = data.Data(name=cfg.general['dataset'],
                  target=cfg.general['target'],
                  dropColsList=cfg.general['dropcol'],
                  dropClassList=cfg.general['dropclass'])
    d2, target, copy, copy2, copy3, copy4, dummiesLst, ratio, chi2, anova, origin =\
        d.ready(deleteCols=cfg.general['deletecol'], dropna=cfg.general['dropna'],
                thresholdDrop=cfg.general['thresholddrop'], createDummies=cfg.general['createdummies'],
                normalize=cfg.general['normalize'])
    methods = cfg.general['method']
    name = cfg.general['dataset']
    createDummies = cfg.general['createdummies']
    normalize = cfg.general['normalize']
    metric = cfg.general['metric']
    if cfg.general['heuristic'] == 'genetic':
        heuristic = genetic.Genetic(d2, d, methods, target, origin, name)
        g1, g2, g3, g4, g5 = heuristic.init(n_pop=cfg.genetic['pop'],
                                            n_gen=cfg.genetic['gen'],
                                            n_mut=cfg.genetic['mut'],
                                            data=copy2,
                                            dummiesList=d.dummiesList,
                                            createDummies=createDummies,
                                            normalize=normalize,
                                            metric=metric)
    elif cfg.general['heuristic'] == 'differential':
        heuristic = differential.Differential(d2, d, methods, target, origin,
                                              name)