summaryrefslogtreecommitdiff
path: root/lib/feature.rb
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2011-01-13 14:02:58 +0100
committermguetlein <martin.guetlein@gmail.com>2011-01-13 14:02:58 +0100
commitf2ca545448ab8a6f654309f23cfce9416b2e9856 (patch)
treedb97da6b26689585ab2d51467ec72a6999e32cd8 /lib/feature.rb
parentc923250bccd4023447feb46935f3b59ce5cfb843 (diff)
find methods for algorithm and model, split method for dataset, feature_type method for model and feature, perform single predicitons in resuce block, add to-html.rb, fix handling of rest-client-wrapper
Diffstat (limited to 'lib/feature.rb')
-rw-r--r--lib/feature.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/feature.rb b/lib/feature.rb
index 9e28077..de7c757 100644
--- a/lib/feature.rb
+++ b/lib/feature.rb
@@ -1,7 +1,7 @@
module OpenTox
class Feature
include OpenTox
-
+
def self.find(uri)
feature = Feature.new uri
if (CONFIG[:yaml_hosts].include?(URI.parse(uri).host))
@@ -11,5 +11,26 @@ module OpenTox
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