diff options
author | Yuhao Yang <hhbyyh@gmail.com> | 2015-03-18 13:44:37 -0400 |
---|---|---|
committer | Xiangrui Meng <meng@databricks.com> | 2015-03-18 13:44:37 -0400 |
commit | a95ee242b0a9644c912fc54ed68b4301c9558bc9 (patch) | |
tree | 5a8bd53818c66c8094d45139ea142c1fcc60da7e /mllib | |
parent | 981fbafa2a878e86abeefe1d77cca01fd848f9f6 (diff) | |
download | spark-a95ee242b0a9644c912fc54ed68b4301c9558bc9.tar.gz spark-a95ee242b0a9644c912fc54ed68b4301c9558bc9.tar.bz2 spark-a95ee242b0a9644c912fc54ed68b4301c9558bc9.zip |
[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
Diffstat (limited to 'mllib')
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/mllib/regression/GeneralizedLinearAlgorithm.scala | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/regression/GeneralizedLinearAlgorithm.scala b/mllib/src/main/scala/org/apache/spark/mllib/regression/GeneralizedLinearAlgorithm.scala index 7c66e8cdeb..b262bec904 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/regression/GeneralizedLinearAlgorithm.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/regression/GeneralizedLinearAlgorithm.scala @@ -126,6 +126,11 @@ abstract class GeneralizedLinearAlgorithm[M <: GeneralizedLinearModel] /** * The dimension of training features. */ + def getNumFeatures: Int = this.numFeatures + + /** + * The dimension of training features. + */ protected var numFeatures: Int = -1 /** @@ -142,6 +147,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. */ |