Beispiel #1
0
def score_training_set():
    # Generate a data frame that points to the challenge files
    tr_files, te_files = phyc.get_files()

    score = Challenge2018Score()
    for i in range(0, np.size(tr_files, 0)):
        gc.collect()
        sys.stdout.write('Evaluating training subject: %d/%d' %
                         (i + 1, np.size(tr_files, 0)))
        sys.stdout.flush()
        record_name = tr_files.header.values[i][:-4]
        predictions = R.classify_record(record_name)

        arousals = phyc.import_arousals(tr_files.arousal.values[i])
        arousals = np.ravel(arousals)

        score.score_record(arousals, predictions, record_name)
        auroc = score.record_auroc(record_name)
        auprc = score.record_auprc(record_name)
        print(' AUROC:%f AUPRC:%f' % (auroc, auprc))

    print()
    auroc_g = score.gross_auroc()
    auprc_g = score.gross_auprc()
    print('Training AUROC Performance (gross): %f' % auroc_g)
    print('Training AUPRC Performance (gross): %f' % auprc_g)
    print()
Beispiel #2
0
def evaluate_test_set():
    # Generate a data frame that points to the challenge files
    tr_files, te_files = phyc.get_files()

    for i in range(0, np.size(te_files, 0)):
        gc.collect()
        print('Evaluating test subject: %d/%d' % (i + 1, np.size(te_files, 0)))
        record_name = te_files.header.values[i][:-4]
        output_file = os.path.basename(record_name) + '.vec'
        predictions = R.classify_record(record_name)
        np.savetxt(output_file, predictions, fmt='%.3f')