elif opt == "--output_format":
            out_format = val
        elif opt == "--core_in_dir":
            core_in_dir = val
        elif opt == "--core_filter":
            core_filter = val
        elif opt in ("-h", "--help"):
            usage()
            sys.exit(0)
        else:
            usage(1)

    log_utils.config_logging(log_file)

    utils.assert_option_not_none(in_file_prefix, "Input file prefix required", usage)
    utils.assert_option_not_none(out_dir, "Output directory required", usage)
    utils.assert_option_not_none(in_format, "Input file format required", usage)

    gz = eval(gz)
    utils.assert_bool(gz, "--gz value must be True/False", usage)

    if not core_in_dir is None:
        build_space_batch(in_file_prefix, in_format, out_dir, out_format, core_in_dir, core_filter, gz)
    else:
        utils.assert_option_not_none(core_space_file, "Input file required", usage)
        build_space(in_file_prefix, in_format, out_dir, out_format, core_space_file, gz)


if __name__ == "__main__":
    main(sys.argv)
Exemple #2
0
            usage()
            sys.exit(0)
        else:
            usage(1)

    log_utils.config_logging(log_file)

    utils.assert_option_not_none(in_file, "Input file required", usage)
    utils.assert_option_not_none(out_dir, "Output directory required", usage)
    utils.assert_option_not_none(model, "Model to be trained required", usage)
    utils.assert_option_not_none(arg_space, "Argument space(s) file(s) required", usage)
    utils.assert_option_not_none(phrase_space, "Phrase space file required", usage)

    crossvalidation = eval(crossvalidation)
    intercept = eval(intercept)
    utils.assert_bool(intercept, "intercept must be True/False", usage)
    utils.assert_bool(crossvalidation, "crossvalidation must be True/False", usage)

    export_params = eval(export_params)
    utils.assert_bool(export_params, "export_params must be True/False", usage)
    if not param is None:
        param = float(param)
    if not param_range is None:
        param_range = [float(param) for param in param_range]

    if not crossvalidation and regression == "ridge":
        utils.assert_option_not_none(param, "Cannot run (no-crossvalidation) RidgeRegression with no lambda value!", usage)

    train_model(in_file, out_dir, model, arg_space, phrase_space, regression,
                crossvalidation, intercept, param, param_range, export_params)
Exemple #3
0
        else:
            usage(1)

    log_utils.config_logging(log_file)

    utils.assert_option_not_none(in_file, "Input file required", usage)
    utils.assert_option_not_none(out_dir, "Output directory required", usage)
    utils.assert_option_not_none(model, "Model to be trained required", usage)
    utils.assert_option_not_none(arg_space,
                                 "Argument space(s) file(s) required", usage)
    utils.assert_option_not_none(phrase_space, "Phrase space file required",
                                 usage)

    crossvalidation = eval(crossvalidation)
    intercept = eval(intercept)
    utils.assert_bool(intercept, "intercept must be True/False", usage)
    utils.assert_bool(crossvalidation, "crossvalidation must be True/False",
                      usage)

    export_params = eval(export_params)
    utils.assert_bool(export_params, "export_params must be True/False", usage)
    if not param is None:
        param = float(param)
    if not param_range is None:
        param_range = [float(param) for param in param_range]

    if not crossvalidation and regression == "ridge":
        utils.assert_option_not_none(
            param,
            "Cannot run (no-crossvalidation) RidgeRegression with no lambda value!",
            usage)
Exemple #4
0
            normalizations = val.split(",")
        elif opt in ("-l", "--log"):
            log_file = val
        elif opt == "--input_format":
            in_format = val
        elif opt == "--output_format":
            out_format = val
        elif opt in ("-h", "--help"):
            usage(0)
        else:
            usage(1)

    if not log_file is None:
        log_utils.config_logging(log_file)

    utils.assert_option_not_none(in_file_prefix, "Input file prefix required",
                                 usage)
    utils.assert_option_not_none(out_dir, "Output directory required", usage)
    utils.assert_option_not_none(in_format, "Input format required", usage)

    gz = eval(gz)

    utils.assert_bool(gz, "--gz value must be True/False", usage)

    build_spaces(in_file_prefix, in_format, out_dir, out_format, weightings,
                 selections, reductions, normalizations, gz)


if __name__ == '__main__':
    main(sys.argv)