diff options
Diffstat (limited to 'lib/model.rb')
-rw-r--r-- | lib/model.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/model.rb b/lib/model.rb new file mode 100644 index 0000000..7f43860 --- /dev/null +++ b/lib/model.rb @@ -0,0 +1,51 @@ +module OpenTox + module Model + + class Lazar < OpenTox + + # Create a new prediction model from a dataset + def initialize(params) + super(params[:uri]) + end + + # Predict a compound + def predict(compound) + LazarPrediction.new(:uri => RestClient.post(@uri, :compound_uri => compound.uri)) + end + + end + + end + + module Prediction + + module Classification + + class Lazar < OpenTox + + def initialize(params) + super(params[:uri]) + end + + def classification + YAML.load(RestClient.get @uri)[:classification] + end + + def confidence + YAML.load(RestClient.get @uri)[:confidence] + end + + def neighbors + RestClient.get @uri + '/neighbors' + end + + def features + RestClient.get @uri + '/features' + end + + end + + end + + end +end |