summaryrefslogtreecommitdiff
path: root/lib/feature.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2016-10-07 10:25:58 +0200
committerChristoph Helma <helma@in-silico.ch>2016-10-07 10:25:58 +0200
commit91787edb3682900bc5a2feeca66e5142f387fcc6 (patch)
treefcb189bb8e84c9b3727b29f0846a5f820b596aee /lib/feature.rb
parent4348eec89033e6677c9f628646fc67bd03c73fe6 (diff)
unified interface for prediction algorithms
Diffstat (limited to 'lib/feature.rb')
-rw-r--r--lib/feature.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/feature.rb b/lib/feature.rb
index c6fb68a..0ca4d41 100644
--- a/lib/feature.rb
+++ b/lib/feature.rb
@@ -2,30 +2,28 @@ module OpenTox
# Basic feature class
class Feature
- field :nominal, type: Boolean
- field :numeric, type: Boolean
field :measured, type: Boolean
field :calculated, type: Boolean
field :category, type: String
field :unit, type: String
field :conditions, type: Hash
+
+ def nominal?
+ self.class == NominalFeature
+ end
+
+ def numeric?
+ self.class == NumericFeature
+ end
end
# Feature for categorical variables
class NominalFeature < Feature
field :accept_values, type: Array
- def initialize params
- super params
- nominal = true
- end
end
# Feature for quantitative variables
class NumericFeature < Feature
- def initialize params
- super params
- numeric = true
- end
end
# Feature for SMARTS fragments