public final class LenskitRecommenderEngine extends java.lang.Object implements RecommenderEngine
LenskitConfiguration
to set up actual recommenders, and can build
multiple recommenders from the same model.
If you just want to quick create a recommender for evaluation or testing,
consider using LenskitRecommender.build(LenskitConfiguration)
.
LenskitConfiguration
,
LenskitRecommender
Compatibility: Public
Modifier and Type | Method and Description |
---|---|
static LenskitRecommenderEngine |
build(LenskitConfiguration config)
Build a LensKit recommender engine from a configuration.
|
LenskitRecommender |
createRecommender()
Create a new recommender..
|
LenskitRecommender |
createRecommender(LenskitConfiguration config)
Construct a recommender with some additional configuration.
|
DAGNode<Component,Dependency> |
getGraph()
Get the dependency graph of the recommender engine.
|
boolean |
isInstantiable()
Query whether this engine is instantiable.
|
static LenskitRecommenderEngine |
load(java.io.File file)
Create a new LenskitRecommenderEngine by reading a previously serialized engine from the
given file.
|
static LenskitRecommenderEngine |
load(java.io.File file,
java.lang.ClassLoader loader)
Deprecated.
Use
LenskitRecommenderEngineLoader for sophisticated loading. |
static LenskitRecommenderEngine |
load(java.io.InputStream input)
Create a new LenskitRecommenderEngine by reading a previously serialized engine from the
given input stream.
|
static LenskitRecommenderEngine |
load(java.io.InputStream input,
java.lang.ClassLoader loader)
Deprecated.
Use
LenskitRecommenderEngineLoader for sophisticated loading. |
static LenskitRecommenderEngineBuilder |
newBuilder()
Create a new recommender engine builder.
|
static LenskitRecommenderEngineLoader |
newLoader()
Create a new recommender engine loader.
|
void |
write(java.io.File file)
Write the state of this LenskitRecommenderEngine to the given file so
that it can be recreated later using another DAOFactory.
|
void |
write(java.io.File file,
CompressionMode compressed)
Write the state of this LenskitRecommenderEngine to the given file so
that it can be recreated later using another DAOFactory.
|
void |
write(java.io.OutputStream stream)
Write the state of this LenskitRecommenderEngine to the given stream so
that it can be recreated later using another DAOFactory.
|
public static LenskitRecommenderEngine load(java.io.File file) throws java.io.IOException, RecommenderConfigurationException
write(OutputStream)
.
Classes will be loaded using a default class loader.file
- The file from which to load the engine.java.io.IOException
- If there is an error reading from the file.RecommenderConfigurationException
- If the configuration cannot be used.@Deprecated public static LenskitRecommenderEngine load(java.io.File file, java.lang.ClassLoader loader) throws java.io.IOException, RecommenderConfigurationException
LenskitRecommenderEngineLoader
for sophisticated loading.write(OutputStream)
.file
- The file from which to load the engine.loader
- The class loader to load from (null
to use a default class loader).java.io.IOException
- If there is an error reading from the file.RecommenderConfigurationException
- If the configuration cannot be used.public static LenskitRecommenderEngine load(java.io.InputStream input) throws java.io.IOException, RecommenderConfigurationException
write(OutputStream)
. Classes will be loaded using a default
class loader.input
- The stream from which to load the engine.java.io.IOException
- If there is an error reading from the file.RecommenderConfigurationException
- If the configuration cannot be used.public static LenskitRecommenderEngine load(java.io.InputStream input, java.lang.ClassLoader loader) throws java.io.IOException, RecommenderConfigurationException
LenskitRecommenderEngineLoader
for sophisticated loading.write(OutputStream)
.input
- The stream from which to load the engine.loader
- The class loader to load from (null
to use a default class loader).java.io.IOException
- If there is an error reading from the file.RecommenderConfigurationException
- If the configuration cannot be used.public void write(@Nonnull java.io.File file) throws java.io.IOException
file
- The file to write the rec engine to.java.io.IOException
- if there is an error serializing the engine.write(java.io.OutputStream)
public void write(@Nonnull java.io.File file, CompressionMode compressed) throws java.io.IOException
file
- The file to write the rec engine to.compressed
- Whether to compress the output file.java.io.IOException
- if there is an error serializing the engine.write(java.io.OutputStream)
public void write(@Nonnull @WillClose java.io.OutputStream stream) throws java.io.IOException
stream
- The file to write the rec engine to.java.io.IOException
- if there is an error serializing the engine.load(InputStream)
public LenskitRecommender createRecommender()
RecommenderEngine
createRecommender
in interface RecommenderEngine
public LenskitRecommender createRecommender(LenskitConfiguration config) throws RecommenderConfigurationException
config
- The configuration to adjust the recommender.RecommenderConfigurationException
- if there is an error configuring the recommender.public boolean isInstantiable()
true
if the recommender is instantiable.@Nonnull public DAGNode<Component,Dependency> getGraph()
public static LenskitRecommenderEngine build(LenskitConfiguration config) throws RecommenderBuildException
config
- The configuration.RecommenderBuildException
public static LenskitRecommenderEngineBuilder newBuilder()
public static LenskitRecommenderEngineLoader newLoader()