diff options
author | Andreas Maunz <andreas@maunz.de> | 2011-05-26 13:11:32 +0200 |
---|---|---|
committer | Andreas Maunz <andreas@maunz.de> | 2011-05-26 13:11:32 +0200 |
commit | f507227fd4efff3c8b32b2a8c8f2860af2546e3b (patch) | |
tree | 6b6af8485042f0e12a8693c02d67ac5548d46cd0 /lib/model.rb | |
parent | f13763a8505ad997739b65d7cfcd804411ff9c77 (diff) |
Hotfix: Switch to balanced mode.
Diffstat (limited to 'lib/model.rb')
-rw-r--r-- | lib/model.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/model.rb b/lib/model.rb index 139aed8..14471cc 100644 --- a/lib/model.rb +++ b/lib/model.rb @@ -176,11 +176,15 @@ module OpenTox return @prediction_dataset if database_activity(subjectid) - - if metadata[RDF.type] == [OTA.ClassificationLazySingleTarget] + load_metadata(subjectid) + case OpenTox::Feature.find(metadata[OT.dependentVariables]).feature_type + when "classification" # AM: Balancing, see http://www.maunz.de/wordpress/opentox/2011/balanced-lazar l = Array.new # larger s = Array.new # smaller fraction + + raise "no fingerprints in model" if @fingerprints.size==0 + @fingerprints.each do |training_compound,training_features| @activities[training_compound].each do |act| case act.to_s @@ -231,6 +235,7 @@ module OpenTox ### END AM balanced predictions else # regression case: no balancing + LOGGER.info "LAZAR: Unbalanced." neighbors prediction = eval("#{@prediction_algorithm}(@neighbors,{:similarity_algorithm => @similarity_algorithm, :p_values => @p_values})") end |