Decaying Window Algorithm :-
This algorithm allows you to identify the most popular elements (trending, in other words) in an incoming data stream.
The decaying window algorithm not only tracks the most recurring elements in an incoming data stream, but also discounts any random spikes or spam requests that might have boosted an element’s frequency.
In a decaying window, you assign a score or weight to every element of the incoming data stream. Further, you need to calculate the aggregate sum for each distinct element by adding all the weights assigned to that element. The element with the highest total score is listed as trending or the most popular.
- Assign each element with a weight/score.
- Calculate aggregate sum for each distinct element by adding all the weights assigned to that element.
Advantages of Decaying Window Algorithm :-
- Sudden spikes or spam data is taken care.
- New element is given more weight by this mechanism, to achieve right trending output.