summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2011-08-04 19:30:16 +0200
committermguetlein <martin.guetlein@gmail.com>2011-08-04 19:30:16 +0200
commit458e8e48b231dc2da361e31df941313fe06a81b7 (patch)
tree7d0d90c62129013b62dfae8d8acbe7959a7ee0ba
parentdb4f1b61f588bfb59f161763922199c8a07d7a56 (diff)
fix cv when no predictions on a fold
-rwxr-xr-xlib/ot_predictions.rb22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/ot_predictions.rb b/lib/ot_predictions.rb
index d0530a3..335fe84 100755
--- a/lib/ot_predictions.rb
+++ b/lib/ot_predictions.rb
@@ -23,12 +23,12 @@ module Lib
prediction_dataset_uris = [prediction_dataset_uris] unless prediction_dataset_uris.is_a?(Array)
predicted_variables = [predicted_variables] unless predicted_variables.is_a?(Array)
predicted_confidences = [predicted_confidences] unless predicted_confidences.is_a?(Array)
- LOGGER.debug "loading prediciton -- test-dataset: "+test_dataset_uris.inspect
- LOGGER.debug "loading prediciton -- test-target-datset: "+test_target_dataset_uris.inspect
- LOGGER.debug "loading prediciton -- prediction-dataset: "+prediction_dataset_uris.inspect
- LOGGER.debug "loading prediciton -- predicted_variable: "+predicted_variables.inspect
- LOGGER.debug "loading prediciton -- predicted_confidence: "+predicted_confidences.inspect
- LOGGER.debug "loading prediciton -- prediction_feature: "+prediction_feature.to_s
+ LOGGER.debug "loading prediction -- test-dataset: "+test_dataset_uris.inspect
+ LOGGER.debug "loading prediction -- test-target-datset: "+test_target_dataset_uris.inspect
+ LOGGER.debug "loading prediction -- prediction-dataset: "+prediction_dataset_uris.inspect
+ LOGGER.debug "loading prediction -- predicted_variable: "+predicted_variables.inspect
+ LOGGER.debug "loading prediction -- predicted_confidence: "+predicted_confidences.inspect
+ LOGGER.debug "loading prediction -- prediction_feature: "+prediction_feature.to_s
raise "prediction_feature missing" unless prediction_feature
@compounds = []
@@ -104,14 +104,16 @@ module Lib
prediction_dataset = Lib::DatasetCache.find prediction_dataset_uri,subjectid
raise "prediction dataset not found: '"+prediction_dataset_uri.to_s+"'" unless prediction_dataset
+
+ # allow missing prediction feature if there are no compounds in the prediction dataset
raise "predicted_variable not found in prediction_dataset\n"+
- "predicted_variable '"+predicted_variable.to_s+"'\n"+
- "prediction_dataset: '"+prediction_dataset_uri.to_s+"'\n"+
- "available features are: "+prediction_dataset.features.inspect if prediction_dataset.features.keys.index(predicted_variable)==nil
+ "predicted_variable '"+predicted_variable.to_s+"'\n"+
+ "prediction_dataset: '"+prediction_dataset_uri.to_s+"'\n"+
+ "available features are: "+prediction_dataset.features.inspect if prediction_dataset.features.keys.index(predicted_variable)==nil and prediction_dataset.compounds.size>0
raise "predicted_confidence not found in prediction_dataset\n"+
"predicted_confidence '"+predicted_confidence.to_s+"'\n"+
"prediction_dataset: '"+prediction_dataset_uri.to_s+"'\n"+
- "available features are: "+prediction_dataset.features.inspect if predicted_confidence and prediction_dataset.features.keys.index(predicted_confidence)==nil
+ "available features are: "+prediction_dataset.features.inspect if predicted_confidence and prediction_dataset.features.keys.index(predicted_confidence)==nil and prediction_dataset.compounds.size>0
raise "more predicted than test compounds, #test: "+compounds.size.to_s+" < #prediction: "+
prediction_dataset.compounds.size.to_s+", test-dataset: "+test_dataset_uri.to_s+", prediction-dataset: "+