在非五星级评级系统中应用贝叶斯平均值 [英] Apply Bayesian average in a NON 5-star rating system

查看:141
本文介绍了在非五星级评级系统中应用贝叶斯平均值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待使用贝叶斯方法对列表进行优先排序,该列表可以考虑喜欢,不喜欢和评论的次数.

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);

在我的情况下,没有$avg_rating,因为它不是五星级系统,所以它将永远不存在,喜欢,不喜欢和评论的次数总是在增加,因此我需要注意列表的真实表示.

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?

已添加修改: 参考号 @Ina ,如果我将喜欢数乘以5,就可以反映出5星级系统五星级系统的价值.

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.

回到代码后,添加一些额外的变量来处理(喜欢,不喜欢,评论数量,添加到购物篮的次数),我不确定该怎么填充$avg_rating$this_rating与?

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);   

推荐答案

您有一个二进制系统而不是5星系统.人们喜欢"或不喜欢".因此,评分自然是一个介于0和1之间的数字,计算公式为:

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)

您不需要乘以5即可模拟5 *评级系统.

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

您的代码将变为:

$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);    

这将为您提供一个良好的相对排名,但是,如果您希望看到有意义的分数(介于0和1之间),则可以通过除以购物篮和评论而增加的权重进行归一化.

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.

这篇关于在非五星级评级系统中应用贝叶斯平均值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆