diff --git a/.gitignore b/.gitignore index 89d102c..1d1298d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .DS_Store .ipynb_checkpoints env/ +models/ exports/ __pycache__/ virtualenv-ml-conversational/ \ No newline at end of file diff --git a/README.md b/README.md index ecf166e..c9150e4 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,8 @@ python ./ml-conversational-analytic-tool/run.py 0: + save_model(model=model, name=save_name+"-"+outcome, version=model_ver) return scores @@ -46,6 +67,10 @@ def run(annotated_filename, dataset_filename, outcome, encoding_type, model_type parser.add_argument('dataset_filename', help='File location of extracted dataset') parser.add_argument('model', help='Model type to use for training, supported CNN and LSTM') parser.add_argument('outcome', help='Inclusive, Constructive, or Both') + parser.add_argument('-save', metavar='NAME', help='Save the model using given NAME') + parser.add_argument('-save_version', metavar='VERSION', default='001', + help='Together with -save NAME: save the model using given NAME and VERSION. '\ + 'If omitted, 001 is used. The parameter is ignored if -save is missing.') parser.add_argument('-roleRelevant', action='store_true', default=False, help='Encoding method differentiates b/w conversation roles') parser.add_argument('-pad', action='store_true', default=False, help='Pad total length of each pull') @@ -60,13 +85,14 @@ def run(annotated_filename, dataset_filename, outcome, encoding_type, model_type encodingType = 'role-agnostic' if args.outcome != 'Both': - run_res = run(args.annotated_filename, args.dataset_filename, args.outcome, encodingType, args.model, args.pad) + run_res = run(args.annotated_filename, args.dataset_filename, args.outcome, encodingType, + args.model, args.pad, args.save, args.save_version) print(run_res) else: run_res_constructive = run(args.annotated_filename, args.dataset_filename, 'Constructive', encodingType, - args.model, args.pad) + args.model, args.pad, args.save, args.save_version) print("Constructive: {}".format(run_res_constructive)) - run_res_inclusive = run(args.annotated_filename, args.dataset_filename, 'Inclusive', encodingType, args.model, - args.pad) + run_res_inclusive = run(args.annotated_filename, args.dataset_filename, 'Inclusive', encodingType, + args.model, args.pad, args.save, args.save_version) print("Inclusvie: {}".format(run_res_inclusive))