summaryrefslogtreecommitdiff
path: root/lib/feature.rb
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2011-05-27 10:06:12 +0200
committermguetlein <martin.guetlein@gmail.com>2011-05-27 10:06:12 +0200
commitaf426336f15e1f4b58c87bf09571721bb42a388f (patch)
treee09d322ca41f0731fd45c78329f679c87a4ad59d /lib/feature.rb
parent736b01c045331bb3787bf491bc4c11c222aea206 (diff)
predicted variable and confidence can now be derieved from model, adjust feature_type accordingly
Diffstat (limited to 'lib/feature.rb')
-rw-r--r--lib/feature.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/feature.rb b/lib/feature.rb
index 2f1ab6c..f3bec5c 100644
--- a/lib/feature.rb
+++ b/lib/feature.rb
@@ -2,6 +2,8 @@ module OpenTox
class Feature
include OpenTox
+ attr_accessor :subjectid
+
# Find a feature
# @param [String] uri Feature URI
# @return [OpenTox::Task] Feature object
@@ -13,9 +15,9 @@ module OpenTox
else
feature.add_metadata Parser::Owl::Dataset.new(uri).load_metadata
end
+ feature.subjectid = subjectid
feature
end
-
# provides feature type, possible types are "regression" or "classification"
# @return [String] feature type, unknown if OT.isA property is unknown/ not set
@@ -24,21 +26,19 @@ module OpenTox
"classification"
elsif metadata[RDF.type].flatten.include?(OT.NumericFeature)
"regression"
- else
- #"unknown"
- metadata[RDF.type].inspect
- end
-=begin
- case metadata[RDF.type]
- when /NominalFeature/
- "classification"
- when /NumericFeature/
- "regression"
+ elsif metadata[OWL.sameAs]
+ metadata[OWL.sameAs].each do |f|
+ begin
+ type = Feature.find(f, subjectid).feature_type
+ return type unless type=="unknown"
+ rescue => ex
+ LOGGER.warn "could not load same-as-feature '"+f.to_s+"' for feature '"+uri.to_s+"' : "+ex.message.to_s
+ end
+ end
+ "unknown"
else
"unknown"
end
-=end
end
-
end
end