-
-
Notifications
You must be signed in to change notification settings - Fork 135
/
runscores.py
34 lines (25 loc) · 1.07 KB
/
runscores.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
import argparse
import os
# prevent asap other modules from defining the root logger using basicConfig
import amlb.logger
from ruamel import yaml
import amlb
from amlb import log
from amlb.utils import config_load
root_dir = os.path.dirname(__file__)
parser = argparse.ArgumentParser()
parser.add_argument('predictions', type=str,
help='The predictions file to load and compute the scores for.')
args = parser.parse_args()
# script_name = os.path.splitext(os.path.basename(__file__))[0]
# log_dir = os.path.join(args.outdir if args.outdir else '.', 'logs')
# os.makedirs(log_dir, exist_ok=True)
# now_str = datetime_iso(date_sep='', time_sep='')
amlb.logger.setup(root_level='DEBUG', console_level='INFO')
config = config_load("resources/config.yaml")
config.run_mode = 'script'
config.root_dir = root_dir
config.script = os.path.basename(__file__)
amlb.resources.from_config(config)
scores = amlb.TaskResult.score_from_predictions_file(args.predictions)
log.info("\n\nScores computed from %s:\n%s", args.predictions, yaml.dump(dict(scores), default_flow_style=False))