O'Reilly logo

Machine Learning with Spark - Second Edition by Nick Pentreath, Manpreet Singh Ghotra, Rajdeep Dua

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Computing performance metrics on the MovieLens dataset

Spark ML provides a convenient computeCost function to compute the WSSS objective function given a DataFrame. We will compute this metric for the following item and user training data:

val WSSSEUsers = modelUsers.computeCost(datasetUsers) println(s"Users :  Within Set Sum of Squared Errors = $WSSSEUsers") val WSSSEItems = modelItems.computeCost(datasetItems)   println(s"Items :  Within Set Sum of Squared Errors = $WSSSEItems")

This should output the result similar to the following one:

Users :  Within Set Sum of Squared Errors = 2261.3086181660324Items :  Within Set Sum of Squared Errors = 5647.825222497311

The best way to measure effectiveness of WSSSE is to plot against iterations as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required