summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordv <dv@dv.de>2011-07-20 13:26:31 +0200
committerdv <dv@dv.de>2011-07-20 13:26:31 +0200
commit62930c5b40a1ed0e4f170d70c2284a004b3d0d55 (patch)
tree90a791ce511ee390423f99655272033599ff942a
parentf938a796945c3b5f9bd29c6878facfc30aa1f926 (diff)
Fixed tanimoto without weights
-rw-r--r--lib/algorithm.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/algorithm.rb b/lib/algorithm.rb
index 5f3c328..56ab94c 100644
--- a/lib/algorithm.rb
+++ b/lib/algorithm.rb
@@ -161,6 +161,7 @@ module OpenTox
#LOGGER.debug "dv --------------- common: #{common_features}, all: #{all_features}"
if common_features.size > 0
if weights
+ LOGGER.debug "nr_hits: #{params[:nr_hits]}"
if params[:nr_hits] == "true"
params[:weights] = weights
params[:mode] = "min"
@@ -175,9 +176,11 @@ module OpenTox
all_p_sum = 0.0
all_features.each{|f| all_p_sum += Algorithm.gauss(weights[f])}
end
+ LOGGER.debug "common_p_sum: #{common_p_sum}, all_p_sum: #{all_p_sum}, c/a: #{common_p_sum/all_p_sum}"
common_p_sum/all_p_sum
else
- common_features.to_f/all_features
+ LOGGER.debug "common_features : #{common_features}, all_features: #{all_features}, c/a: #{(common_features.size/all_features.size).to_f}"
+ (common_features.size/all_features.size).to_f
end
else
0.0