Rating Products & Sorting Reviews with Amazon Dataset

Ayse Yaman
5 min readFeb 15, 2021
https://www.freepik.com/premium-vector/hand-holding-thump-up-thumbs-down-paddle_12620704.htm

Feedback and comments based on customers’ experiences are valuable sources of information. Reviews and ratings are highly effective on whether potential customers will buy the product.

The visibility of the comments is very important for the customers to find their increasing needs and get the right answers to the questions. Well, according to what we can do the order. Time? Rating? sum of Vote? … All of these variables are measurably important.

We expect rating to be higher. But we doesn’t must ignore its reliability.
ex:
up: 20 down: 2
to up: 4020 down: 870
Which scenario do we choose? or how much time has passed?

Many questions can be asked such as.

An example of Amazon’s ranking methods for user rated items, adapted fromEvan Miller’s online article

Scoring with many variables is very valuable, rather than just using the product or service as a quality criterion. How effective we make the ranking increases the availability of that product.

With the Amazon dataset, we’ll deal a few methods in python.

There are some ways you can find sorting and rating products:

Score = Average rating of products

Score = Weighted rating calculation according to the quartiles

Score = Positive rating - Negative rating

Score = Proportion of Positive ratings

The Lower Bound of Wilson Score Confidence Interval

As I mentioned above, the correct order is important and we can say that this method is the most reliable among those I have discussed.

In the case of binary up / down ratings, this uncertainty can be ranked via the Lower Bound of Wilson Score Confidence intervals.

This is the Wilson scoring formula given in Miller’s post, which we’ll use to get 95% confidence interval lower bounds:

Wilson Lower Bound on binomial confidence interval

n (total_vote)=n↑ (up)+n↓ (down) is the total number of user-votes, ˆp=n↑/n is the observed proportion of ups.

With the default parameter value α= 0.10

Evan Miller’s How Not To Sort By Average Rating post explains why the first and second methods are wrongs to rate the product or sort a product.

Let’s get to know our data set:

reviewerID - UserID. 
asin – ProductID. ex: 0000013714
reviewerName – User name
helpful – Useful comment rating
reviewText – Users' review text
overall – Products of rating
summary - Review summary
unixReviewTime – Reviewing time (unix time)
reviewTime – Reviewing time (raw)
# numbers of Rows (observation unit) in our data set, columns (variables).
df.shape
***Output: (4915, 9)# First: Average rating of products
df["overall"].mean()
***Output: 4.587589013224822# Second: Weighted rating calculation according to the quarters - according to dates
c = df["day_diff"].quantile(0.75)
b = df["day_diff"].quantile(0.50)
a = df["day_diff"].quantile(0.25)

df.loc[df["day_diff"] <= a, "overall"].mean() * 28 / 100 + \
df.loc[(df["day_diff"] > a) & (df["day_diff"] <= b), "overall"].mean() * 26 / 100 + \
df.loc[(df["day_diff"] > b) & (df["day_diff"] <= c), "overall"].mean() * 24 / 100 + \
df.loc[(df["day_diff"] > c), "overall"].mean() * 22 / 100
***Output: 4.595593165128118

Average rating:

This is the model we use as a baseline measure. The estimated quality of an object is the average rating

Difference: The third method is to use the difference between the number of ups and the number of downs as the score function.

Proportion The fourth method is to use the proportion of ups in all comments rating as the score function.

“Say what: We need to balance the proportion of positive ratings with the uncertainty of a small number of observations. What we want to ask is: Given the ratings I have, there is a 95% chance that the “real” fraction of positive ratings is at least what? Wilson gives the answer. Considering only positive and negative ratings (i.e. not a 5-star scale), the lower bound on the proportion of positive ratings is given by:”

The Lower Bound of Wilson Score Confidence, among these methods it is best to calculate a useful review sorting score.

We can analyze and decide how many comments will be on the top, how to sort..

Dataset and code source:

https://www.kaggle.com/ayseymn/sorting-reviews-amazon-dataset

References:

https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/36265.pdf

--

--