Ejemplo n.º 1
0
def calculate_params_for_d_score(classifier, experiment):
    score = classifier.score(experiment, True)
    experiment.set_and_rerank("classifier_score", score)

    td_scores = experiment.get_top_decoy_peaks()["classifier_score"]

    mu, nu = mean_and_std_dev(td_scores)
    return mu, nu
Ejemplo n.º 2
0
def calculate_params_for_d_score(classifier, experiment):
    score = classifier.score(experiment, True)
    experiment.set_and_rerank("classifier_score", score)

    td_scores = experiment.get_top_decoy_peaks()["classifier_score"]

    mu, nu = mean_and_std_dev(td_scores)
    return mu, nu
Ejemplo n.º 3
0
    def learn_randomized(self, experiment):
        assert isinstance(experiment, Experiment)

        num_iter = CONFIG.get("semi_supervised_learner.num_iter")
        logging.info("start learn_randomized")

        fraction = CONFIG.get("xeval.fraction")
        is_test = CONFIG.get("is_test")
        experiment.split_for_xval(fraction, is_test)
        train = experiment.get_train_peaks()

        train.rank_by("main_score")

        params, clf_scores = self.start_semi_supervised_learning(train)

        train.set_and_rerank("classifier_score", clf_scores)

        # semi supervised iteration:
        for inner in range(num_iter):
            params, clf_scores = self.iter_semi_supervised_learning(train)
            train.set_and_rerank("classifier_score", clf_scores)

        # after semi supervised iteration: classify full dataset
        clf_scores = self.score(experiment, params)
        mu, nu = mean_and_std_dev(clf_scores)
        experiment.set_and_rerank("classifier_score", clf_scores)

        td_scores = experiment.get_top_decoy_peaks()["classifier_score"]

        mu, nu = mean_and_std_dev(td_scores)
        experiment["classifier_score"] = (experiment["classifier_score"] -
                                          mu) / nu
        experiment.rank_by("classifier_score")

        top_test_peaks = experiment.get_top_test_peaks()

        top_test_target_scores = top_test_peaks.get_target_peaks(
        )["classifier_score"]
        top_test_decoy_scores = top_test_peaks.get_decoy_peaks(
        )["classifier_score"]

        logging.info("end learn_randomized")

        return top_test_target_scores, top_test_decoy_scores, params
Ejemplo n.º 4
0
    def calculate_params_for_d_score(self, classifier, experiment):
        score = classifier.score(experiment, True)
        experiment.set_and_rerank("classifier_score", score)

        if (CONFIG.get("final_statistics.fdr_all_pg")):
            td_scores = experiment.get_decoy_peaks()["classifier_score"]
        else:
            td_scores = experiment.get_top_decoy_peaks()["classifier_score"]

        mu, nu = mean_and_std_dev(td_scores)
        return mu, nu, score
Ejemplo n.º 5
0
def calculate_params_for_d_score(classifier, experiment):
    score = classifier.score(experiment, True)
    experiment.set_and_rerank("classifier_score", score)

    if (CONFIG.get("final_statistics.fdr_all_pg")):
        td_scores = experiment.get_decoy_peaks()["classifier_score"]
    else:
        td_scores = experiment.get_top_decoy_peaks()["classifier_score"]

    mu, nu = mean_and_std_dev(td_scores)
    return mu, nu
Ejemplo n.º 6
0
    def learn_randomized(self, experiment):
        assert isinstance(experiment, Experiment)

        num_iter = CONFIG.get("semi_supervised_learner.num_iter")
        logging.info("start learn_randomized")

        fraction = CONFIG.get("xeval.fraction")
        is_test = CONFIG.get("is_test")
        experiment.split_for_xval(fraction, is_test)
        train = experiment.get_train_peaks()

        train.rank_by("main_score")

        params, clf_scores = self.start_semi_supervised_learning(train)

        train.set_and_rerank("classifier_score", clf_scores)

        # semi supervised iteration:
        for inner in range(num_iter):
            params, clf_scores = self.iter_semi_supervised_learning(train)
            train.set_and_rerank("classifier_score", clf_scores)

        # after semi supervised iteration: classify full dataset
        clf_scores = self.score(experiment, params)
        mu, nu = mean_and_std_dev(clf_scores)
        experiment.set_and_rerank("classifier_score", clf_scores)

        td_scores = experiment.get_top_decoy_peaks()["classifier_score"]

        mu, nu = mean_and_std_dev(td_scores)
        experiment["classifier_score"] = (experiment["classifier_score"] - mu) / nu
        experiment.rank_by("classifier_score")

        top_test_peaks = experiment.get_top_test_peaks()

        top_test_target_scores = top_test_peaks.get_target_peaks()["classifier_score"]
        top_test_decoy_scores = top_test_peaks.get_decoy_peaks()["classifier_score"]

        logging.info("end learn_randomized")

        return top_test_target_scores, top_test_decoy_scores, params
Ejemplo n.º 7
0
	def pvalues(self, target_scores, decoy_scores):
		#print "LOG NORMAL NULL MODEL:"
		corr = - np.min(decoy_scores) + 0.0001
		mu, nu = mean_and_std_dev(np.log(decoy_scores + corr))
		#print mu, nu, np.min(decoy_scores)
		return 1.0 - pnorm(np.log(target_scores + corr), mu, nu)
Ejemplo n.º 8
0
	def pvalues(self, target_scores, decoy_scores):
		mu, nu = mean_and_std_dev(decoy_scores)
		return 1.0 - pnorm(target_scores, mu, nu)