Package org.grouplens.lenskit.util

Examples of org.grouplens.lenskit.util.LogContext


    @SuppressWarnings("PMD.AvoidCatchingThrowable")
    public T perform() throws TaskExecutionException {
        Preconditions.checkState(algorithm != null, "no algorithm specified");
        Preconditions.checkState(inputData != null, "no input data specified");
        Preconditions.checkState(action != null, "no action specified");
        LogContext context = new LogContext();
        try {
            context.put("lenskit.eval.command.class", getName());
            context.put("lenskit.eval.command.name", getName());
            context.put("lenskit.eval.algorithm.name", algorithm.getName());

            // TODO Support serializing the recommender
            LenskitRecommender rec;
            StopWatch timer = new StopWatch();
            timer.start();
            try {
                logger.info("{}: building recommender {}", getName(), algorithm.getName());
                LenskitConfiguration config = new LenskitConfiguration();
                inputData.configure(config);
                rec = algorithm.buildRecommender(config);
            } catch (RecommenderBuildException e) {
                throw new TaskExecutionException(getName() + ": error building recommender", e);
            }
            timer.stop();
            logger.info("{}: trained in {}", getName(), timer);
            return action.apply(rec);
        } finally {
            context.finish();
        }
    }
View Full Code Here

TOP

Related Classes of org.grouplens.lenskit.util.LogContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.