PeriodTime
class represents a time period parameter used for temporal filtering and recency scoring. It defines how far back in time the system should consider items and how to weight them based on their age.
Constructor
Create a new period time configuration for temporal operations.Parameters
The time period that defines the oldest items the parameter will
differentiate. Items older than this period will receive a recency score of 0
or be filtered out entirely.
A weighting factor for this period time when multiple period times are used
together. Useful for balancing different temporal considerations against each
other.
Example
Properties
period_time
weight
Use Cases
Recency Filtering
UsePeriodTime
to implement time-based filtering where only recent items are considered relevant:
Temporal Decay
Apply different weights to different time periods for gradual decay:Multi-Scale Temporal Analysis
Combine multiple period times for complex temporal behavior:Best Practices
Weight Tuning: Start with equal weights (1.0) for all period times, then
adjust based on your specific use case. Higher weights give more importance to
that temporal range.
Performance Consideration: Very long period times may impact performance
as they require evaluating more historical data. Balance recency requirements
with system performance.
Zero Recency: Items older than the specified
period_time
will have a
recency score of 0, effectively filtering them out of similarity calculations.