File tree Expand file tree Collapse file tree 2 files changed +2
-8
lines changed
mllib/src/main/scala/org/apache/spark/ml Expand file tree Collapse file tree 2 files changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -458,9 +458,7 @@ private class LinearSVCAggregator(
458458 */
459459 def add (instance : Instance ): this .type = {
460460 instance match { case Instance (label, weight, features) =>
461- require(weight >= 0.0 , s " instance weight, $weight has to be >= 0.0 " )
462- require(numFeatures == features.size, s " Dimensions mismatch when adding new instance. " +
463- s " Expecting $numFeatures but got ${features.size}. " )
461+
464462 if (weight == 0.0 ) return this
465463 val localFeaturesStd = bcFeaturesStd.value
466464 val localCoefficients = coefficientsArray
@@ -512,6 +510,7 @@ private class LinearSVCAggregator(
512510 * @return This LinearSVCAggregator object.
513511 */
514512 def merge (other : LinearSVCAggregator ): this .type = {
513+
515514 if (other.weightSum != 0.0 ) {
516515 weightSum += other.weightSum
517516 lossSum += other.lossSum
Original file line number Diff line number Diff line change @@ -971,9 +971,6 @@ private class LeastSquaresAggregator(
971971 */
972972 def add (instance : Instance ): this .type = {
973973 instance match { case Instance (label, weight, features) =>
974- require(dim == features.size, s " Dimensions mismatch when adding new sample. " +
975- s " Expecting $dim but got ${features.size}. " )
976- require(weight >= 0.0 , s " instance weight, $weight has to be >= 0.0 " )
977974
978975 if (weight == 0.0 ) return this
979976
@@ -1005,8 +1002,6 @@ private class LeastSquaresAggregator(
10051002 * @return This LeastSquaresAggregator object.
10061003 */
10071004 def merge (other : LeastSquaresAggregator ): this .type = {
1008- require(dim == other.dim, s " Dimensions mismatch when merging with another " +
1009- s " LeastSquaresAggregator. Expecting $dim but got ${other.dim}. " )
10101005
10111006 if (other.weightSum != 0 ) {
10121007 totalCnt += other.totalCnt
You can’t perform that action at this time.
0 commit comments