-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_exp.py
executable file
·46 lines (40 loc) · 2.17 KB
/
run_exp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#! /usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Alexander Whillas <[email protected]>"
import argparse
from lib.ml_framework import Experiment
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="""
Run an experiment. General interface to machine learning scripts. The string parameter is a
pipeline of scripts that can be executed, with the output of one feed into the input of the next. You
can specify which computations you want to execute. Store the results of each part of the computation
to disk.
""")
parser.add_argument('data',\
help="Section ID in the config file that points to the experiment variables.")
parser.add_argument('-n', '--name', default="",
help="Name used to label the output and working sets.")
parser.add_argument('-m', '--comment', default="",
help="Comment to be logged with the output.")
parser.add_argument('script', nargs='+',
help="Script pipe, an ordered list of scripts to run.")
parser.add_argument('-r', '--regularization', default=0.33, type=float,
help="MEMM's regularization constant.")
parser.add_argument('-i', '--maxiter', default=1, type=int,
help="Maximum iterations for the MEMM's param. optimisation.")
parser.add_argument('-a', '--ambiguity', default=0.1, type=float,
help="Multi-tagging ambiguity level. The lower the closer to zero is more ambiguous.")
parser.add_argument('-f', '--fold', default=0, type=int,
help="Fold to train/test/tag with in 10-fold cross-validation.")
parser.add_argument('-c', '--config', default='./config.ini',
help='Path to a config file to use. If not provided "config.ini" in the same folder is assumed.')
parser.add_argument('-nc', '--no-cache', default=False, action='store_const', const=True,
help='Do not load saved modules from file.')
parser.add_argument('-ns', '--no-save', default=False, action='store_const', const=True,
help='Do not save modules to disk after a run.')
parser.add_argument('-nl', '--no-log', default=False, action='store_const', const=True,
help='Do not log the results of the experiment.')
args = parser.parse_args()
if args.data and len(args.script) > 0:
e = Experiment(args)
e.run()