Skip to content

Commit 13aa5a7

Browse files
authored
Merge pull request #670 from EducationalTestingService/rename-log-to-logs
Rename `log` output option to `logs`
2 parents c339845 + d97c4af commit 13aa5a7

22 files changed

+144
-74
lines changed

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ like:
9494
# Also compute the area under the ROC curve as an additional metric
9595
metrics = ['roc_auc']
9696
# The following can also be absolute paths
97-
log = output
97+
logs = output
9898
results = output
9999
predictions = output
100100
probability = true

doc/run_experiment.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -1184,10 +1184,10 @@ by the experiment. The most common fields are ``logs``, ``models``,
11841184
although they may be required in certain cases. A common option
11851185
is to use the same directory for all of these fields.
11861186
1187-
.. _log:
1187+
.. _logs:
11881188
1189-
log *(Optional)*
1190-
""""""""""""""""
1189+
logs *(Optional)*
1190+
"""""""""""""""""
11911191
11921192
Directory to store SKLL :ref:`log files <output_log_files>` in.
11931193
If omitted, the current working directory is used.

doc/tutorial.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ metrics we want to compute in addition to the tuning objective via the
9898
:ref:`metrics <metrics>` option. The other options are directories
9999
where you'd like all of the relevant output from your experiment to go.
100100
:ref:`results <results>` refers to the results of the experiment in both
101-
human-readable and JSON forms. :ref:`log <log>` specifies where to put log
101+
human-readable and JSON forms. :ref:`logs <logs>` specifies where to put log
102102
files containing any status, warning, or error messages generated during
103103
model training and evaluation. :ref:`predictions <predictions>` refers to
104104
where to store the individual predictions generated for the test set.

examples/Tutorial.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@
256256
"save_cv_models = true\n",
257257
"models = output\n",
258258
"results = output\n",
259-
"log = output\n",
259+
"logs = output\n",
260260
"predictions = output\n"
261261
]
262262
}

examples/boston/cross_val.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ objectives = ['pearson']
2323
[Output]
2424
# again, these can be absolute paths
2525
results = output
26-
log = output
26+
logs = output
2727
predictions = output

examples/boston/evaluate.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ objectives = ['unweighted_kappa']
2323
[Output]
2424
# again, these can be absolute paths
2525
results = output
26-
log = output
26+
logs = output
2727
predictions = output

examples/boston/voting.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ objectives = ['pearson']
2727
predictions = output
2828
models = output
2929
results = output
30-
log = output
30+
logs = output
3131
save_votes = true

examples/iris/cross_val.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ objectives = ['f1_score_micro']
2222
save_cv_models = true
2323
models = output
2424
results = output
25-
log = output
25+
logs = output
2626
predictions = output

examples/iris/evaluate.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ objectives = ['f1_score_micro']
2121
[Output]
2222
# again, these can be absolute paths
2323
results = output
24-
log = output
24+
logs = output
2525
predictions = output

examples/iris/voting.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ objectives = ["accuracy"]
2424
# again, these can be absolute paths
2525
models = output
2626
results = output
27-
log = output
27+
logs = output
2828
predictions = output
2929
save_votes = true

examples/titanic/cross_validate.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ objectives = ['accuracy']
1717

1818
[Output]
1919
# again, these can be absolute paths
20-
log = output
20+
logs = output
2121
results = output
2222
predictions = output

examples/titanic/evaluate.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ objectives = ['accuracy']
1717

1818
[Output]
1919
# again, these can be absolute paths
20-
log = output
20+
logs = output
2121
results = output
2222
predictions = output
2323
models = output

examples/titanic/evaluate_tuned.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ objectives = ['accuracy']
2121
# again, these can be absolute paths
2222
metrics = ['roc_auc']
2323
probability = true
24-
log = output
24+
logs = output
2525
results = output
2626
predictions = output
2727
models = output

examples/titanic/learning_curve.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ grid_search = false
1717

1818
[Output]
1919
# again, these can be absolute paths
20-
log = output
20+
logs = output
2121
results = output
2222
metrics = ['accuracy']

examples/titanic/predict_train+dev.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ objectives = ['accuracy']
1818

1919
[Output]
2020
# again, these can be absolute paths
21-
log = output
21+
logs = output
2222
predictions = output
2323
models = output

examples/titanic/predict_train+dev_tuned.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ objectives = ['accuracy']
1919

2020
[Output]
2121
# again, these can be absolute paths
22-
log = output
22+
logs = output
2323
predictions = output
2424
models = output

examples/titanic/predict_train_only.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ objectives = ['accuracy']
1818

1919
[Output]
2020
# again, these can be absolute paths
21-
log = output
21+
logs = output
2222
predictions = output
2323
models = output

examples/titanic/predict_train_only_tuned.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ objectives = ['accuracy']
1919

2020
[Output]
2121
# again, these can be absolute paths
22-
log = output
22+
logs = output
2323
predictions = output
2424
models = output

examples/titanic/train.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ objectives = ['accuracy']
1818

1919
[Output]
2020
# again, these can be absolute paths
21-
log = output
21+
logs = output
2222
models = output

skll/config/__init__.py

+24-1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def __init__(self):
6969
'ids_to_floats': 'False',
7070
'label_col': 'y',
7171
'log': '',
72+
'logs': '',
7273
'learning_curve_cv_folds_list': '[]',
7374
'learning_curve_train_sizes': '[]',
7475
'min_feature_count': '1',
@@ -113,6 +114,7 @@ def __init__(self):
113114
'ids_to_floats': 'Input',
114115
'label_col': 'Input',
115116
'log': 'Output',
117+
'logs': 'Output',
116118
'learning_curve_cv_folds_list': 'Input',
117119
'learning_curve_train_sizes': 'Input',
118120
'min_feature_count': 'Tuning',
@@ -398,8 +400,22 @@ def parse_config_file(config_path, log_level=logging.INFO): # noqa: C901
398400
# next, get the log path before anything else since we need to
399401
# save all logging messages to a log file in addition to displaying
400402
# them on the console
403+
404+
# if the user specified "log" instead of "logs", we need
405+
# to show a warning and save its value in "logs" instead
406+
log_value = config.get("Output", "log")
407+
show_log_warning = False
408+
if log_value:
409+
# since we do not have a logger yet, we will show the warning later
410+
show_log_warning = True
411+
config.set('Output', 'logs', log_value)
412+
config.remove_option('Output', 'log')
413+
414+
# now get the value from the 'logs' field
415+
log_value = config.get("Output", "logs")
416+
401417
try:
402-
log_path = locate_file(config.get("Output", "log"), config_dir)
418+
log_path = locate_file(log_value, config_dir)
403419
except IOError as e:
404420
if e.errno == errno.ENOENT:
405421
log_path = e.filename
@@ -416,6 +432,13 @@ def parse_config_file(config_path, log_level=logging.INFO): # noqa: C901
416432
filepath=main_log_file,
417433
log_level=log_level)
418434

435+
# now show the 'log' warning, if any, since we have the logger set up
436+
if show_log_warning:
437+
logger.warning("The 'log' option in the [Output] section is deprecated "
438+
"and will be removed in the next version. Use 'logs' "
439+
"instead.")
440+
show_log_warning = False
441+
419442
if config.has_option("General", "task"):
420443
task = config.get("General", "task")
421444
else:

0 commit comments

Comments
 (0)