Perform a TPOT run.

def tpot_driver(args):
    """Perform a TPOT run."""
    if args.VERBOSITY >= 2:
        _print_args(args)

    input_data = _read_data_file(args)
    features = input_data.drop(args.TARGET_NAME, axis=1)

    training_features, testing_features, training_target, testing_target = \
        train_test_split(features, input_data[args.TARGET_NAME], random_state=args.RANDOM_STATE)


    tpot_type = TPOTClassifier if args.TPOT_MODE == 'classification' else TPOTRegressor

    scoring_func = load_scoring_function(args.SCORING_FN)

    tpot_obj = tpot_type(
        generations=args.GENERATIONS,
        population_size=args.POPULATION_SIZE,
        offspring_size=args.OFFSPRING_SIZE,
        mutation_rate=args.MUTATION_RATE,
        crossover_rate=args.CROSSOVER_RATE,
        cv=args.NUM_CV_FOLDS,
        subsample=args.SUBSAMPLE,
        n_jobs=args.NUM_JOBS,
        scoring=scoring_func,
        max_time_mins=args.MAX_TIME_MINS,
        max_eval_time_mins=args.MAX_EVAL_MINS,
        random_state=args.RANDOM_STATE,
        config_dict=args.CONFIG_FILE,
        template=args.TEMPLATE,
        memory=args.MEMORY,
        periodic_checkpoint_folder=args.CHECKPOINT_FOLDER,
        early_stop=args.EARLY_STOP,
        verbosity=args.VERBOSITY,
        disable_update_check=args.DISABLE_UPDATE_CHECK
    )

    tpot_obj.fit(training_features, training_target)

    if args.VERBOSITY in [1, 2] and tpot_obj._optimized_pipeline:
        training_score = max([x.wvalues[1] for x in tpot_obj._pareto_front.keys])
        print('\nTraining score: {}'.format(training_score))
        print('Holdout score: {}'.format(tpot_obj.score(testing_features, testing_target)))

    elif args.VERBOSITY >= 3 and tpot_obj._pareto_front:
        print('Final Pareto front testing scores:')
        pipelines = zip(tpot_obj._pareto_front.items, reversed(tpot_obj._pareto_front.keys))
        for pipeline, pipeline_scores in pipelines:
            tpot_obj._fitted_pipeline = tpot_obj.pareto_front_fitted_pipelines_[str(pipeline)]
            print('{TRAIN_SCORE}\t{TEST_SCORE}\t{PIPELINE}'.format(
                    TRAIN_SCORE=int(pipeline_scores.wvalues[0]),
                    TEST_SCORE=tpot_obj.score(testing_features, testing_target),
                    PIPELINE=pipeline
                )
            )

    if args.OUTPUT_FILE:
        tpot_obj.export(args.OUTPUT_FILE)