ranking algorithm
likes and dislikes
average views
algorithm optimization
content evaluation

Ranking algorithm using likes / dislikes and average views per day

Data Structures & Algorithms practice on Codemia

Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.

Practice algorithms

In the digital world, algorithms play a pivotal role in determining the visibility and ranking of content across platforms like YouTube, Instagram, and Facebook. Among the myriad ranking algorithms, a model that employs likes, dislikes, and average views per day provides an insightful approach to gauging content quality and engagement. This article delves into the intricacies of such an algorithm, exploring its mechanisms, advantages, and potential challenges.

Understanding the Basic `Parameters`

Likes and Dislikes

Likes and dislikes are straightforward metrics that signify user engagement and sentiment towards a piece of content. In an algorithm, the net engagement can be calculated as:

Engagementnet=LikesDislikesEngagement_{net} = Likes - Dislikes

While likes indicate positive responses, dislikes serve as a feedback mechanism, curbing over-rewarding low-quality or misleading content. However, it's crucial to balance likes with dislikes to avoid extreme polarization.

Average Views Per Day

This metric gives insight into the ongoing popularity and relevance of content. It is calculated as:

Averageviews/day=Total ViewsDays Since UploadAverage_{views/day} = \frac{\text{Total Views}}{\text{Days Since Upload}}

A high average views per day suggests that new audiences are continually finding value in the content, potentially through recommendations or search discoverability.

Combining Metrics for Ranking

To develop a comprehensive ranking score, these parameters can be integrated into a weighted formula:

Ranking Score=w1Engagementnet+w2Normalizedviews/day\text{Ranking Score} = w_1 \cdot Engagement_{net} + w_2 \cdot Normalized_{views/day}

Here, w1w_1 and w2w_2 are scaling factors that ensure each component's impact aligns with platform goals. Normalization of views per day is necessary to map different content types (e.g., videos, posts) into comparable metrics.

Normalizing Views Per Day

To ensure comparability:

Normalizedviews/day=VPDMinVPDMaxVPDMinVPDNormalized_{views/day} = \frac{VPD - Min_{VPD}}{Max_{VPD} - Min_{VPD}}

Where MinVPDMin_{VPD} is the minimum and MaxVPDMax_{VPD} is the maximum average views per day observed within a certain timeframe.

Implementing the Algorithm

Example Walkthrough

Imagine three pieces of content, A, B, and C, with the following statistics:

Content IDLikesDislikesTotal ViewsDays Since Upload
A10001005000010
B1500506000015
C50020300005

Step-by-Step Calculation

  1. Net Engagement:
    • A: 1000100=9001000 - 100 = 900 • B: 150050=14501500 - 50 = 1450 • C: 50020=480500 - 20 = 480
  2. Average Views Per Day:
    • A: 5000010=5000\frac{50000}{10} = 5000 • B: 6000015=4000\frac{60000}{15} = 4000 • C: 300005=6000\frac{30000}{5} = 6000
  3. Normalization (assuming max VPD = 6000 and min VPD = 4000):
    • A: 5000400060004000=0.5\frac{5000 - 4000}{6000 - 4000} = 0.5 • B: 4000400060004000=0\frac{4000 - 4000}{6000 - 4000} = 0 • C: 6000400060004000=1\frac{6000 - 4000}{6000 - 4000} = 1
  4. Ranking `Score` Calculation:

Assuming weights w1=0.7w_1 = 0.7 and w2=0.3w_2 = 0.3:

• A: 0.7900+0.30.5=630.150.7 \cdot 900 + 0.3 \cdot 0.5 = 630.15 • B: 0.71450+0.30=10150.7 \cdot 1450 + 0.3 \cdot 0 = 1015 • C: 0.7480+0.31=336.30.7 \cdot 480 + 0.3 \cdot 1 = 336.3

Based on the ranking scores, content B ranks highest, followed by A, then C.

Advantages and Challenges

Advantages

Balanced View: Integrating likes, dislikes, and views considers multiple facets of content performance. • Dynamic Scaling: Normalization allows for flexible application across diverse content genres and types.

Challenges

Gaming the System: Users might attempt to manipulate rankings through artificial inflations of likes or views. • Short-Lived Trends: Viral but short-lived content might skew average views per day, affecting long-term visibility unfairly.

Conclusion

A ranking algorithm utilizing likes, dislikes, and average views per day provides a nuanced view into content performance. By balancing user engagement with content reach, such an algorithm can accurately predict and enhance content visibility. However, continual monitoring and adjustments are necessary to ensure fairness and resilience against manipulation.


Related reading
Course
Intermediate
27 lessons
15 hours
DSA Fundamentals

Master algorithmic patterns and data structures through hands-on LeetCode-style problems - from arrays and hashing to dynamic programming and advanced graphs.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Data Structures & Algorithms practice on Codemia

Step through 300 algorithm problems with animated visualisers that show the data structure changing as the code runs.

Practice algorithms

All Rights Reserved.