Linear regression follows a Gaussian distribution, whereas, generalized linear models (GLMs) are specifications of linear models where the response variable Y follows some distribution from the exponential family of distributions.
Let's train the bike sharing dataset by splitting it into 80 % training and 20% testing, use GeneralizedLinearRegression with regression evaluator from Spark to build the model, and get evaluation metrics around the test data.
@transient lazy val logger = Logger.getLogger(getClass.getName) def genLinearRegressionWithVectorFormat(vectorAssembler: VectorAssembler, vectorIndexer: VectorIndexer, dataFrame: DataFrame) = { val lr = new GeneralizedLinearRegression() .setFeaturesCol("features") ...