within FSharp.Stats.DistanceMetrics, there are specialized modules Vector and Array, 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 within DistanceMetrics.Vector and DistanceMetrics.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. and nan entries
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](https://dotnet.microsoft.com/en-us/download)
- to build the binaries yourself follow the [instructions](https://fslab.org/FSharp.Stats/#Installation)
- while working on the [FSharp.Stats documentation](https://fslab.org/FSharp.Stats/) (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`
Description
The Hamming distance is used to determine the number of positions at which two sequences of equal size differ [1].
References
Pointers
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
.0.
andnan
entriesHints (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](https://dotnet.microsoft.com/en-us/download) - to build the binaries yourself follow the [instructions](https://fslab.org/FSharp.Stats/#Installation) - while working on the [FSharp.Stats documentation](https://fslab.org/FSharp.Stats/) (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`