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

Gradient-Boosted Trees

Gradient-Boosted Trees are ensembles of decision trees. Gradient-Boosted Trees iteratively train decision trees to minimize loss function. Gradient-Boosted Trees handle categorical features, support multiclass classification, and don't require feature scaling.

Spark ML implements Gradient-Boosted Trees using the existing decision tree implementation. It supports both classification and regression.

Let's train the StumbleUpon dataset by splitting it into 80% training and 20% testing, use Gradient-Boosted Trees from Spark to build the model, and get evaluation metrics around the test data as follows:

// split data randomly into training and testing dataset val Array(training, test) = dataFrame.randomSplit(Array(0.8, ...

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