Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7510883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:21:49+00:00 2026-05-29T23:21:49+00:00

I am looking forward to apply the bayesian approach to prioritize a list that

  • 0

I am looking forward to apply the bayesian approach to prioritize a list that could take the number of likes, dislikes and review counts into consideration.

The approach listed in here relies on the bayesian average:

$bayesian_rating = ( ($avg_num_votes * $avg_rating) + ($this_num_votes * $this_rating) ) / ($avg_num_votes + $this_num_votes);

In my case, there are no $avg_rating since its not a 5-star system, it will never exist, the number of likes, dislikes and reviews always increments therefore i need to take care of the true representation of the listing.

The solution in here was not enough to decide on an approach.

What would the best solution be in case i want to apply a mathematical approach?

Edit added:
Ref. @Ina , it is possible to reflect the 5-star system if i multiply the likes by 5 which makes it with the highest value in a 5-star system.

Getting back to the code, after adding some extra variables to take care of (likes, dislikes, number of reviews, number of times added to basket) , i am not sure the what can i fill the $avg_rating and $this_rating with?

Here is the code so far:

// these values extracted from the database
    $total_all_likes = 10; //total likes of all the products
    $total_all_dislikes = 5; //total dislikes of all the products
    $total_all_reviews = 7; //total reviews of all the products
    $total_all_addedToBasket = 2; //total of products that has been added to basket for all the users
    $total_all_votes = ($total_all_likes *5) + $total_all_dislikes;  //total of likes and dislikes
    $total_all_weight = $total_all_votes + $total_all_reviews + $total_all_addedToBasket; //total interactions on all the products
    $total_all_products = 200; //total products count

    //Get the average
    $avg_like = ($total_all_likes*5)/$total_all_votes; //Average of likes of all the votes 
    $avg_dislike = $total_all_dislikes/$total_all_votes; //Average of dislikes of all the votes 
    $avg_reviews = $total_all_reviews/$total_all_products; //Average of reviews of all the products
    $avg_addedToBasket = $total_all_addedToBasket/$total_all_products; //Average of added to basket count of all the products
    $avg_weight = $avg_like + $avg_dislike + $avg_reviews + $avg_addedToBasket; //Total average weight

    //New product, it has not been liked, disliked, added to basket or reviewed 
    $this_like = 0 *5;
    $this_dislike = 0;
    $this_votes  = $this_like + $this_dislike;
    $this_review     = 0;
    $this_addedToBasket = 0;
    $this_weight = $this_votes + $this_review + $this_addedToBasket;

    //$avg_rating
    //$this_rating

    $bayesian_rating = (($avg_weight * $avg_rating) + ($this_weight * $this_rating) ) / ($avg_weight + $this_weight);   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:21:51+00:00Added an answer on May 29, 2026 at 11:21 pm

    Instead of a 5-star system, you have a binary system. People either ‘like’ or ‘dislike’. The ratings are therefore naturally a number between 0 and 1 calculated by:

    likes / (likes + dislikes)
    

    You do not need to multiply by 5 to imitate a 5* rating system.

    Your code then becomes:

    $avg_rating = $total_all_likes / ($total_all_likes + $total_all_dislikes)
    $this_rating = $this_like / ($this_like + $this$total_num_positive_votes / $total_num_votes) // Check you're not dividing by 0
    $bayesian_rating = (($avg_num_votes * $avg_rating) + ($this_num_votes * $this_rating) ) / ($avg_num_votes + $this_num_votes);
    

    If you want to also take into account the number of ‘baskets’ and ‘reviews’ you can simply treat them as more ‘weight’

    $this_weight = $this_addedToBasket + $this_votes + $this_review;
    $avg_votes = $total_all_votes / $total_all_products;
    $avg_weight = $avg_addedToBasket + $avg_votews + $avg_reviews;
    $bayesian_rating = (($avg_weight * $avg_rating) + ($this_weight * $this_rating) ) / ($avg_weight + $this_weight);    
    

    This will give you a good relative ranking, however if you wish to see meaningful scores between 0 and 1, then you can normalise by dividing away the weight added by baskets and reviews.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking forward to an api that can convert html to mobi/epub format
I'm looking forward to develop an automated notification and logging-off system that notifies and
I am looking forward to find a jQuery code that allows me to have
Which of the new features are you looking forward to the most in iPhone
Possible Duplicate: What features are people looking forward to in .Net 4.0 - 4.1
Is this possible? I am looking forward to a tutorial which explains the steps
Hey everyone, I'm back and looking forward to more of your brilliance. I have
We've got products built both with GUI and CHUI. Going forward, we're looking at
I'm working on an application that requires support for forward locking of media files
Looking for an example that: Launches an EXE Waits for the EXE to finish.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.