Class: OpenTox::Model::Generic

Inherits:
Object
  • Object
show all
Includes:
OpenTox::Model
Defined in:
lib/model.rb

Overview

Generic OpenTox model class for all API compliant services

Instance Attribute Summary

Attributes included from OpenTox

#metadata, #uri

Class Method Summary collapse

Instance Method Summary collapse

Methods included from OpenTox::Model

#run

Methods included from OpenTox

#add_metadata, all, #delete, #initialize, #load_metadata, sign_in, text_to_html, #to_rdfxml

Class Method Details

.find(uri, subjectid = nil) ⇒ OpenTox::Model::Generic

Find Generic Opentox Model via URI, and loads metadata, could raise NotFound/NotAuthorized error

Parameters:

Returns:



30
31
32
33
34
35
36
# File 'lib/model.rb', line 30

def self.find(uri,subjectid=nil)
  return nil unless uri
  model = Generic.new(uri)
  model.(subjectid)
  raise "could not load model metadata '"+uri.to_s+"'" if model.==nil or model..size==0
  model
end

Instance Method Details

#feature_type(subjectid = nil) ⇒ String

provides feature type, possible types are “regression” or “classification”

Returns:

  • (String)

    feature type, “unknown” if type could not be estimated



40
41
42
43
44
45
46
# File 'lib/model.rb', line 40

def feature_type(subjectid=nil)
  unless @feature_type
    load_predicted_variables( subjectid ) unless @predicted_variable
    @feature_type = OpenTox::Feature.find( @predicted_variable, subjectid ).feature_type
  end
  @feature_type
end

#predicted_confidence(subjectid) ⇒ Object



58
59
60
61
# File 'lib/model.rb', line 58

def predicted_confidence( subjectid )
  load_predicted_variables( subjectid ) unless @predicted_confidence
  @predicted_confidence
end

#predicted_variable(subjectid) ⇒ Object



48
49
50
51
# File 'lib/model.rb', line 48

def predicted_variable( subjectid )
  load_predicted_variables( subjectid ) unless @predicted_variable
  @predicted_variable
end

#predicted_variables(subjectid) ⇒ Object



53
54
55
56
# File 'lib/model.rb', line 53

def predicted_variables( subjectid )
  load_predicted_variables( subjectid, false ) unless @predicted_variables
  @predicted_variables
end