public class AlgorithmInstance extends Object
An instance of a recommender algorithm to be trained and measured.
Constructor and Description |
---|
AlgorithmInstance(String name,
LenskitConfiguration config)
Construct a new algorithm instance.
|
AlgorithmInstance(String name,
List<LenskitConfiguration> configs,
Map<String,Object> attrs)
Construct a new algorithm instance.
|
Modifier and Type | Method and Description |
---|---|
LenskitRecommender |
buildRecommender(LenskitConfiguration defaults)
Build a recommender.
|
DAGNode<Component,Dependency> |
buildRecommenderGraph(LenskitConfiguration... defaults)
Build a recommender graph (but don’t instantiate any objects).
|
Map<String,Object> |
getAttributes()
Get the attributes of this algorithm.
|
List<LenskitConfiguration> |
getConfigurations()
Get the recommender configurations.
|
String |
getName()
Get the name of this algorithm.
|
static List<AlgorithmInstance> |
load(Path file,
String name,
ClassLoader classLoader)
Load an algorithm instance from a file.
|
String |
toString() |
public AlgorithmInstance(String name, LenskitConfiguration config)
Construct a new algorithm instance.
name
- The algorithm name.config
- The algorithm configuration.public String getName()
Get the name of this algorithm. This returns a short name which is used to identify the algorithm or instance.
@Nonnull public Map<String,Object> getAttributes()
Get the attributes of this algorithm. These attributes are used to distinguish between similar algorithms, e.g. different configurations of the same basic algorithm.
@Nonnull public List<LenskitConfiguration> getConfigurations()
Get the recommender configurations.
public LenskitRecommender buildRecommender(@Nullable LenskitConfiguration defaults) throws RecommenderBuildException
Build a recommender.
defaults
- Additional configuration. This configuration comes before the algorithm’s configuration, so it is overridden if appropriate. It is used for providing things such as DAOs.RecommenderBuildException
public DAGNode<Component,Dependency> buildRecommenderGraph(@Nullable LenskitConfiguration... defaults) throws RecommenderConfigurationException
Build a recommender graph (but don’t instantiate any objects).
defaults
- Additional configurations. These configurations come before the algorithm’s configuration, so they are overridden if appropriate. They are used for providing things such as DAOs.RecommenderConfigurationException
- if there is an error configuring the recommender.public static List<AlgorithmInstance> load(Path file, String name, ClassLoader classLoader)
Load an algorithm instance from a file.
file
- The file to load.name
- The algorithm name, or null
to use the file’s basename.classLoader
- The class loader, or null
to use a default.