class NumericalPredicate
Constants
- GREATER_THAN
- LESS_OR_EQUAL
Attributes
field[R]
Public Class Methods
new(attributes)
click to toggle source
# File lib/numerical_predicate.rb, line 8 def initialize(attributes) @field = attributes['field'].value.to_sym @value = Float(attributes['value'].value) @operator = attributes['operator'].value end
Public Instance Methods
true?(features)
click to toggle source
# File lib/numerical_predicate.rb, line 14 def true?(features) curr_value = Float(features[@field]) return curr_value > @value if @operator == GREATER_THAN curr_value < @value if @operator == LESS_OR_EQUAL end