예제 #1
0
    def init(self, n_pop, n_gen, w, c1, c2, data, dummiesList, createDummies,
             normalize, metric):

        print("#####################################")
        print("#OPTIMSATION PAR ESSAIM DE PARTICULE#")
        print("#####################################")
        print()

        x = queue.Queue()
        y = queue.Queue()
        z = queue.Queue()
        besties = queue.Queue()
        names = queue.Queue()
        iters = queue.Queue()

        if isinstance(self.listModels, str):
            if self.listModels == 'all':
                self.listModels = [
                    'x', 'rrc', 'sgd', 'knn', 'svm', 'rbf', 'dtc', 'rdc',
                    'etc', 'gbc', 'abc', 'bac', 'lda', 'qda', 'gnb'
                ]
            else:
                self.listModels = ['x']

        n = 4
        mods = [self.listModels[i::n] for i in range(n)]

        threads = []
        for part in mods:
            thread = threading.Thread(target=self.optimization,
                                      args=(part, n_pop, n_gen, w, c1, c2,
                                            data, dummiesList, createDummies,
                                            normalize, metric, x, y, besties,
                                            names, iters))
            threads.append(thread)
            thread.start()

        for thread in threads:
            thread.join()

        return utility.res(heuristic="Optimisation par essaim de particules",
                           x=list(x.queue),
                           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)
예제 #2
0
    def init(self, n_gen, n_gen_vnd, kmax, n_neighbors, data, dummiesList,
             createDummies, normalize, metric):

        print("#################################")
        print("#RECHERCHE A VOISINNAGE VARIABLE#")
        print("#################################")
        print()

        x = queue.Queue()
        y = queue.Queue()
        z = queue.Queue()
        besties = queue.Queue()
        names = queue.Queue()
        iters = queue.Queue()

        if isinstance(self.listModels, str):
            if self.listModels == 'all':
                self.listModels = [
                    'x', 'rrc', 'sgd', 'knn', 'svm', 'rbf', 'dtc', 'rdc',
                    'etc', 'gbc', 'abc', 'bac', 'lda', 'qda', 'gnb'
                ]
            else:
                self.listModels = ['x']

        n = 4
        mods = [self.listModels[i::n] for i in range(n)]

        threads = []
        for part in mods:
            thread = threading.Thread(target=self.optimization,
                                      args=(part, n_gen, n_gen_vnd, kmax,
                                            n_neighbors, data, dummiesList,
                                            createDummies, normalize, metric,
                                            x, y, besties, names, iters))
            threads.append(thread)
            thread.start()

        for thread in threads:
            thread.join()

        return utility.res(heuristic="Recherche à voisinage variable",
                           x=list(x.queue),
                           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)
예제 #3
0
    def init(self, n_pop, n_gen, cross_proba, F, data, dummiesList,
             createDummies, normalize, metric):

        print("#######################################")
        print("#ALGORITHME A EVOLUTION DIFFERENTIELLE#")
        print("#######################################")
        print()

        x = queue.Queue()
        y = queue.Queue()
        z = queue.Queue()
        besties = queue.Queue()
        names = queue.Queue()
        iters = queue.Queue()

        if isinstance(self.listModels, str):
            if self.listModels == 'all':
                self.listModels = [
                    'x', 'rrc', 'sgd', 'knn', 'svm', 'rbf', 'dtc', 'rdc',
                    'etc', 'gbc', 'abc', 'bac', 'lda', 'qda', 'gnb'
                ]
            else:
                self.listModels = ['x']

        n = 4
        mods = [self.listModels[i::n] for i in range(n)]

        threads = []
        for part in mods:
            thread = threading.Thread(target=self.natural_selection,
                                      args=(part, n_pop, n_gen, cross_proba, F,
                                            data, dummiesList, createDummies,
                                            normalize, metric, x, y, besties,
                                            names, iters))
            threads.append(thread)
            thread.start()

        for thread in threads:
            thread.join()

        return utility.res(heuristic="Evolution différentielle",
                           x=list(x.queue),
                           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,
                           self=self)
예제 #4
0
    def init(self, temperature, alpha, final_temperature, data, dummiesList,
             createDummies, normalize, metric):

        print("###############")
        print("#RECUIT SIMULE#")
        print("###############")
        print()

        x = queue.Queue()
        y = queue.Queue()
        z = queue.Queue()
        besties = queue.Queue()
        names = queue.Queue()
        iters = queue.Queue()

        if isinstance(self.listModels, str):
            if self.listModels == 'all':
                self.listModels = [
                    'x', 'rrc', 'sgd', 'knn', 'svm', 'rbf', 'dtc', 'rdc',
                    'etc', 'gbc', 'abc', 'bac', 'lda', 'qda', 'gnb'
                ]
            else:
                self.listModels = ['x']

        n = 4
        mods = [self.listModels[i::n] for i in range(n)]

        threads = []
        for part in mods:
            thread = threading.Thread(
                target=self.optimization,
                args=(part, temperature, alpha, final_temperature, data,
                      dummiesList, createDummies, normalize, metric, x, y,
                      besties, names, iters))
            threads.append(thread)
            thread.start()

        for thread in threads:
            thread.join()

        return utility.res(heuristic="Recuit simulé",
                           x=list(x.queue),
                           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=temperature - 1,
                           self=self)