Esempio n. 1
0
def main(args):
    in_dir = join(dirname(__file__), '../../data/labeled/')
    out_dir = join(dirname(__file__),
                   '../../output/predictions/{}'.format(args.community))

    if not run_exists(out_dir, args.run_id):
        logger.info('Run %s does not exists. Start new...', args.run_id)
        pred = make_predictions(args)
        save_predictions(pred, out_dir, args.run_id)
        logger.info('Finish training and testing.')

    results_test = evaluation.evaluate(
        csv_true=join(in_dir, '{}_test.csv'.format(args.community)),
        csv_pred=join(out_dir, '{}_test.csv'.format(args.run_id)),
        label_encoder=preprocessing.LABEL_ENCODER)
    evaluation.print_results(results_test, '{}_test'.format(args.run_id))
Esempio n. 2
0
def main(args):
    in_dir = join(dirname(__file__), '../../data/labeled/')
    out_dir = join(dirname(__file__), '../../output/predictions/{}'.format(args.community))

    if not run_exists(out_dir, args.run_id):
        pred = make_predictions(
            join(in_dir, '{}_train.csv'.format(args.community)),
            join(in_dir, '{}_test.csv'.format(args.community)),
            args
        )
        save_predictions(pred, out_dir, args.run_id)

    le = LabelEncoder().fit(['CLEAR', 'UNCLEAR'])

    results_test = evaluation.evaluate(
        csv_true=join(in_dir, '{}_test.csv'.format(args.community)),
        csv_pred=join(out_dir, '{}_test.csv'.format(args.run_id)),
        label_encoder=le
    )
    evaluation.print_results(results_test, '{}_test'.format(args.run_id))