Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ abstract class GeneralizedLinearAlgorithm[M <: GeneralizedLinearModel]
*/
def run(input: RDD[LabeledPoint], initialWeights: Vector): M = {

if (numFeatures < 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! I get it now. This check is only carried out in one of the two run() methods. LGTM.

numFeatures = input.map(_.features.size).first()
}

if (input.getStorageLevel == StorageLevel.NONE) {
logWarning("The input data is not directly cached, which may hurt performance if its"
+ " parent RDDs are also uncached.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,12 @@ class LogisticRegressionSuite extends FunSuite with MLlibTestSparkContext with M

val model = lr.run(testRDD)

val numFeatures = testRDD.map(_.features.size).first()
val initialWeights = Vectors.dense(new Array[Double]((numFeatures + 1) * 2))
val model2 = lr.run(testRDD, initialWeights)

LogisticRegressionSuite.checkModelsEqual(model, model2)

/**
* The following is the instruction to reproduce the model using R's glmnet package.
*
Expand Down