def parse_args():
    p = DefaultHelpParser(
        description='Model runner for KDD 2014 kaggle competition.')

    p.add_argument(
        '--model',
        required=True,
        dest='model_name',
        action='store',
        choices=models.keys(),
        help='the name of the model to run'
    )

    p.add_argument(
        '--submit',
        dest='submit',
        action='store_true',
        help='toggle on to run for a submission'
    )

    args = p.parse_args()
    return args
            line[1],
            line[2],
            '{:.5f}'.format(line[3])
        ))


if __name__ == '__main__':
    args = parse_args()

    mr = ModelRunner()

    model_name = args.model_name
    if model_name not in models:
        raise Exception('\n`{}` is not a valid model\n\nmodels:\n  {}'.format(
            model_name,
            '\n  '.join(models.keys())
        ))
    mr.init(model_name)

    # train
    if not args.submit:
        predictions = mr.train_model()
        sname = 'output/{}-{}-{}.stats.txt'.format(
            datetime.utcnow().strftime('%Y%m%d%H%M%S'),
            model_name,
            git_hash
        )
        stats = mr.stats(predictions)
        print('')
        for line in stats:
            print(line)