Class: OpenTox::Feature

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

Instance Attribute Summary

Attributes included from OpenTox

#metadata, #uri

Class Method Summary collapse

Instance Method Summary collapse

Methods included from OpenTox

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

Class Method Details

.find(uri, subjectid = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/feature.rb', line 5

def self.find(uri, subjectid=nil)
  return nil unless uri   
  feature = Feature.new uri
  if (CONFIG[:yaml_hosts].include?(URI.parse(uri).host))
    feature. YAML.load(RestClientWrapper.get(uri,{:accept => "application/x-yaml", :subjectid => subjectid}))
  else
    feature.  Parser::Owl::Dataset.new(uri).
  end
  feature
end

Instance Method Details

#domainArray

provides domain (possible target values) of classification feature

Returns:

  • (Array)

    list with possible target values



18
19
20
21
22
23
24
25
26
27
# File 'lib/feature.rb', line 18

def domain
  if [OT.acceptValue]
    raise "accept value found, remove hack and implement correctly"
  else
  if @uri=~/feature\/26221/ || @uri=~/feature\/221726/ 
    return ["mutagen" , "nonmutagen"]
  end
    return [true, false]
  end
end

#feature_typeString

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

Returns:

  • (String)

    feature type, unknown if OT.isA property is unknown/ not set



31
32
33
34
35
36
37
38
39
40
# File 'lib/feature.rb', line 31

def feature_type
  case [OT.isA]
  when /NominalFeature/
    "classification"
  when /NumericFeature/
    "regression"
  else
    "unknown"
  end
end