[SPARK-6374] [MLlib] add get for GeneralizedLinearAlgo

I find it's better to have getter for NumFeatures and addIntercept within GeneralizedLinearAlgorithm during actual usage, otherwise I 'll have to get the value through debug.

Author: Yuhao Yang <hhbyyh@gmail.com>

Closes #5058 from hhbyyh/addGetLinear and squashes the following commits:

9dc90e8 [Yuhao Yang] add get for GeneralizedLinearAlgo
This commit is contained in:
Yuhao Yang 2015-03-18 13:44:37 -04:00 committed by Xiangrui Meng
parent 981fbafa2a
commit a95ee242b0

View file

@ -123,6 +123,11 @@ abstract class GeneralizedLinearAlgorithm[M <: GeneralizedLinearModel]
*/
private var useFeatureScaling = false
/**
* The dimension of training features.
*/
def getNumFeatures: Int = this.numFeatures
/**
* The dimension of training features.
*/
@ -141,6 +146,11 @@ abstract class GeneralizedLinearAlgorithm[M <: GeneralizedLinearModel]
*/
protected def createModel(weights: Vector, intercept: Double): M
/**
* Get if the algorithm uses addIntercept
*/
def isAddIntercept: Boolean = this.addIntercept
/**
* Set if the algorithm should add an intercept. Default false.
* We set the default to false because adding the intercept will cause memory allocation.