diff options
author | Martin Gütlein <martin.guetlein@gmail.com> | 2010-04-14 11:33:44 +0200 |
---|---|---|
committer | Martin Gütlein <martin.guetlein@gmail.com> | 2010-04-14 11:33:44 +0200 |
commit | a35e4d1540b74d6687529b43c1c6e5b85deb680e (patch) | |
tree | 17e4a91fedc7b7e43eeedd5fc7e6911358ee515c /lib | |
parent | b3e888fea0c750ca2c10c5b12bcc12c877aa1813 (diff) |
removing class feature in test-datsets, introduced test_class_dataset
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ot_predictions.rb | 21 | ||||
-rw-r--r-- | lib/validation_db.rb | 3 |
2 files changed, 19 insertions, 5 deletions
diff --git a/lib/ot_predictions.rb b/lib/ot_predictions.rb index 9e6f5c9..0176dcf 100644 --- a/lib/ot_predictions.rb +++ b/lib/ot_predictions.rb @@ -15,10 +15,11 @@ module Lib return @compounds[instance_index] end - def initialize(is_classification, test_dataset_uri, prediction_feature, prediction_dataset_uri, predicted_variable) + def initialize(is_classification, test_dataset_uri, test_target_datset_uri, prediction_feature, prediction_dataset_uri, predicted_variable) LOGGER.debug("loading prediciton via test-dateset:'"+test_dataset_uri.to_s+ - "' and prediction-dataset:'"+prediction_dataset_uri.to_s+ + "', test-target-datset:'"+test_target_datset_uri.to_s+ + "', prediction-dataset:'"+prediction_dataset_uri.to_s+ "', prediction_feature: '"+prediction_feature.to_s+"' "+ "', predicted_variable: '"+predicted_variable.to_s+"'") @@ -31,7 +32,19 @@ module Lib test_dataset = OpenTox::Dataset.find test_dataset_uri raise "test dataset not found: '"+test_dataset_uri.to_s+"'" unless test_dataset - raise "test dataset feature not found: '"+prediction_feature.to_s+"', available features: "+test_dataset.features.inspect if test_dataset.features.index(prediction_feature)==nil + + if test_target_datset_uri == nil || test_target_datset_uri==test_dataset_uri + test_class_dataset = test_dataset + else + test_class_dataset = OpenTox::Dataset.find test_target_datset_uri + raise "test target datset not found: '"+test_target_datset_uri.to_s+"'" unless test_class_dataset + if CHECK_VALUES + test_dataset.compounds.each do |c| + raise "test compound not found on test class dataset "+c.to_s unless test_class_dataset.compounds.include?(c) + end + end + end + raise "test dataset feature not found: '"+prediction_feature.to_s+"', available features: "+test_class_dataset.features.inspect if test_class_dataset.features.index(prediction_feature)==nil @compounds = test_dataset.compounds LOGGER.debug "test dataset size: "+@compounds.size.to_s @@ -41,7 +54,7 @@ module Lib actual_values = [] @compounds.each do |c| - value = test_dataset.get_value(c, prediction_feature) + value = test_class_dataset.get_value(c, prediction_feature) if is_classification value = value.to_s unless value==nil diff --git a/lib/validation_db.rb b/lib/validation_db.rb index cb6708c..322d4cb 100644 --- a/lib/validation_db.rb +++ b/lib/validation_db.rb @@ -8,7 +8,7 @@ require "lib/merge.rb" module Lib VAL_PROPS_GENERAL = [ :id, :uri, :model_uri, :algorithm_uri, :training_dataset_uri, :prediction_feature, - :test_dataset_uri, :prediction_dataset_uri, :created_at ] + :test_dataset_uri, :test_class_dataset_uri, :prediction_dataset_uri, :created_at ] VAL_PROPS_SUM = [ :num_instances, :num_without_class, :num_unpredicted ] VAL_PROPS_AVG = [:real_runtime, :percent_without_class, :percent_unpredicted ] VAL_PROPS = VAL_PROPS_GENERAL + VAL_PROPS_SUM + VAL_PROPS_AVG @@ -55,6 +55,7 @@ module Lib property :model_uri, String, :length => 255 property :algorithm_uri, String, :length => 255 property :training_dataset_uri, String, :length => 255 + property :test_class_dataset_uri, String, :length => 255 property :test_dataset_uri, String, :length => 255 property :prediction_dataset_uri, String, :length => 255 property :prediction_feature, String, :length => 255 |