/** * Load a configuration graph from a recommender model. * @param file The model file. * @return The recommender graph. * @throws IOException if there is an error loading the model. * @throws RecommenderConfigurationException if the model fails to configure. */ private DAGNode<Component, Dependency> loadModel(Context ctx, File file) throws IOException, RecommenderConfigurationException { logger.info("loading model from {}", file); LenskitRecommenderEngineLoader loader = LenskitRecommenderEngine.newLoader(); loader.setValidationMode(EngineValidationMode.DEFERRED) .addConfiguration(makeDataConfig(ctx)); for (LenskitConfiguration config: ctx.environment.loadConfigurations(ctx.getConfigFiles())) { loader.addConfiguration(config); } LenskitRecommenderEngine engine = loader.load(file); return engine.getGraph(); }