Database Reference
In-Depth Information
(294,0.6812075443259535)
(413,0.6754663844488256)
(184,0.6702643811753909)
(109,0.6594872765176396)
Not surprisingly, we can see that the top-ranked similar item is our item. The rest are the
other items in our set of items, ranked in order of our similarity metric.
Inspecting the similar items
Let's see what the title of our chosen movie is:
println(titles(itemId))
The preceding code will print the following output:
Wes Craven's New Nightmare (1994)
As we did for user recommendations, we can sense check our item-to-item similarity
computations and take a look at the titles of the most similar movies. This time, we will
take the top 11 so that we can exclude our given movie. So, we will take the numbers 1 to
11 in the list:
val sortedSims2 = sims.top(K + 1)(Ordering.by[(Int,
Double), Double] { case (id, similarity) => similarity })
sortedSims2.slice(1, 11).map{ case (id, sim) =>
(titles(id), sim) }.mkString("\n")
You will see the movie titles and scores displayed similar to this output:
(Hideaway (1995),0.6932331537649621)
(Body Snatchers (1993),0.6898690594544726)
(Evil Dead II (1987),0.6897964975027041)
(Alien: Resurrection (1997),0.6891221044611473)
(Stephen King's The Langoliers (1995),0.6864214133620066)
(Liar Liar (1997),0.6812075443259535)
(Tales from the Crypt Presents: Bordello of Blood
(1996),0.6754663844488256)
(Army of Darkness (1993),0.6702643811753909)
(Mystery Science Theater 3000: The Movie
Search WWH ::




Custom Search