with argparse - and use with simple run python <file_name>.py -E 10. Works with or without if __name__=="__main__"
expanded keys via --nepochs should be single word without non-ABC symbols
habr argparse notes
parser = argparse.ArgumentParser()
parser.add_argument(
"--data_path",
default="./output",
help="the location where the processed NYC taxi trip data was saved."
)
parser.add_argument(
"--top_n",
default=5,
type=int,
help="the top 'top_n' models will be evaluated to decide which model to promote."
)
args = parser.parse_args()
- with sys
import sys
def run():
taxi_type = sys.argv[1] # fhv - for-hire vehicles
year = int(sys.argv[2]) # 2021
month = int(sys.argv[3]) # month of using data
...
python <file_name>.py -E 10
. Works with or withoutif __name__=="__main__"
expanded keys via --nepochs should be single word without non-ABC symbols habr argparse notesParameters
parser = argparse.ArgumentParser(description="Train model", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("-E","--nepochs", help="number of epochs") parser.add_argument("-L","--lrate", help="learning rate") parser.add_argument("-I","--isize", help="inner size") parser.add_argument("-D","--drate", help="drop rate") parser.add_argument("-O","--output", help="output file") args = parser.parse_args()
n_epochs = 50 nepochs = args.nepochs
if nepochs != None: n_epochs = int(nepochs)
if name == 'main':
import sys
def run(): taxi_type = sys.argv[1] # fhv - for-hire vehicles year = int(sys.argv[2]) # 2021 month = int(sys.argv[3]) # month of using data ...
if name == 'main':
run()