diff options
Diffstat (limited to 'lib/feature.rb')
-rw-r--r-- | lib/feature.rb | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/feature.rb b/lib/feature.rb index e768f7b..b631e46 100644 --- a/lib/feature.rb +++ b/lib/feature.rb @@ -16,23 +16,19 @@ module OpenTox feature end - # provides domain (possible target values) of classification feature - # @return [Array] list with possible target values - def domain - if metadata[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 - # 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] + if metadata[RDF.type].flatten.include?(OT.NominalFeature) + "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/ @@ -40,6 +36,7 @@ module OpenTox else "unknown" end +=end end end |