Implementing user ratings

Many online vendors ask their customers to rate the products that they purchase, typically on a scale of one to five stars. We can modify our previous Recommender2 program to incorporate these numerical ratings. To test the new version, we'll also modify our DataGenerator and Filter programs.

The modified DataGenerator program is shown in Listing 9.18:

Implementing user ratings

Listing 9.18: Program to generate random ratings

(The folded code is the same as in the DataGenerator1 program in Listing 9.2.) It creates random ratings from the set {1.0, 1.5, 2.0, 2.5, …, 5.0} that are normally distributed with mean 3.0 and standard deviation 1.0.

The only ...

Get Java Data Analysis now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.