@@ -517,6 +517,9 @@ class LogisticRegression @Since("1.2.0") (
517
517
(new MultivariateOnlineSummarizer , new MultiClassSummarizer )
518
518
)(seqOp, combOp, $(aggregationDepth))
519
519
}
520
+ instr.logNamedValue(Instrumentation .loggerTags.numExamples, summarizer.count)
521
+ instr.logNamedValue(" lowestLabelWeight" , labelSummarizer.histogram.min.toString)
522
+ instr.logNamedValue(" highestLabelWeight" , labelSummarizer.histogram.max.toString)
520
523
521
524
val histogram = labelSummarizer.histogram
522
525
val numInvalid = labelSummarizer.countInvalid
@@ -560,15 +563,15 @@ class LogisticRegression @Since("1.2.0") (
560
563
if (numInvalid != 0 ) {
561
564
val msg = s " Classification labels should be in [0 to ${numClasses - 1 }]. " +
562
565
s " Found $numInvalid invalid labels. "
563
- logError(msg)
566
+ instr. logError(msg)
564
567
throw new SparkException (msg)
565
568
}
566
569
567
570
val isConstantLabel = histogram.count(_ != 0.0 ) == 1
568
571
569
572
if ($(fitIntercept) && isConstantLabel && ! usingBoundConstrainedOptimization) {
570
- logWarning(s " All labels are the same value and fitIntercept=true, so the coefficients " +
571
- s " will be zeros. Training is not needed. " )
573
+ instr. logWarning(s " All labels are the same value and fitIntercept=true, so the " +
574
+ s " coefficients will be zeros. Training is not needed." )
572
575
val constantLabelIndex = Vectors .dense(histogram).argmax
573
576
val coefMatrix = new SparseMatrix (numCoefficientSets, numFeatures,
574
577
new Array [Int ](numCoefficientSets + 1 ), Array .empty[Int ], Array .empty[Double ],
@@ -581,7 +584,7 @@ class LogisticRegression @Since("1.2.0") (
581
584
(coefMatrix, interceptVec, Array .empty[Double ])
582
585
} else {
583
586
if (! $(fitIntercept) && isConstantLabel) {
584
- logWarning(s " All labels belong to a single class and fitIntercept=false. It's a " +
587
+ instr. logWarning(s " All labels belong to a single class and fitIntercept=false. It's a " +
585
588
s " dangerous ground, so the algorithm may not converge. " )
586
589
}
587
590
@@ -590,7 +593,7 @@ class LogisticRegression @Since("1.2.0") (
590
593
591
594
if (! $(fitIntercept) && (0 until numFeatures).exists { i =>
592
595
featuresStd(i) == 0.0 && featuresMean(i) != 0.0 }) {
593
- logWarning(" Fitting LogisticRegressionModel without intercept on dataset with " +
596
+ instr. logWarning(" Fitting LogisticRegressionModel without intercept on dataset with " +
594
597
" constant nonzero column, Spark MLlib outputs zero coefficients for constant " +
595
598
" nonzero columns. This behavior is the same as R glmnet but different from LIBSVM." )
596
599
}
@@ -708,7 +711,7 @@ class LogisticRegression @Since("1.2.0") (
708
711
(_initialModel.interceptVector.size == numCoefficientSets) &&
709
712
(_initialModel.getFitIntercept == $(fitIntercept))
710
713
if (! modelIsValid) {
711
- logWarning(s " Initial coefficients will be ignored! Its dimensions " +
714
+ instr. logWarning(s " Initial coefficients will be ignored! Its dimensions " +
712
715
s " ( ${providedCoefs.numRows}, ${providedCoefs.numCols}) did not match the " +
713
716
s " expected size ( $numCoefficientSets, $numFeatures) " )
714
717
}
0 commit comments