Over a million developers have joined DZone.

Understanding the Book-Crossing Dataset: Visualizing Status Data

DZone's Guide to

Understanding the Book-Crossing Dataset: Visualizing Status Data

· Big Data Zone ·
Free Resource

Learn how to operationalize machine learning and data science projects to monetize your AI initiatives. Download the Gartner report now.

When you look around Amazon for book reviews, you notice that some users are consistently harsher than others. For example, some users never give five stars. This observation goes the other way around too. Some users are so generous with stars that the worst they would ever give is three out of five even if the review itself is a litany of complaints. Let’s call them Harsh and Generous, respectively.

And there is another group of users that we might conflate with Harsh and Generous: Lazy. Lazy users do not put much effort into rating books. They just pick an arbitrary rating because they have an extrinsic motivation (ex: getting something for free by cranking out reviews). If lazy users decide to always rate books at 5/10 or 10/10, they might appear harsh or generous although they are just lazy in reality.

Defining Harsh, Generous and Lazy

Take a look at this graph:

Based on this graph, let’s define Harsh, Generous and Laxy as follows:

  • Generous: Always gives 9 or higher.
  • Harsh: Always gives 5 or lower.
  • Lazy: Always gives the same rating and has rated more than 5 times.

The “more than 5 times” condition for the Lazy is intended to filter out infrequent reviewers (Hence, the Lazy is not so lazy after all — at least they submit a lot of reviews!)

Query 1: Counting Harsh, Generous and Lazy

Result     :
| rating_type | cnt |
| Generous    | 137 |
| Harsh       | 64  |
| Lazy        | 137 |

There are 105283 users that have rated at least one book, so, Generous/Harsh/Lazy all account for ~0.1% of the users.

A closer look at the Lazy

Let’s look at the distribution of lazy users.

Query 2: Distribution of lazy users.

Result     :
| book_rating | cnt |
| 5.0         | 53  |
| 6.0         | 1   |
| 7.0         | 3   |
| 8.0         | 8   |
| 9.0         | 4   |
| 10.0        | 68  |

Interestingly, lazy users prefer to give 5 (the middle rating in this 1-10 scale) or 10 (the maximum) to any other numbers.

Notes on the Harsh and the Generous

To wrap up this entry, I will give a few remarks about the Harsh and the Generous. Here is a question: which books are affected the most by the Harsh and the Generous?

Query 3 & 4 answer this question. Because the original definition of the Harsh and the Generous had very few samples, we relaxed the definitions to “those who rate 6 or lower” and “those who rate 8 or higher.” Those Hive queries are pretty hairy, but it goes to show how much analysis you can actually do just in HiveQL. Those queries list books that are 20 books most impacted by the Generous and the Harsh, respectively.

Top 20 impacted by the Generous

Top 20 impacted by the Harsh

What’s intriguing is that the two lists do not overlap at all. The lack of overlap suggests that the Harsh and the Generous might be attracted to different types of books. Finding out which feature effectively separates the Harsh from the Generous can bring insights to both authors and publishers.

Bias comes in a variety of forms, all of them potentially damaging to the efficacy of your ML algorithm. Our Chief Data Scientist discusses the source of most headlines about AI failures here.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}