Class: OpenTox::Model::PredictionModel
Constant Summary
Constants inherited from Generic
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Generic
Class Method Details
.build(algorithm_uri, algorithm_params) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/model.rb', line 44 def self.build( algorithm_uri, algorithm_params ) LOGGER.debug "Build model, algorithm_uri:"+algorithm_uri.to_s+", algorithm_parms: "+algorithm_params.inspect.to_s uri = OpenTox::RestClientWrapper.post(algorithm_uri,algorithm_params).to_s LOGGER.debug "Build model done: "+uri.to_s RestClientWrapper.raise_uri_error("Invalid build model result: '"+uri.to_s+"'", algorithm_uri, algorithm_params ) unless Utils.model_uri?(uri) return PredictionModel.find(uri) end |
Instance Method Details
#classification? ⇒ Boolean
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/model.rb', line 61 def classification? #HACK replace with request to ontology server if @title =~ /(?i)classification/ return true elsif @title =~ /(?i)regression/ return false elsif @uri =~/ntua/ and @title =~ /mlr/ return false elsif @uri =~/tu-muenchen/ and @title =~ /regression|M5P|GaussP/ return false elsif @uri =~/ambit2/ and @title =~ /pKa/ || @title =~ /Regression|Caco/ return false elsif @uri =~/majority/ return (@uri =~ /class/) != nil else raise "unknown model, uri:'"+@uri.to_s+"' title:'"+@title.to_s+"'" end end |
#predict_dataset(dataset_uri) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/model.rb', line 53 def predict_dataset( dataset_uri ) LOGGER.debug "Predict dataset: "+dataset_uri.to_s+" with model "+@uri.to_s uri = RestClientWrapper.post(@uri, {:accept => "text/uri-list", :dataset_uri=>dataset_uri}) RestClientWrapper.raise_uri_error("Prediciton result no dataset uri: "+uri.to_s, @uri, {:dataset_uri=>dataset_uri} ) unless Utils.dataset_uri?(uri) uri end |