summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2011-05-16 16:27:54 +0200
committerAndreas Maunz <andreas@maunz.de>2011-05-16 16:27:54 +0200
commit313d1077e1e3c10c4e50cea6b5cf03162115c697 (patch)
treef82089c536f13104bed0cc1971a32d5917654adb
parent5b9783ef4eee9a15e801c5781848d5bc9e488110 (diff)
Fixed taking logs (only for exclusively non-negative values)
-rw-r--r--fminer.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/fminer.rb b/fminer.rb
index e0a0054..35e1bad 100644
--- a/fminer.rb
+++ b/fminer.rb
@@ -125,6 +125,18 @@ post '/fminer/bbrc/?' do
LOGGER.warn "Cannot find smiles for #{compound.to_s}."
next
end
+
+ # AM: take log if appropriate
+ take_logs=true
+ entry.each do |feature,values|
+ values.each do |value|
+ if prediction_feature.feature_type == "regression"
+ if (! value.nil?) && (value.to_f < 0)
+ take_logs=false
+ end
+ end
+ end
+ end
entry.each do |feature,values|
if feature == prediction_feature.uri
values.each do |value|
@@ -149,7 +161,7 @@ post '/fminer/bbrc/?' do
LOGGER.warn "Unknown class \"#{value.to_s}\"."
end
elsif prediction_feature.feature_type == "regression"
- activity = Math.log10(value.to_f)
+ activity= take_logs ? Math.log10(value.to_f) : value.to_f
end
begin
@@bbrc.AddCompound(smiles,id)