This is an automated email from the ASF dual-hosted git repository.

lewismc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-mudrod.git


The following commit(s) were added to refs/heads/master by this push:
     new 56d37c1  Fixed bugs in FeatureBasedSimilarity (#25)
56d37c1 is described below

commit 56d37c158b931a963a928aaff5d013914cca4340
Author: quintinali <[email protected]>
AuthorDate: Wed May 23 11:59:42 2018 -0400

    Fixed bugs in FeatureBasedSimilarity (#25)
    
    Make sure "totalWeight" can't be zero before doing this division.
---
 .../sdap/mudrod/recommendation/process/FeatureBasedSimilarity.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/core/src/main/java/org/apache/sdap/mudrod/recommendation/process/FeatureBasedSimilarity.java
 
b/core/src/main/java/org/apache/sdap/mudrod/recommendation/process/FeatureBasedSimilarity.java
index c7c7497..3a18795 100644
--- 
a/core/src/main/java/org/apache/sdap/mudrod/recommendation/process/FeatureBasedSimilarity.java
+++ 
b/core/src/main/java/org/apache/sdap/mudrod/recommendation/process/FeatureBasedSimilarity.java
@@ -194,7 +194,11 @@ public class FeatureBasedSimilarity extends 
DiscoveryStepAbstract implements Ser
           }
         }
 
-        double weight = totalSim / totalWeight;
+        double weight = 0.0;
+        if(totalWeight != 0){
+          weight = totalSim / totalWeight;
+        }
+        
         UpdateRequest ur = es.generateUpdateRequest(indexName, 
variableSimType, hit.getId(), "weight", weight);
         es.getBulkProcessor().add(ur);
       }

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to