From 89bc8a67e63cf8e752f3b89aa52f7db87ce7ea7f Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Sun, 20 Dec 2009 19:16:25 +0100 Subject: model adapted to OWL-DL, dataset predictions added --- lib/algorithm.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'lib/algorithm.rb') diff --git a/lib/algorithm.rb b/lib/algorithm.rb index a32a462..7fe08fa 100644 --- a/lib/algorithm.rb +++ b/lib/algorithm.rb @@ -14,6 +14,10 @@ module OpenTox "Feature URI for dependent variable" => { :scope => "mandatory", :value => "feature_uri" } } end + + def self.create_feature_dataset(params) + RestClient.post params[:feature_generation_uri], :dataset_uri => params[:dataset_uri], :feature_uri => params[:feature_uri] + end end class Lazar #< OpenTox @@ -35,5 +39,23 @@ module OpenTox end end + class Similarity + + def self.weighted_tanimoto(fp_a,fp_b,p) + common_features = fp_a & fp_b + all_features = fp_a + fp_b + common_p_sum = 0.0 + if common_features.size > 0 + common_features.each{|f| common_p_sum += p[f]} + all_p_sum = 0.0 + all_features.each{|f| all_p_sum += p[f]} + common_p_sum/all_p_sum + else + 0.0 + end + end + + end + end end -- cgit v1.2.3