Experiment Planning
omnirec.runner.plan.ExperimentPlan(plan_name: Optional[str] = None)
Source code in src\omnirec\runner\plan.py
add_algorithm(algorithm: Algorithms | str, algorithm_config: Optional[AlgorithmConfig] = None, force=False)
Adds an algorithm to the experiment plan.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algorithm
|
Algorithms | str
|
The algorithm to add. |
required |
algorithm_config
|
Optional[AlgorithmConfig]
|
The configuration for the
algorithm. Each value in the config dict can be either a plain value or a
Plain (non- |
None
|
force
|
bool
|
Whether to forcefully overwrite an existing algorithm config. Defaults to False. |
False
|
Example
from omnirec.runner.plan import ExperimentPlan
from omnirec.runner.plan_components import Grid, RandomChoice, RandomRange
# Create a new experiment plan
plan = ExperimentPlan(plan_name="Example Plan")
# Define algorithm configuration based on the lenskit ItemKNNScorer parameters.
# Grid expands [10, 20] into separate combinations; min_nbrs and feedback are fixed.
lenskit_itemknn = {
"max_nbrs": Grid([10, 20]),
"min_nbrs": 5,
"feedback": "implicit",
}
# Add algorithm with configuration to the plan
plan.add_algorithm(Algorithms.ItemKNNScorer, lenskit_itemknn)
Source code in src\omnirec\runner\plan.py
update_algorithm(algorithm_name: str, algorithm_config: AlgorithmConfig)
Updates the configuration for an existing algorithm in the experiment plan.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
algorithm_name
|
str
|
The name of the algorithm to update. |
required |
algorithm_config
|
AlgorithmConfig
|
The new configuration for the algorithm. |
required |