diff options
author | mguetlein <martin.guetlein@gmail.com> | 2011-05-26 10:56:31 +0200 |
---|---|---|
committer | mguetlein <martin.guetlein@gmail.com> | 2011-05-26 10:56:31 +0200 |
commit | f13763a8505ad997739b65d7cfcd804411ff9c77 (patch) | |
tree | 2b3dc697969f722a2f30f658ca2b0ba9b6d1f06b /lib/dataset.rb | |
parent | 54301de3dc118365d09d473b2fb5379fbd135973 (diff) |
unify access to classification feature domain, replace methode feature_values with accept_values
Diffstat (limited to 'lib/dataset.rb')
-rw-r--r-- | lib/dataset.rb | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/dataset.rb b/lib/dataset.rb index 4dc4296..fc7c263 100644 --- a/lib/dataset.rb +++ b/lib/dataset.rb @@ -167,16 +167,13 @@ module OpenTox @features end - def feature_classes(feature, subjectid=nil) - if Feature.find(feature, subjectid).feature_type == "classification" - classes = [] - @data_entries.each do |c,e| - e[feature].each { |v| classes << v.to_s } - end - classes.uniq.sort - else - nil - end + # returns the accept_values of a feature, i.e. the classification domain / all possible feature values + # @param [String] feature the URI of the feature + # @return [Array] return array with strings, nil if value is not set (e.g. when feature is numeric) + def accept_values(feature) + accept_values = features[feature][OT.acceptValue] + accept_values.sort if accept_values + accept_values end # Detect feature type(s) in the dataset |