diff options
author | Christoph Helma <helma@in-silico.ch> | 2015-11-04 17:50:17 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2015-11-04 17:50:17 +0100 |
commit | ca2bb0f90335b1f2c4ecc28ee423e85b281ffcf0 (patch) | |
tree | 71f823d08e0799b8ebb59713f06f646888135cd7 /lib/classification.rb | |
parent | 61fda66b5bc86e600b27f9a2c2eaea97603fbb92 (diff) |
neighbor search delegated to database backend
Diffstat (limited to 'lib/classification.rb')
-rw-r--r-- | lib/classification.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/classification.rb b/lib/classification.rb index b4b2e59..7a225bb 100644 --- a/lib/classification.rb +++ b/lib/classification.rb @@ -5,14 +5,12 @@ module OpenTox def self.weighted_majority_vote compound, params neighbors = params[:neighbors] - return {:value => nil,:confidence => nil,:warning => "Cound not find similar compounds."} if neighbors.empty? weighted_sum = {} sim_sum = 0.0 confidence = 0.0 neighbors.each do |row| - n,sim,acts = row - #confidence = sim if sim > confidence # distance to nearest neighbor - acts.each do |act| + sim = row["tanimoto"] + row["features"][params[:prediction_feature_id].to_s].each do |act| weighted_sum[act] ||= 0 weighted_sum[act] += sim end |