示例#1
0
def main():
    entity = Entity()
    initialize(entity)
    print 'Press the Enter key to terminate this time tracking ...'

    while True:
        enter = raw_input()
        if enter == '':
            set_stop_time(entity)
            break

    display_summary(entity)
    util.write_results_to_file(entity)
示例#2
0
    def predict(self, photo_ids, data):
        predictions = self.predict_bulk(data)
        accuracy = util.compute_test_accuracy(
            labels=data[:, -1], predictions=predictions,
        )

        if self.output_filename is not None:
            util.write_results_to_file(
                photo_ids=photo_ids,
                predictions=predictions,
                filepath=self.output_filename,
            )

        print("Accuracy on test set = %f" % accuracy)

        return predictions
示例#3
0
def main():
    c, d, m = read_problem_file("../data/problem/" + PROBLEM)
    population = Population(customers=c,
                            depots=d,
                            max_vehicles=m,
                            size=POPULATION_SIZE,
                            p_crossover=CROSSOVER_PROBABILITY,
                            p_intra=INTRA_DEPOT_PROBABILITY,
                            p_inter=INTER_DEPOT_PROBABILITY,
                            elites=ELITES)
    try:
        for generation in range(0, GENERATIONS):
            population.evolve()
            print("generation:", generation)
            population.print_summary()
    except KeyboardInterrupt:
        print("\nAborting")
    finally:
        print(population.print_summary())
        write_results_to_file(
            population.best,
            PROBLEM + "-" + str(int(population.best.calculate_distance()[0])))
示例#4
0
    y_pheno, m, _, estimated_h2 = stepwise.warped_stepwise(Y, X, K, covariates=covar,
                                                           max_covariates=options.max_covariates, num_restarts=options.random_restarts,
                                                           qv_cutoff=options.qv_cutoff,
                                                           pv_cutoff=options.pv_cutoff)

    pv, h2 = fastlmm.assoc_scan(y_pheno.copy(), X, covariates=covar, K=K)

    
    if options.out_dir is None:
        results_file_name = options.phenotype_file.replace('.txt', '')
        results_file_name += "_warpedlmm_results.txt"
    else:
        results_file_name = options.out_dir + "/warpedlmm_results.txt"

    util.write_results_to_file(snp_data, pv, results_file_name)


    if options.normal:
        pv_base, h2_base = fastlmm.assoc_scan(Y.copy(), X, covariates=covar, K=K)
        util.write_results_to_file(snp_data, pv_base, results_file_name.replace('warpedlmm', 'fastlmm'))

    if options.save:
        if options.out_dir is None:
            pheno_file_name = options.phenotype_file.replace('.txt', '')
            pheno_file_name += "_warpedlmm_pheno.txt"
            trafo_file_name = options.phenotype_file.replace('.txt', '')
            trafo_file_name += "_warpedlmm_transformation.png"
        else:
            pheno_file_name = options.out_dir + "/warpedlmm_pheno.txt"
            trafo_file_name = options.out_dir + "/warpedlmm_transformation.png"
示例#5
0
        K,
        covariates=covar,
        max_covariates=options.max_covariates,
        num_restarts=options.random_restarts,
        qv_cutoff=options.qv_cutoff,
        pv_cutoff=options.pv_cutoff)

    pv, h2 = fastlmm.assoc_scan(y_pheno.copy(), X, covariates=covar, K=K)

    if options.out_dir is None:
        results_file_name = options.phenotype_file.replace('.txt', '')
        results_file_name += "_warpedlmm_results.txt"
    else:
        results_file_name = options.out_dir + "/warpedlmm_results.txt"

    util.write_results_to_file(snp_data, pv, results_file_name)

    if options.normal:
        pv_base, h2_base = fastlmm.assoc_scan(Y.copy(),
                                              X,
                                              covariates=covar,
                                              K=K)
        util.write_results_to_file(
            snp_data, pv_base,
            results_file_name.replace('warpedlmm', 'fastlmm'))

    if options.save:
        if options.out_dir is None:
            pheno_file_name = options.phenotype_file.replace('.txt', '')
            pheno_file_name += "_warpedlmm_pheno.txt"
            trafo_file_name = options.phenotype_file.replace('.txt', '')