public class LenskitRecommenderEngineLoader extends Object
Constructor and Description |
---|
LenskitRecommenderEngineLoader() |
Modifier and Type | Method and Description |
---|---|
LenskitRecommenderEngineLoader |
addConfiguration(LenskitConfiguration config)
Add a configuration to use when loading the configuration.
|
ClassLoader |
getClassLoader()
Get the configured class loader.
|
LenskitRecommenderEngine |
load(File file)
Load a recommender from a file.
|
LenskitRecommenderEngine |
load(InputStream stream)
Load a recommender engine from an input stream.
|
LenskitRecommenderEngineLoader |
setClassLoader(ClassLoader classLoader)
Set the class loader to use when reading the engine.
|
void |
setCompressionMode(CompressionMode comp)
Set the compression mode to use.
|
LenskitRecommenderEngineLoader |
setValidationMode(EngineValidationMode mode)
Set the validation mode for loading the recommender engine.
|
public ClassLoader getClassLoader()
public LenskitRecommenderEngineLoader setClassLoader(ClassLoader classLoader)
classLoader
- The class loader to use.public LenskitRecommenderEngineLoader addConfiguration(LenskitConfiguration config)
config
- The configuration to add.public LenskitRecommenderEngineLoader setValidationMode(EngineValidationMode mode)
EngineValidationMode.IMMEDIATE
.mode
- The validation mode.public void setCompressionMode(CompressionMode comp)
CompressionMode.AUTO
.comp
- The compression mode.public LenskitRecommenderEngine load(@WillClose InputStream stream) throws IOException, RecommenderConfigurationException
Note: this method is only capable of auto-detecting gzip-compressed data.
If the compression mode is CompressionMode.AUTO
,
only gzip-compressed streams are supported. Set the compression mode manually if you are
using XZ compression.
stream
- The input stream.IOException
- if there is an error reading the input data.RecommenderConfigurationException
- if there is a configuration error with the deserialized recommender or
the configurations applied to it.public LenskitRecommenderEngine load(File file) throws IOException, RecommenderConfigurationException
file
- The recommender model file to load.IOException
- if there is an error reading the input data.RecommenderConfigurationException
- if there is a configuration error with the deserialized recommender or
the configurations applied to it.