Exemplo n.º 1
0
    def score_both_beta_larger_than_one_aux(self, dst_ds_size, n_units_per_fold, clclf):
        fold_generator = FoldGenerator(dst_ds_size, self.k_units, n_units_per_fold)
        beta = fold_generator.beta()
        print 'n_units_per_fold', n_units_per_fold, 'beta:', beta

        # compute clclf score and write down
        clclf_score = self.score_clclf(clclf, fold_generator)
        self.add_to_scores_file(dst_ds_size, fold_generator.fold_size, n_units_per_fold, beta, self.last_clf_score, clclf_score)
Exemplo n.º 2
0
    def score_both_beta_smaller_than_one(self, clf, clclf, init_n_units_per_fold, dst_ds_size):
        for n_units_per_fold in xrange(init_n_units_per_fold, self.k_units):
            fold_generator = FoldGenerator(dst_ds_size, self.k_units, n_units_per_fold)
            beta = fold_generator.beta()
            print 'n_units_per_fold', n_units_per_fold, 'beta:', beta

            # compute scores and write them down
            clf_score = self.score_clf(clf, fold_generator)
            clclf_score = self.score_clclf(clclf, fold_generator)
            self.add_to_scores_file(dst_ds_size, fold_generator.fold_size, n_units_per_fold, beta, clf_score, clclf_score)

        # save last clf score - this is the CVscore of the clf for beta=0.9
        # namely, the best score we can get for one-language learning..
        self.last_clf_score = clf_score
        self.last_n_units_per_fold = self.k_units