-
Notifications
You must be signed in to change notification settings - Fork 0
/
experiment_profile.py
executable file
·50 lines (37 loc) · 1.38 KB
/
experiment_profile.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
47
48
49
50
import argparse
import utilities.configutils as cfgutils
from experiment.base import Experiment
ap = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawTextHelpFormatter)
# ap.add_argument('--train',
# metavar='TRAIN',
# default="20news",
# choices=['imdb', 'amt_imdb', 'sraa', '20news', 'twitter','arxiv', 'twitter-gender'],
# help='training data (libSVM format)')
ap.add_argument('--verbose',
action='store_true',
help='to print progress of experiment')
ap.add_argument('--debug',
action='store_true',
help='to print query details of experiment')
ap.add_argument('--config',
metavar='CONFIG_FILE',
type=str,
default='./default.cfg',
help='Experiment configuration file')
args = ap.parse_args()
config = cfgutils.get_config(args.config)
def profile_experiment():
experiment = Experiment(config, verbose=args.verbose, debug=args.debug)
experiment.start()
def main():
from time import time
import cProfile
t0 = time()
print "=" * 80
print "RUNNING - UTILITY BASED"
cProfile.run('profile_experiment()')
t1 = time()
print "\nElapsed time: %.3f secs (%.3f mins)" % ((t1-t0), (t1-t0)/60)
if __name__ == "__main__":
main()