From 8500b7de67afaa34675c006bff42768f1229e22e Mon Sep 17 00:00:00 2001 From: mr Date: Mon, 2 May 2011 15:00:31 +0200 Subject: fix file type in helper --- lib/helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helper.rb b/lib/helper.rb index 3031b74..7009082 100644 --- a/lib/helper.rb +++ b/lib/helper.rb @@ -90,7 +90,7 @@ before do when "xls" @accept = 'application/ms-excel' else - halt 404, "File format #{extension} not supported." + #halt 404, "File format #{extension} not supported." end end -- cgit v1.2.3 From 4e01933dda7b56049f1c1216cb5895b10c10b4a4 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 6 May 2011 13:18:28 +0000 Subject: request features in YAML format first (Dataset.load_features), chomp URIs in Dataset.all) --- lib/dataset.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/dataset.rb b/lib/dataset.rb index c61d86f..546eb2e 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -74,7 +74,7 @@ module OpenTox # @param [optional,String] uri URI of the dataset service, defaults to service specified in configuration # @return [Array] Array of dataset object without data (use one of the load_* methods to pull data from the server) def self.all(uri=CONFIG[:services]["opentox-dataset"], subjectid=nil) - RestClientWrapper.get(uri,{:accept => "text/uri-list",:subjectid => subjectid}).to_s.each_line.collect{|u| Dataset.new(u, subjectid)} + RestClientWrapper.get(uri,{:accept => "text/uri-list",:subjectid => subjectid}).to_s.each_line.collect{|u| Dataset.new(u.chomp, subjectid)} end # Load YAML representation into the dataset @@ -158,8 +158,12 @@ module OpenTox # Load and return only features from the dataset service # @return [Hash] Features of the dataset def load_features(subjectid=nil) - parser = Parser::Owl::Dataset.new(@uri, subjectid) - @features = parser.load_features(subjectid) + if (CONFIG[:yaml_hosts].include?(URI.parse(@uri).host)) + @features = YAML.load(RestClientWrapper.get(File.join(@uri,"features"), {:accept => "application/x-yaml", :subjectid => subjectid})) + else + parser = Parser::Owl::Dataset.new(@uri, subjectid) + @features = parser.load_features(subjectid) + end @features end -- cgit v1.2.3 From 41851663e591433fec1b021b88aa77a8fb0d37b0 Mon Sep 17 00:00:00 2001 From: Andreas Maunz Date: Mon, 9 May 2011 05:53:09 -0700 Subject: Hotfix: Gaussian Decay for neighbors --- lib/algorithm.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/algorithm.rb b/lib/algorithm.rb index 167c964..21a5729 100644 --- a/lib/algorithm.rb +++ b/lib/algorithm.rb @@ -165,7 +165,7 @@ module OpenTox # @param [Hash] params Keys `:similarity_algorithm,:p_values` are required # @return [Hash] Hash with keys `:prediction, :confidence` def self.local_svm_regression(neighbors,params ) - sims = neighbors.collect{ |n| n[:similarity] } # similarity values between query and neighbors + sims = neighbors.collect{ |n| Algorithm.gauss(n[:similarity]) } # similarity values between query and neighbors conf = sims.inject{|sum,x| sum + x } acts = neighbors.collect do |n| act = n[:activity] -- cgit v1.2.3