49ca8c83ca65a1060713d0295d1d206b43933e3b,autokeras/generator.py,HillClimbingClassifierGenerator,generate,#HillClimbingClassifierGenerator#,104

Before Change


            ModelTrainer(self.model, self.x_train, self.y_train, self.x_test, self.y_test, self.verbose).train_model()
            _, optimal_accuracy = self.model.evaluate(self.x_test,self.y_test,verbose=self.verbose)
            models = self._remove_duplicate(net_transfromer(self.model))
            for index in range(0,len(models)):
                models[index].compile(loss=categorical_crossentropy,
                  optimizer=Adadelta(),
                  metrics=["accuracy"])
                ModelTrainer(models[index], self.x_train, self.y_train, self.x_test, self.y_test, self.verbose).train_model()
                _, accuracy = models[index].evaluate(self.x_test, self.y_test, self.verbose)
                if accuracy > optimal_accuracy:
                    optimal_accuracy = accuracy
                    optimal_index = index
                    self.model = models[index]
        return self.model if self.optimal_index is not None else None


After Change


        new_models = self._remove_duplicate(net_transformer(self.model))
        self.history_models += new_models

        accuracy_list = []
        for model in new_models:
            model.compile(loss=categorical_crossentropy,
                          optimizer=Adadelta(),
                          metrics=["accuracy"])
            ModelTrainer(model, self.x_train, self.y_train, self.x_test, self.y_test,
                         self.verbose).train_model()
            _, accuracy = model.evaluate(self.x_test, self.y_test, self.verbose)
            accuracy_list.append(accuracy)

        max_index = np.argmax(np.array(accuracy_list))[0]
        max_accuracy = accuracy_list[max_index]

        if max_accuracy > optimal_accuracy:
            return new_models[max_index]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 12

Instances


Project Name: keras-team/autokeras
Commit Name: 49ca8c83ca65a1060713d0295d1d206b43933e3b
Time: 2017-12-18
Author: jhfjhfj1@gmail.com
File Name: autokeras/generator.py
Class Name: HillClimbingClassifierGenerator
Method Name: generate


Project Name: jhfjhfj1/autokeras
Commit Name: 49ca8c83ca65a1060713d0295d1d206b43933e3b
Time: 2017-12-18
Author: jhfjhfj1@gmail.com
File Name: autokeras/generator.py
Class Name: HillClimbingClassifierGenerator
Method Name: generate


Project Name: deepfakes/faceswap
Commit Name: d2dbd440d89d22b4b75f30ddeb4c4ebd3882ecfa
Time: 2019-05-14
Author: 36920800+torzdf@users.noreply.github.com
File Name: tools/sort.py
Class Name: Sort
Method Name: sort_face_dissim