关注 spark技术分享,
撸spark源码 玩spark最佳实践

LinearRegression

LinearRegression

LinearRegression is a Regressor that represents the linear regression algorithm in Machine Learning.

LinearRegression belongs to org.apache.spark.ml.regression package.

Tip
Read the scaladoc of LinearRegression.

It expects org.apache.spark.mllib.linalg.Vector as the input type of the column in a dataset and produces LinearRegressionModel.

The acceptable parameters:

LinearRegression Example

train Method

train (protected) method of LinearRegression expects a dataset DataFrame with two columns:

  1. label of type DoubleType.

  2. features of type Vector.

It returns LinearRegressionModel.

It first counts the number of elements in features column (usually features). The column has to be of mllib.linalg.Vector type (and can easily be prepared using HashingTF transformer).

赞(0) 打赏
未经允许不得转载:spark技术分享 » LinearRegression
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏