以下是我的代码的一部分:
if __name__ == "__main__":
# Inputs for the main function
parser = argparse.ArgumentParser(
description="A script that emulates the competition's scoring process, "
"the hider (from hider.py) is run against the seeker (from seeker.py)."
)
parser.add_argument(
"-d",
"--data_path",
metavar="PATH",
default="./data/amsterdam_subset_1A.csv", # !!! I changed this to 1% data file, originally is full data
type=str,
help="Data file path (Amsterdam dataset). Defaults to './data/train_longitudinal_data.csv'.",
)
parser.add_argument(
"-o",
"--output_dir",
metavar="PATH",
default="./output",
type=str,
help="Output directory. Defaults to './output'.",
)
parser.add_argument(
"-m", "--max_seq_len", metavar="INT", default=100, type=int, help="Max sequence length limit. Defaults to 100."
)
parser.add_argument(
"-t", "--train_frac", default=0.5, metavar="FLOAT", type=float, help="Training set fraction. Defaults to 0.5."
)
parser.add_argument(
"-f",
"--feature_prediction_no",
metavar="INT",
default= int(5),
type=int,
help="Number of features in the subset of features used to run feature prediction "
"(part of hider evaluation). Defaults to 5.",
)
parser.add_argument("-s", "--seed", metavar="INT", default=0, type=int, help="Random seed. Defaults to 0.")
parser.add_argument(
"-g",
"--debug_data",
metavar="INT",
default=0,
type=int,
help="Set this to a non-0 value to use a 'debug' subset of the dataset instead of the whole dataset "
"(useful for speedy debugging), only the first --debug_data many rows of the data file will be loaded. "
"Defaults to 0.",
)
parser.add_argument(
"--skip_fp", action="store_true", default=False, help="Skip feature prediction step of hider evaluation if set."
)
parser.add_argument(
"--skip_osa",
action="store_true",
default=False,
help="Skip one-step-ahead prediction step of hider evaluation if set.",
)
parser.add_argument(
"--eval_verbose",
action="store_true",
default=False,
help="If set, the underlying training in hider evaluation stages will be shown verbosely "
"(training epoch etc.).",
)
parser.add_argument(
"--timegan_opt",
choices = ['Adam', 'dpgrad', 'noisyadam'],
default = 'Adam',
type = str)
parser.add_argument(
"--algorithm",
choices = ["add_noise", "timegan"],
default = "timegan",
type = str)
parsed_args, unknown = parser.parse_known_args()
#parsed_args = parser.parse_args()
# Call main function
main(parsed_args)
我的问题是当我尝试在jupyter笔记本中运行它时,它给了我这个错误:
Traceback (most recent call last):
File "C:\Users\zyr13\anaconda3\lib\argparse.py", line 2409, in _get_value
result = type_func(arg_string)
ValueError: invalid literal for int() with base 10: 'C:\\Users\\zyr13\\AppData\\Roaming\\jupyter\\runtime\\kernel-2789c574-de13-44e2-aadc-3d7a8a319564.json'
似乎有一些奇怪的目录传递给参数“ feature_prediction_no”。如您所见,默认值为5,所以我希望应该传递5,但是结果清楚地表明这不会发生。 我一直在寻找this线程,并且思考可能是类似的问题,但是它没有给出足够清晰的说明。我正在为我的特殊情况寻找答案,并提供一些解释,发生了什么事?