Hamming distance
Closed this issue · 1 comments
bvenn commented
Description
The Hamming distance is used to determine the number of positions at which two sequences of equal size differ [1].
References
Pointers
- the implementation should be located here: https://github.com/fslaborg/FSharp.Stats/blob/developer/src/FSharp.Stats/DistanceMetrics.fs
- within FSharp.Stats.DistanceMetrics, there are specialized modules
Vector
andArray
, that contain the same functionality as the overarching module, but are optimized for high performance. You should first implement a version, that works on two sequences of generic type and if appropriate add optimized versions withinDistanceMetrics.Vector
andDistanceMetrics.Array
. - if not inferred automatically, you can ensure that the function works on any input (seq, string, seq), by adding the inline keyword
let inline hamming (s1: 'a) (s2: 'a) : int = //iterate over both sequences and compare the entries at each index for equality //since the hamming distance is the number of unequal comparisons the result is and integer
- optional: add unit tests for sequences of int, float, and strings according to this.
- don't forget to test negative values within the input sequence, as well as
0.
andnan
entries
- don't forget to test negative values within the input sequence, as well as
- optional: add proper XML documentation #281
- Of course you can start developing in notebooks/scripts and afterwards we try to incorporate into the library.
Hints (click to expand if you need additional pointers)
- To be able to contribute to this library you'll need
- an GitHub account
- an IDE like Visual Studio Community or Visual Studio Code
- dotnet 6 sdk
- to build the binaries yourself follow the instructions
- while working on the FSharp.Stats documentation (any file within https://github.com/fslaborg/FSharp.Stats/tree/developer/docs) you can navigate to the project folder with a prompt of your choice and use the command
./build watchdocs
- unit tests can be executed via
./build runtests
Samo8 commented
On it