Skip to content

Commit

Permalink
[SPARK-18901][ML] Require in LR LogisticAggregator is redundant
Browse files Browse the repository at this point in the history
## What changes were proposed in this pull request?

In MultivariateOnlineSummarizer,

`add` and `merge` have check for weights and feature sizes. The checks in LR are redundant, which are removed from this PR.

## How was this patch tested?

Existing tests.

Author: wm624@hotmail.com <wm624@hotmail.com>

Closes #17478 from wangmiao1981/logit.
  • Loading branch information
wangmiao1981 authored and yanboliang committed Apr 24, 2017
1 parent 776a2c0 commit 90264ac
Showing 1 changed file with 0 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1571,9 +1571,6 @@ private class LogisticAggregator(
*/
def add(instance: Instance): this.type = {
instance match { case Instance(label, weight, features) =>
require(numFeatures == features.size, s"Dimensions mismatch when adding new instance." +
s" Expecting $numFeatures but got ${features.size}.")
require(weight >= 0.0, s"instance weight, $weight has to be >= 0.0")

if (weight == 0.0) return this

Expand All @@ -1596,8 +1593,6 @@ private class LogisticAggregator(
* @return This LogisticAggregator object.
*/
def merge(other: LogisticAggregator): this.type = {
require(numFeatures == other.numFeatures, s"Dimensions mismatch when merging with another " +
s"LogisticAggregator. Expecting $numFeatures but got ${other.numFeatures}.")

if (other.weightSum != 0.0) {
weightSum += other.weightSum
Expand Down

0 comments on commit 90264ac

Please sign in to comment.