Commit 9b1a66f2 authored by Manuel Günther's avatar Manuel Günther

Fixed usage of logging

parent c1c7b4ef
......@@ -2,7 +2,7 @@ from ._library import BoostedMachine
import numpy
import scipy.optimize
import logging
logger = logging.getLogger('bob')
logger = logging.getLogger('bob.learn.boosting')
class Boosting:
......@@ -99,7 +99,7 @@ class Boosting:
if flags['warnflag'] != 0:
msg = "too many function evaluations or too many iterations" if flags['warnflag'] == 1 else flags['task']
if (alpha == numpy.zeros(number_of_outputs)).all():
logger.error("L-BFGS returned zero weights with error '%d': %s" % (flags['warnflag'], msg))
logger.warn("L-BFGS returned zero weights with error '%d': %s" % (flags['warnflag'], msg))
return boosted_machine
else:
logger.warn("L-BFGS returned warning '%d': %s" % (flags['warnflag'], msg))
......@@ -114,4 +114,3 @@ class Boosting:
logger.info("Finished round %d / %d" % (round+1, number_of_rounds))
return boosted_machine
......@@ -17,8 +17,8 @@ import bob.io.base
import bob.learn.boosting
import bob.learn.boosting.utils
import logging
logger = logging.getLogger('bob')
import bob.core
logger = bob.core.log.setup('bob.learn.boosting')
TRAINER = {
'stump' : bob.learn.boosting.StumpTrainer,
......@@ -47,9 +47,9 @@ def command_line_arguments(command_line_options):
parser.add_argument('-c', '--classifier-file', help = "If selected, the strong classifier will be stored in this file (or loaded from it if it already exists).")
parser.add_argument('-F', '--force', action='store_true', help = "Re-train the strong classifier, even if the --classifier-file already exists.")
parser.add_argument('-v', '--verbose', action = 'count', default = 0, help = "Increase the verbosity level (up too three times)")
bob.core.log.add_command_line_option(parser)
args = parser.parse_args(command_line_options)
bob.core.log.set_verbosity_level(logger, args.verbose)
if args.trainer_type == 'stump' and args.multi_variate:
raise ValueError("The stump trainer cannot handle multi-variate training.")
......@@ -61,13 +61,6 @@ def command_line_arguments(command_line_options):
if args.loss_type is None:
args.loss_type = 'exp' if args.trainer_type == 'stump' else 'log'
logger.setLevel({
0: logging.ERROR,
1: logging.WARNING,
2: logging.INFO,
3: logging.DEBUG
}[args.verbose])
return args
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment