Skip to content

Demonstrating some simple distance measures implemented in ruby

Notifications You must be signed in to change notification settings

domhnall/distance-measures-in-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Implementing distance metrics using ruby

This small repo is intended to act as a demonstration of a number of distance metrics, relevant to the field of machine learning, as implemented in ruby.

The distance metrics implemented are:

  • euclidean_distance
  • manhattan_distance
  • chebyshev_distance
  • minkowski_distance
  • hamming_distance
  • cosine_similarity
  • jaccard_similarity

The metrics are defined as class methods on the Metrics class, and each method takes two equal-length arrays. The minkowski_distance takes an additional parameter for the p-value.

To run the tests:

rspec spec/metrics_spec.rb

Please refer to the blog article for a more detailed discussion of these metrics and their implementation.

About

Demonstrating some simple distance measures implemented in ruby

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages