Skip to content

strategy

EvaluationStrategy

Bases: ABC

Abstract strategy for different evaluation modes

Source code in src/recnexteval/evaluators/stream/strategy.py
 6
 7
 8
 9
10
11
12
class EvaluationStrategy(ABC):
    """Abstract strategy for different evaluation modes"""

    @abstractmethod
    def should_advance_window(self, algo_state_mgr: AlgorithmStateManager, current_step: int, total_steps: int) -> bool:
        """Determine if should advance to next window"""
        pass

should_advance_window(algo_state_mgr, current_step, total_steps) abstractmethod

Determine if should advance to next window

Source code in src/recnexteval/evaluators/stream/strategy.py
 9
10
11
12
@abstractmethod
def should_advance_window(self, algo_state_mgr: AlgorithmStateManager, current_step: int, total_steps: int) -> bool:
    """Determine if should advance to next window"""
    pass

SlidingWindowStrategy

Bases: EvaluationStrategy

Strategy for sliding window evaluation

Source code in src/recnexteval/evaluators/stream/strategy.py
15
16
17
18
19
20
21
22
23
24
class SlidingWindowStrategy(EvaluationStrategy):
    """Strategy for sliding window evaluation"""

    def should_advance_window(self, algo_state_mgr: AlgorithmStateManager, current_step: int, total_steps: int) -> bool:
        """Advance only when all algorithms predicted"""
        return (
            algo_state_mgr.is_all_predicted()
            and algo_state_mgr.is_all_same_data_segment()
            and current_step < total_steps
        )

should_advance_window(algo_state_mgr, current_step, total_steps)

Advance only when all algorithms predicted

Source code in src/recnexteval/evaluators/stream/strategy.py
18
19
20
21
22
23
24
def should_advance_window(self, algo_state_mgr: AlgorithmStateManager, current_step: int, total_steps: int) -> bool:
    """Advance only when all algorithms predicted"""
    return (
        algo_state_mgr.is_all_predicted()
        and algo_state_mgr.is_all_same_data_segment()
        and current_step < total_steps
    )

SingleTimePointStrategy

Bases: EvaluationStrategy

Strategy for sliding window evaluation

Source code in src/recnexteval/evaluators/stream/strategy.py
27
28
29
30
31
32
class SingleTimePointStrategy(EvaluationStrategy):
    """Strategy for sliding window evaluation"""

    def should_advance_window(self, algo_state_mgr: AlgorithmStateManager, current_step: int, total_steps: int) -> bool:
        """Advance only when all algorithms predicted"""
        return algo_state_mgr.is_all_predicted() and current_step < total_steps

should_advance_window(algo_state_mgr, current_step, total_steps)

Advance only when all algorithms predicted

Source code in src/recnexteval/evaluators/stream/strategy.py
30
31
32
def should_advance_window(self, algo_state_mgr: AlgorithmStateManager, current_step: int, total_steps: int) -> bool:
    """Advance only when all algorithms predicted"""
    return algo_state_mgr.is_all_predicted() and current_step < total_steps