forked from openml/automlbenchmark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runscores.py
32 lines (23 loc) · 1.01 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
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
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.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))