Example #1
0
    def trainingMethod(self, kindDataSet):

        self.model = GaussianNB()
        self.GaussianNBAlgorithm = self.model.fit(self.dataset, self.target)

        if kindDataSet == 1:
            params = 'Params:default'
            self.performanceData = responseTraining.responseTraining(
                self.GaussianNBAlgorithm, 'GaussianNB', params,
                self.validation)
            self.performanceData.estimatedMetricsPerformance(
                self.dataset, self.target)
        else:
            params = 'Params:default'
            self.performanceData = responseTraining.responseTraining(
                self.GaussianNBAlgorithm, 'GaussianNB', params,
                self.validation)
            self.performanceData.estimatedMetricsPerformanceMultilabels(
                self.dataset, self.target)
Example #2
0
    def trainingMethod(self, kindDataSet):

        self.model = AdaBoostClassifier(n_estimators=self.n_estimators,
                                        algorithm=self.algorithm)
        self.AdaBoostAlgorithm = self.model.fit(self.dataset, self.target)

        if kindDataSet == 1:  #binary
            params = "algorithm:%s-n_estimators:%d" % (self.algorithm,
                                                       self.n_estimators)
            self.performanceData = responseTraining.responseTraining(
                self.AdaBoostAlgorithm, 'AdaBoost', params, self.validation)
            self.performanceData.estimatedMetricsPerformance(
                self.dataset, self.target)
        else:
            params = "algorithm:%s-n_estimators:%d" % (self.algorithm,
                                                       self.n_estimators)
            self.performanceData = responseTraining.responseTraining(
                self.AdaBoostAlgorithm, 'AdaBoost', params, self.validation)
            self.performanceData.estimatedMetricsPerformanceMultilabels(
                self.dataset, self.target)
Example #3
0
    def trainingMethod(self, kindDataSet):

        self.model = BaggingClassifier(n_estimators=self.n_estimators,
                                       bootstrap=self.bootstrap,
                                       n_jobs=-1)
        self.BagginAlgorithm = self.model.fit(self.dataset, self.target)

        if kindDataSet == 1:  #binary
            params = "n_estimators:%d-bootstrap:%s" % (self.n_estimators,
                                                       self.bootstrap)
            self.performanceData = responseTraining.responseTraining(
                self.BagginAlgorithm, 'Baggin', params, self.validation)
            self.performanceData.estimatedMetricsPerformance(
                self.dataset, self.target)
        else:
            params = "n_estimators:%d-bootstrap:%s" % (self.n_estimators,
                                                       self.bootstrap)
            self.performanceData = responseTraining.responseTraining(
                self.BagginAlgorithm, 'Baggin', params, self.validation)
            self.performanceData.estimatedMetricsPerformanceMultilabels(
                self.dataset, self.target)
Example #4
0
    def trainingMethod(self, kindDataSet):

        self.model=MLPClassifier(hidden_layer_sizes=self.hidden_layer_sizes,activation=self.activation,solver=self.solver,learning_rate=self.learning_rate)
        self.MLPAlgorithm=self.model.fit(self.dataset,self.target)

        params = "activation:%s-learning_rate:%s-solver:%s-hidden_layer_sizes_a:%d-hidden_layer_sizes_b:%d-hidden_layer_sizes_c:%d-alpha:%f-max_iter:%d-shuffle:%s" % (self.activation, self.learning_rate, self.solver,self.hidden_layer_sizes[0], self.hidden_layer_sizes[1], self.hidden_layer_sizes[2], self.alpha, self.max_iter, self.shuffle)
        self.performanceData = responseTraining.responseTraining(self.MLPAlgorithm, 'MLP', params, self.validation)

        if kindDataSet == 1:
            self.performanceData.estimatedMetricsPerformance(self.dataset, self.target)
        else:
            self.performanceData.estimatedMetricsPerformanceMultilabels(self.dataset, self.target)
Example #5
0
    def trainingMethod(self, kindDataSet):
        self.model = tree.DecisionTreeClassifier(criterion=self.criterion,
                                                 splitter=self.splitter)
        self.DecisionTreeAlgorithm = self.model.fit(self.dataset, self.target)

        if kindDataSet == 1:
            params = "criterion:%s-splitter:%s" % (self.criterion,
                                                   self.splitter)
            self.performanceData = responseTraining.responseTraining(
                self.DecisionTreeAlgorithm, 'DecisionTree', params,
                self.validation)
            self.performanceData.estimatedMetricsPerformance(
                self.dataset, self.target)

        else:
            params = "criterion:%s-splitter:%s" % (self.criterion,
                                                   self.splitter)
            self.performanceData = responseTraining.responseTraining(
                self.DecisionTreeAlgorithm, 'DecisionTree', params,
                self.validation)
            self.performanceData.estimatedMetricsPerformanceMultilabels(
                self.dataset, self.target)
Example #6
0
    def trainingMethod(self, kindDataSet):

        self.model = GradientBoostingClassifier(n_estimators=self.n_estimators)
        self.GradientAlgorithm = self.model.fit(self.dataset, self.target)

        params = "n_estimators:%d-loss:%s-min_samples_leaf:%d-min_samples_split:%d" % (
            self.n_estimators, self.loss, self.min_samples_leaf,
            self.min_samples_split)
        self.performanceData = responseTraining.responseTraining(
            self.GradientAlgorithm, 'Gradient', params, self.validation)

        if kindDataSet == 1:
            self.performanceData.estimatedMetricsPerformance(
                self.dataset, self.target)
        else:
            self.performanceData.estimatedMetricsPerformanceMultilabels(
                self.dataset, self.target)
Example #7
0
    def trainingMethod(self, kindDataSet):

        self.model = NuSVC(kernel=self.kernel,
                           degree=self.degree,
                           gamma=self.gamma,
                           nu=self.nu,
                           probability=True)
        self.NuSVMAlgorithm = self.model.fit(self.dataset, self.target)

        params = "kernel:%s-degree:%f-gamma:%f-nu:%f-probability:True" % (
            self.kernel, self.degree, self.gamma, self.nu)
        self.performanceData = responseTraining.responseTraining(
            self.NuSVMAlgorithm, 'NuSVM', params, self.validation)

        if kindDataSet == 1:
            self.performanceData.estimatedMetricsPerformance(
                self.dataset, self.target)
        else:
            self.performanceData.estimatedMetricsPerformanceMultilabels(
                self.dataset, self.target)
Example #8
0
    def trainingMethod(self, kindDataSet):

        self.model = KNeighborsClassifier(n_neighbors=self.n_neighbors,
                                          weights=self.weights,
                                          algorithm=self.algorithm,
                                          metric=self.metric,
                                          n_jobs=-1)  #instancia
        self.knnAlgorithm = self.model.fit(self.dataset, self.response)

        #training...
        params = "algorithm:%s-metric:%s-neighbors:%d-weights:%s" % (
            self.algorithm, self.metric, self.n_neighbors, self.weights)
        self.performanceData = responseTraining.responseTraining(
            self.knnAlgorithm, 'KNN', params, self.validation)

        if kindDataSet == 1:
            self.performanceData.estimatedMetricsPerformance(
                self.dataset, self.response)
        else:
            self.performanceData.estimatedMetricsPerformanceMultilabels(
                self.dataset, self.response)
Example #9
0
    def trainingMethod(self, kindDataSet):
        self.model = RandomForestClassifier(
            n_estimators=self.n_estimators,
            criterion=self.criterion,
            min_samples_leaf=self.min_samples_leaf,
            min_samples_split=self.min_samples_split,
            bootstrap=self.bootstrap,
            n_jobs=-1)
        self.RandomForestAlgorithm = self.model.fit(self.dataset, self.target)

        params = "criterion:%s-n_estimators:%d-min_samples_leaf:%d-min_samples_split:%d-bootstrap:%s" % (
            self.criterion, self.n_estimators, self.min_samples_leaf,
            self.min_samples_split, self.bootstrap)
        self.performanceData = responseTraining.responseTraining(
            self.RandomForestAlgorithm, 'RandomForest', params,
            self.validation)

        if kindDataSet == 1:
            self.performanceData.estimatedMetricsPerformance(
                self.dataset, self.target)
        else:
            self.performanceData.estimatedMetricsPerformanceMultilabels(
                self.dataset, self.target)