diff options
author | Andreas Maunz <andreas@maunz.de> | 2011-05-16 16:27:54 +0200 |
---|---|---|
committer | Andreas Maunz <andreas@maunz.de> | 2011-05-16 16:27:54 +0200 |
commit | 313d1077e1e3c10c4e50cea6b5cf03162115c697 (patch) | |
tree | f82089c536f13104bed0cc1971a32d5917654adb | |
parent | 5b9783ef4eee9a15e801c5781848d5bc9e488110 (diff) |
Fixed taking logs (only for exclusively non-negative values)
-rw-r--r-- | fminer.rb | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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) |