Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add distance metrics tests and small fixes to distance metrics #210

Merged
merged 2 commits into from
Jun 27, 2022

Conversation

fejung
Copy link
Contributor

@fejung fejung commented Jun 22, 2022

Changes to the distance metrics scirpt:

  • NaN excpetion rule in the cityblockNaN for inputs in the form of vectors was missing; this resulted in giving out nan if one of the values of the vector was nan. Added:
    if not (nan.Equals (x)) then
  • the function min3 only works with integers, but currently accepts every form of input. Added:
    type annotation int behind the function parameters
    removed inline

Added unit tests for the functions in the distance metrics script:

  • tests for the euclidian distance with sequences, vectors, or arrays as input
  • tests for the cityblock distance with sequences, vectors, or arrays as input
  • tests for the Levenshtein distance with strings as input

Added the respective lines to run the tests to the main.fs script in the tests folder

add NaN catch rule for cityblock distance
specify output type of min3 function
@bvenn
Copy link
Member

bvenn commented Jun 27, 2022

  • the function min3 only works with integers, but currently accepts every form of input. Added:
    type annotation int behind the function parameters
    removed inline

The function should've worked for any input of type 'IComparable but as this function is private and only utilized as int-comparison helper, it doesn't matter at this position.

@codecov-commenter
Copy link

Codecov Report

Merging #210 (261b0b8) into developer (262f1ac) will increase coverage by 1.91%.
The diff coverage is 96.28%.

@@              Coverage Diff              @@
##           developer     #210      +/-   ##
=============================================
+ Coverage      31.61%   33.53%   +1.91%     
=============================================
  Files            124      125       +1     
  Lines          11664    11924     +260     
  Branches        1784     1785       +1     
=============================================
+ Hits            3688     3999     +311     
+ Misses          7535     7480      -55     
- Partials         441      445       +4     
Impacted Files Coverage Δ
src/FSharp.Stats/DistanceMetrics.fs 46.08% <0.00%> (+46.08%) ⬆️
tests/FSharp.Stats.Tests/Main.fs 0.00% <0.00%> (ø)
tests/FSharp.Stats.Tests/DistanceMetrics.fs 100.00% <100.00%> (ø)
src/FSharp.Stats/Fitting/Spline.fs 91.17% <0.00%> (-0.26%) ⬇️
src/FSharp.Stats/Array.fs 0.00% <0.00%> (ø)
...tats/ML/Unsupervised/PrincipalComponentAnalysis.fs 0.00% <0.00%> (ø)
src/FSharp.Stats/Ops.fs 4.00% <0.00%> (+0.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 262f1ac...261b0b8. Read the comment docs.

@bvenn bvenn merged commit 5fb2dca into fslaborg:developer Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants