Module: MachineLearningWorkbench::Monkey::NumericallyApproximatable

Defined in:
lib/machine_learning_workbench/monkey.rb

Instance Method Summary collapse

Instance Method Details

#approximates?(other, epsilon = 1e-5) ⇒ Boolean

Verifies if ‘self` and `other` are withing `epsilon` of each other.

Parameters:

  • other (Numeric)
  • epsilon (Numeric) (defaults to: 1e-5)

Returns:

  • (Boolean)


166
167
168
169
# File 'lib/machine_learning_workbench/monkey.rb', line 166

def approximates? other, epsilon=1e-5
  # Used for testing and NMatrix#approximates?, should I move to spec_helper?
  (self - other).abs < epsilon
end