Module: OpenTox::Algorithm
- Defined in:
- lib/algorithm.rb,
lib/regression.rb,
lib/classification.rb
Defined Under Namespace
Classes: Classification, Regression
Class Method Summary collapse
-
.run(algorithm, object, parameters = nil) ⇒ Object
Generic method to execute algorithms Algorithms should: - accept a Compound, an Array of Compounds or a Dataset as first argument - optional parameters as second argument - return an object corresponding to the input type as result (eg. Compound -> value, Array of Compounds -> Array of values, Dataset -> Dataset with values.
Class Method Details
.run(algorithm, object, parameters = nil) ⇒ Object
Generic method to execute algorithms Algorithms should:
- accept a Compound, an Array of Compounds or a Dataset as first argument
- optional parameters as second argument
- return an object corresponding to the input type as result (eg. Compound -> value, Array of Compounds -> Array of values, Dataset -> Dataset with values
13 14 15 16 17 |
# File 'lib/algorithm.rb', line 13 def self.run algorithm, object, parameters=nil bad_request_error "Cannot run '#{algorithm}' algorithm. Please provide an OpenTox::Algorithm." unless algorithm =~ /^OpenTox::Algorithm/ klass,method = algorithm.split('.') parameters.nil? ? Object.const_get(klass).send(method,object) : Object.const_get(klass).send(method,object, parameters) end |