From a5b5c0790de08b4deee7d72851070201cca1c744 Mon Sep 17 00:00:00 2001 From: mguetlein Date: Fri, 17 Jun 2011 12:11:02 +0200 Subject: prefer prediction_feature, use Model.dependentVariables if no prediction feature is specified --- validation/validation_service.rb | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/validation/validation_service.rb b/validation/validation_service.rb index 8d64cd1..77cc694 100755 --- a/validation/validation_service.rb +++ b/validation/validation_service.rb @@ -135,7 +135,6 @@ module Validation params[alg_param[0].to_sym] = alg_param[1] end end - LOGGER.debug "building model '"+algorithm_uri.to_s+"' "+params.inspect algorithm = OpenTox::Algorithm::Generic.new(algorithm_uri) params[:subjectid] = subjectid @@ -169,26 +168,12 @@ module Validation model = OpenTox::Model::Generic.find(self.model_uri, self.subjectid) unless self.algorithm_uri -# self.attributes = { :algorithm_uri => model.algorithm } -# self.save! - #self.update :algorithm_uri => model.algorithm self.algorithm_uri = model.metadata[OT.algorithm] end - - if self.prediction_feature and model.uri=~/ambit2\/model/ - LOGGER.warn "REMOVE AMBIT HACK TO __NOT__ RELY ON DEPENDENT VARIABLE" - else + if self.prediction_feature.to_s.size==0 dependentVariables = model.metadata[OT.dependentVariables] - if self.prediction_feature - raise OpenTox::NotFoundError.new "error validating model: model.dependent_variable != validation.prediction_feature ("+ - dependentVariables.to_s+" != "+self.prediction_feature+"), model-metadata is "+model.metadata.inspect if self.prediction_feature!=dependentVariables - else - raise OpenTox::NotFoundError.new "model has no dependentVariables specified, please give prediction feature for model validation" unless dependentVariables - #self.attributes = { :prediction_feature => model.dependentVariables } - #self.save! - #self.update :prediction_feature => model.dependentVariables - self.prediction_feature = model.metadata[OT.dependentVariables] - end + raise OpenTox::NotFoundError.new "model has no dependentVariables specified, please give prediction_feature for model validation" unless dependentVariables + self.prediction_feature = model.metadata[OT.dependentVariables] end prediction_dataset_uri = "" -- cgit v1.2.3