summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Vorgrimmler <vorgrimmlerdavid@gmx.de>2011-09-19 15:32:17 +0200
committerDavid Vorgrimmler <vorgrimmlerdavid@gmx.de>2011-09-19 15:32:17 +0200
commit418df9b8c5ef469df60306324f730ed4cb11667c (patch)
tree70a3c1594e3809843ecab65c2468292e664ee102
parentbce27bd8e66deebb6f438e56957f575399946a50 (diff)
Set nr_hits for regression as default. Minor modifications.
-rw-r--r--fminer.rb6
-rw-r--r--lazar.rb13
2 files changed, 14 insertions, 5 deletions
diff --git a/fminer.rb b/fminer.rb
index e220b09..d06f7ac 100644
--- a/fminer.rb
+++ b/fminer.rb
@@ -193,7 +193,7 @@ post '/fminer/bbrc/?' do
id_arrs.each { |id_count_hash|
id=id_count_hash.keys[0].to_i
count=id_count_hash.values[0].to_i
- if params[:nr_hits] == "true"
+ if params[:nr_hits]
feature_dataset.add(fminer.compounds[id], feature_uri, count)
else
feature_dataset.add(fminer.compounds[id], feature_uri, 1)
@@ -281,7 +281,7 @@ post '/fminer/last/?' do
lu = LU.new # AM LAST: uses last-utils here
dom=lu.read(xml) # AM LAST: parse GraphML
smarts=lu.smarts_rb(dom,'nls') # AM LAST: converts patterns to LAST-SMARTS using msa variant (see last-pm.maunz.de)
- params[:nr_hits] != "true" ? hit_count=false: hit_count=true
+ params[:nr_hits] ? hit_count=true: hit_count=false
matches, counts = lu.match_rb(fminer.smi,smarts,hit_count) # AM LAST: creates instantiations
matches.each do |smarts, ids|
@@ -314,7 +314,7 @@ post '/fminer/last/?' do
feature_dataset.add_feature feature_uri, metadata
end
if !hit_count
- ids.each { |id| feature_dataset.add(fminer.compounds[id], feature_uri, true)}
+ ids.each { |id| feature_dataset.add(fminer.compounds[id], feature_uri, 1)}
else
ids.each_with_index { |id,i| feature_dataset.add(fminer.compounds[id], feature_uri, counts[smarts][i])}
end
diff --git a/lazar.rb b/lazar.rb
index 5de3790..c210f69 100644
--- a/lazar.rb
+++ b/lazar.rb
@@ -61,8 +61,7 @@ post '/lazar/?' do
lazar = OpenTox::Model::Lazar.new
lazar.min_sim = params[:min_sim].to_f if params[:min_sim]
- lazar.nr_hits = true if params[:nr_hits] == "true"
-
+
if prediction_feature.feature_type == "classification"
@training_classes = training_activities.accept_values(prediction_feature.uri).sort
@training_classes.each_with_index { |c,i|
@@ -70,8 +69,18 @@ post '/lazar/?' do
params[:value_map] = lazar.value_map
}
elsif prediction_feature.feature_type == "regression"
+ lazar.nr_hits = true
lazar.prediction_algorithm = "Neighbors.local_svm_regression"
end
+
+ if params[:nr_hits] == "false" # if nr_hits is set optional to true/false it will return as String (but should be True/FalseClass)
+ lazar.nr_hits = false
+ params[:nr_hits] = false
+ elsif params[:nr_hits] == "true"
+ lazar.nr_hits = true
+ end
+ params[:nr_hits] = true if lazar.nr_hits
+
task.progress 10
if params[:feature_dataset_uri]