org.grouplens.lenskit.eval.cli.EvalCLI Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lenskit-eval Show documentation
Show all versions of lenskit-eval Show documentation
Facilities for evaluating recommender algorithms.
/*
* LensKit, an open source recommender systems toolkit.
* Copyright 2010-2014 LensKit Contributors. See CONTRIBUTORS.md.
* Work on LensKit has been funded by the National Science Foundation under
* grants IIS 05-34939, 08-08692, 08-12148, and 10-17697.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.grouplens.lenskit.eval.cli;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.collect.Iterables;
import org.codehaus.groovy.runtime.StackTraceUtils;
import org.grouplens.lenskit.eval.EvalProject;
import org.grouplens.lenskit.eval.TaskExecutionException;
import org.grouplens.lenskit.eval.script.EvalScriptEngine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
/**
* Main entry point to run the evaluator from the command line
*
* @author GroupLens Research
* @since 0.8
* @deprecated Use {@code lenskit eval} from the {@code lenskit-cli} package.
*/
@Deprecated
public class EvalCLI {
private static final Logger logger = LoggerFactory.getLogger(EvalCLI.class);
private final EvalCLIOptions options;
public EvalCLI(EvalCLIOptions opts) {
options = opts;
}
@SuppressWarnings("unchecked")
public void run() {
logger.warn("lenskit-eval is deprecated, use lenskit eval instead");
ClassLoader loader = options.getClassLoader();
EvalScriptEngine engine = new EvalScriptEngine(loader, options.getProperties());
File f = options.getScriptFile();
if (!f.exists()) {
logger.error("script file {} does not exist", f);
System.err.format("%s: file does not exist%n", f);
System.err.println("lenskit-eval requires an eval script to execute (default: eval.groovy)");
System.err.println("run lenskit-eval --help for more information");
System.exit(1);
}
logger.info("loading evaluation from {}", f);
try {
EvalProject project = engine.loadProject(f);
if (options.getArgs().length == 0) {
String dft = project.getDefaultTarget();
if (dft == null && !project.getAntProject().getTargets().isEmpty()) {
String targets = Joiner.on(", ")
.join(Iterables.transform(
project.getAntProject().getTargets().keySet(),
new Function
© 2015 - 2024 Weber Informatics LLC | Privacy Policy