public class LenskitRecommenderEngineBuilder
extends java.lang.Object
Builds LensKit recommender engines from configurations.
If multiple configurations are used, later configurations superseded previous configurations. This allows you to add a configuration of defaults, followed by a custom configuration. The final build process takes the union of the roots of all provided configurations as the roots of the configured object graph.
While this class is subclassable, and exposes protected methods, users should not subclass it. Subclassing is supported only to enable the evaluator.
LenskitConfiguration
,
LenskitRecommenderEngine
Constructor and Description |
---|
LenskitRecommenderEngineBuilder() |
Modifier and Type | Method and Description |
---|---|
LenskitRecommenderEngineBuilder |
addConfiguration(LenskitConfiguration config)
Add a configuration to be included in the recommender engine.
|
LenskitRecommenderEngineBuilder |
addConfiguration(LenskitConfiguration config,
ModelDisposition disp)
Add a configuration to be used when building the engine.
|
LenskitRecommenderEngine |
build()
Deprecated.
|
LenskitRecommenderEngine |
build(DataAccessObject dao)
Build the recommender engine.
|
LenskitRecommender |
buildRecommender(DataAccessObject dao)
Build the recommender directly, skipping an engine.
|
protected DAGNode<Component,Dependency> |
buildRecommenderGraph(DataAccessObject dao)
Build a recommender graph for this engine builder’s configuration.
|
java.lang.ClassLoader |
getClassLoader()
Get the class loader this builder will use.
|
protected DAGNode<Component,Dependency> |
instantiateGraph(DAGNode<Component,Dependency> graph)
Instantiate the recommender graph.
|
LenskitRecommenderEngineBuilder |
setClassLoader(java.lang.ClassLoader loader)
Set the class loader to use.
|
public java.lang.ClassLoader getClassLoader()
Get the class loader this builder will use. By default, it uses the thread’s current context class loader (if set).
public LenskitRecommenderEngineBuilder setClassLoader(java.lang.ClassLoader loader)
Set the class loader to use.
loader
- The class loader to use when building the recommender.public LenskitRecommenderEngineBuilder addConfiguration(LenskitConfiguration config)
Add a configuration to be included in the recommender engine. This is the equivalent of calling addConfiguration(LenskitConfiguration, ModelDisposition)
with the ModelDisposition.INCLUDED
.
config
- The configuration.public LenskitRecommenderEngineBuilder addConfiguration(LenskitConfiguration config, ModelDisposition disp)
Add a configuration to be used when building the engine.
config
- The configuration.disp
- The disposition for this configuration.@Deprecated public LenskitRecommenderEngine build() throws RecommenderBuildException
build(DataAccessObject)
Build the recommender engine.
RecommenderBuildException
- if there is an error building the recommender.public LenskitRecommenderEngine build(DataAccessObject dao) throws RecommenderBuildException
Build the recommender engine.
dao
- The data access object to use. Can be null
to build without a DAO, but this is only useful in special cases.RecommenderBuildException
- if there is an error building the engine.public LenskitRecommender buildRecommender(DataAccessObject dao) throws RecommenderBuildException
Build the recommender directly, skipping an engine. This does not separate the recommender from the DAO, it just directly builds it.
dao
- The data access object to use. Can be null
to build without a DAO, but this is only useful in special cases.RecommenderBuildException
- if there is an error building the engine.protected DAGNode<Component,Dependency> buildRecommenderGraph(DataAccessObject dao)
Build a recommender graph for this engine builder’s configuration.
Clients generally do not need to use this; it is exposed for the evaluator.
dao
- The DAO, if available.protected DAGNode<Component,Dependency> instantiateGraph(DAGNode<Component,Dependency> graph)
Instantiate the recommender graph.
graph
- The recommender graph.