def run(model, train_set_name, test_set_name, run_name, epochs=None,
        feature_epoch_order=False, create_files=True, run_multi=False):
    print('Training {model_class} on "{train}" ratings'
          .format(model_class=model.__class__.__name__, train=train_set_name))
    if not create_files:
        print("WARNING: 'nofile' flag detected. No model file will be " +
              "saved to disk after this run.\n***MODEL WILL BE LOST.")
        confirm = input("Are you sure you want to continue? [Y/n]")
        if confirm == 'Y' or confirm == 'y' or confirm == '':
            pass
        else:
            return
    if epochs is not None:
        print('Number of epochs:', epochs)
    if model.num_features is not None:
        print('Number of features:', model.num_features)
    train_file_path = join(DATA_DIR_PATH, train_set_name + '.npy')
    stats_file_path = join(DATA_DIR_PATH, 'old_stats', train_set_name +
                           '_stats.p')

    model.debug = True
    train_points = load_numpy_array_from_file(train_file_path)
    stats = load_stats_from_file(stats_file_path)
    test_file_path = join(DATA_DIR_PATH, test_set_name + '.npy')
    test_points = load_numpy_array_from_file(test_file_path)

    # Save run information in [...]_info.txt file
    date_format = '%b-%d'
    time_format = '%H%M'
    latest_commit = Repo('.').commit('HEAD').hexsha
    date_string = strftime(date_format, localtime())
    time_string = strftime(time_format, localtime())
    run_info_file_path = save_run_info(
        model=model, test_set_name=test_set_name,
        train_set_name=train_set_name,
        epochs=epochs,
        time_string=time_string,
        date_string=date_string,
        feature_epoch_order=feature_epoch_order,
        create_files=create_files,
        run_multi=run_multi,
        run_name=run_name,
        commit=latest_commit
    )
    print('Wrote run info to ', run_info_file_path)
    rmse_file_path = run_info_file_path.replace('info.json', 'rmse.txt')
    predictions_file_name = (run_info_file_path.split('/')[-1]
                             .replace('info.json', 'predictions.dta'))
    if not run_multi:
        if not feature_epoch_order:
            model.train(train_points, stats=stats, epochs=epochs)
        else:
            model.train_feature_epoch(train_points=train_points, stats=stats,
                                      epochs=epochs)
    else:
        print("Training multi!")
        for epoch in range(epochs):
            if epoch == 0:
                model.train(train_points, stats=stats, epochs=1)
            else:
                model.train_more(epochs=1)
            if create_files:
                print('Predicting "{test}" ratings'.format(test=test_set_name))
                predict_and_save_rmse(
                    model, test_points=test_points,
                    rmse_file_path=rmse_file_path,
                    keep_predictions=(create_files and epoch == epochs-1),
                    predictions_file_name=predictions_file_name
                )
    model.train_points = None
    if create_files:
        model_file_name = (run_info_file_path.split('/')[-1]
                           .replace('info.json', 'model.p'))
        save_model(model, model_file_name)
        if not run_multi:
            # duplicate save if run_multi
            print('Predicting "{test}" ratings'.format(test=test_set_name))
            predict_and_save_rmse(model, test_points=test_points,
                                  rmse_file_path=rmse_file_path,
                                  keep_predictions=True,
                                  predictions_file_name=predictions_file_name)
dataset/ETHPy150Open jvanbrug/netflix/scripts/run_model.py/run/original