blob: de7c757232c343dd48b538383d4ab5ee865428db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
module OpenTox
class Feature
include OpenTox
def self.find(uri)
feature = Feature.new uri
if (CONFIG[:yaml_hosts].include?(URI.parse(uri).host))
feature.add_metadata YAML.load(RestClientWrapper.get(uri,:accept => "application/x-yaml"))
else
feature.add_metadata Parser::Owl::Dataset.new(uri).load_metadata
end
feature
end
# provides domain (possible target values) of classification feature
# @return [Array] list with possible target values
def domain
#TODO derieve from metadata / ontology
return [true, false]
end
# provides feature type, possible types are "regression" or "classification"
# @return [String] feature type, unknown if OT.isA property is unknown/ not set
def feature_type
case metadata[OT.isA]
when /NominalFeature/
"classification"
when /NumericFeature/
"regression"
else
"unknown"
end
end
end
end
|