public class LenskitRecommenderEngineLoader
extends java.lang.Object
Constructor and Description |
---|
LenskitRecommenderEngineLoader() |
Modifier and Type | Method and Description |
---|---|
LenskitRecommenderEngineLoader |
addConfiguration(LenskitConfiguration config)
Add a configuration to use when loading the configuration.
|
java.lang.ClassLoader |
getClassLoader()
Get the configured class loader.
|
LenskitRecommenderEngine |
load(java.io.File file)
Load a recommender from a file.
|
LenskitRecommenderEngine |
load(java.io.InputStream stream)
Load a recommender engine from an input stream.
|
LenskitRecommenderEngineLoader |
setClassLoader(java.lang.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 java.lang.ClassLoader getClassLoader()
public LenskitRecommenderEngineLoader setClassLoader(java.lang.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 java.io.InputStream stream) throws java.io.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.java.io.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(java.io.File file) throws java.io.IOException, RecommenderConfigurationException
file
- The recommender model file to load.java.io.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.