How it works...

In this recipe, we showed a generalized linear regression algorithm in action. We began by loading and parsing a CSV file into a dataset. Next, we created a generalized linear regression algorithm and generated a new model by passing our dataset to the fit() method. Once the fit operation was completed, we retrieved summary statistics from the model and displayed computed values to reconcile accuracy.

In this example, we explored fitting the data with a Gaussian distribution and Identity, but there are many more configurations that we can use to solve a specific regression fit, which are explained in the next section.

Get Apache Spark 2.x Machine Learning Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.