/** * Add a configuration to be included in the recommender engine. This is the equivalent of * calling {@link #addConfiguration(LenskitConfiguration, ModelDisposition)} with the {@link ModelDisposition#INCLUDED}. * @param config The configuration. * @return The builder (for chaining). */ public LenskitRecommenderEngineBuilder addConfiguration(LenskitConfiguration config) { return addConfiguration(config, ModelDisposition.INCLUDED); }
private LenskitRecommenderEngine buildRecommenderEngine(DataAccessObject train) throws RecommenderBuildException { logger.debug("Starting recommender build"); LenskitRecommenderEngineBuilder builder = new EvalEngineBuilder(); builder.addConfiguration(sharedConfig); builder.addConfiguration(dataSet.getExtraConfiguration()); for (LenskitConfiguration cfg: algorithm.getConfigurations()) { builder.addConfiguration(cfg); } return builder.build(train); }
/** * Build a LensKit recommender engine from a configuration. The resulting recommender is * independent of any subsequent modifications to the configuration. * * @param config The configuration. * @return The recommender engine. */ @SuppressWarnings("deprecation") public static LenskitRecommenderEngine build(LenskitConfiguration config) throws RecommenderBuildException { return newBuilder().addConfiguration(config).build(); }
/** * Build a LensKit recommender engine from a configuration. The resulting recommender is * independent of any subsequent modifications to the configuration. * * @param config The configuration. * @param dao The data access object * @return The recommender engine. */ public static LenskitRecommenderEngine build(LenskitConfiguration config, DataAccessObject dao) throws RecommenderBuildException { return newBuilder().addConfiguration(config).build(dao); }
@Override public void execute(Namespace opts) throws LenskitCommandException { Context ctx = new Context(opts); LenskitConfiguration dataConfig = ctx.input.getConfiguration(); LenskitRecommenderEngineBuilder builder = LenskitRecommenderEngine.newBuilder(); try { for (LenskitConfiguration config: ctx.environment.loadConfigurations(ctx.getConfigFiles())) { builder.addConfiguration(config); } } catch (IOException e) { throw new LenskitCommandException("error loading LensKit configuration", e); } builder.addConfiguration(dataConfig, ModelDisposition.EXCLUDED); Stopwatch timer = Stopwatch.createStarted(); LenskitRecommenderEngine engine = builder.build(ctx.input.getDAO()); timer.stop(); logger.info("built model in {}", timer); File output = ctx.getOutputFile(); CompressionMode comp = CompressionMode.autodetect(output); logger.info("writing model to {}", output); try (OutputStream raw = new FileOutputStream(output); OutputStream stream = comp.wrapOutput(raw)) { engine.write(stream); } catch (IOException e) { throw new LenskitCommandException("could not write output file", e); } }
LenskitRecommenderEngineBuilder builder = LenskitRecommenderEngine.newBuilder(); for (LenskitConfiguration config: environment.loadConfigurations(getConfigFiles())) { builder.addConfiguration(config);
.addConfiguration(algorithm.getConfigurations().get(0)) .build(limitedDao); timer.stop();
/** * Add a configuration to be included in the recommender engine. This is the equivalent of * calling {@link #addConfiguration(LenskitConfiguration, ModelDisposition)} with the {@link ModelDisposition#INCLUDED}. * @param config The configuration. * @return The builder (for chaining). */ public LenskitRecommenderEngineBuilder addConfiguration(LenskitConfiguration config) { return addConfiguration(config, ModelDisposition.INCLUDED); }
/** * Build a LensKit recommender engine from a configuration. The resulting recommender is * independent of any subsequent modifications to the configuration. * * @param config The configuration. * @param dao The data access object * @return The recommender engine. */ public static LenskitRecommenderEngine build(LenskitConfiguration config, DataAccessObject dao) throws RecommenderBuildException { return newBuilder().addConfiguration(config).build(dao); }
/** * Build a recommender. * * @param defaults Additional configuration. This configuration comes <em>before</em> the * algorithm's configuration, so it is overridden if appropriate. It is used * for providing things such as DAOs. * @return The instantiated recommender. * @throws RecommenderBuildException */ public LenskitRecommender buildRecommender(@Nullable LenskitConfiguration defaults) throws RecommenderBuildException { LenskitRecommenderEngineBuilder builder = LenskitRecommenderEngine.newBuilder(); if (defaults != null) { builder.addConfiguration(defaults); } for (LenskitConfiguration cfg: configurations) { builder.addConfiguration(cfg); } return builder.build().createRecommender(); }
/** * Build a LensKit recommender engine from a configuration. The resulting recommender is * independent of any subsequent modifications to the configuration. * * @param config The configuration. * @return The recommender engine. */ @SuppressWarnings("deprecation") public static LenskitRecommenderEngine build(LenskitConfiguration config) throws RecommenderBuildException { return newBuilder().addConfiguration(config).build(); }