summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2012-06-09 10:36:27 +0200
committermguetlein <martin.guetlein@gmail.com>2012-06-09 10:36:27 +0200
commitee0eb28550ada392b7903a49d650f40c695e8612 (patch)
tree4bfff63a3bcd48a12312cbbc960f11788a904d51 /lib
parent14ade1644b69da6229ef6f06f83fc32b2d1957ce (diff)
new branch val_exp
Diffstat (limited to 'lib')
-rw-r--r--lib/dataset_cache.rb1
-rw-r--r--lib/dataset_util.rb0
-rw-r--r--lib/prediction_data.rb34
-rwxr-xr-xlib/validation_db.rb1
4 files changed, 26 insertions, 10 deletions
diff --git a/lib/dataset_cache.rb b/lib/dataset_cache.rb
index 1af1d51..7a13e9b 100644
--- a/lib/dataset_cache.rb
+++ b/lib/dataset_cache.rb
@@ -12,6 +12,7 @@ module Lib
return nil if (dataset_uri==nil)
d = @@cache[dataset_uri.to_s+"_"+subjectid.to_s]
if d==nil
+ LOGGER.debug "loading dataset #{dataset_uri}"
d = OpenTox::Dataset.find(dataset_uri, subjectid)
@@cache[dataset_uri.to_s+"_"+subjectid.to_s] = d
end
diff --git a/lib/dataset_util.rb b/lib/dataset_util.rb
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lib/dataset_util.rb
diff --git a/lib/prediction_data.rb b/lib/prediction_data.rb
index d387d24..5f11957 100644
--- a/lib/prediction_data.rb
+++ b/lib/prediction_data.rb
@@ -172,11 +172,16 @@ module Lib
predicted_values = []
confidence_values = []
+ dup_compounds = []
+ dup_actual_values = []
count = 0
- compounds.each do |c|
+ compounds.size.times do |i|
+ c = compounds[i]
if prediction_dataset.compounds.index(c)==nil
predicted_values << nil
confidence_values << nil
+ dup_compounds << c
+ dup_actual_values << actual_values[i]
else
case feature_type
when "classification"
@@ -184,19 +189,28 @@ module Lib
when "regression"
vals = regression_vals(prediction_dataset, c, predicted_variable)
end
- raise "not yet implemented: more than one prediction for one compound" if vals.size>1
- predicted_values << vals[0]
- if predicted_confidence
- confidence_values << confidence_val(prediction_dataset, c, predicted_confidence)
- else
- confidence_values << nil
- end
+
+ #vals.uniq! #more than one prediciton is ok if it yields the equal value
+ #raise "not yet implemented: more than one prediction for one compound '#{vals.inspect}'" if vals.size>1
+ #predicted_values << vals[0]
+
+ vals.each do |val|
+ dup_compounds << c
+ dup_actual_values << actual_values[i]
+ predicted_values << val
+
+ if predicted_confidence
+ confidence_values << confidence_val(prediction_dataset, c, predicted_confidence)
+ else
+ confidence_values << nil
+ end
+ end
end
count += 1
end
- all_compounds += compounds
+ all_compounds += dup_compounds
all_predicted_values += predicted_values
- all_actual_values += actual_values
+ all_actual_values += dup_actual_values
all_confidence_values += confidence_values
task.progress( task_status += task_step ) if task # loaded predicted values and confidence
diff --git a/lib/validation_db.rb b/lib/validation_db.rb
index 086853e..17bd506 100755
--- a/lib/validation_db.rb
+++ b/lib/validation_db.rb
@@ -85,6 +85,7 @@ module Validation
index :prediction_feature
index :training_dataset_uri
index :test_dataset_uri
+ index :finished
attr_accessor :subjectid