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

fix off-by-one error in euclidean distance computation #163

Merged

Conversation

mirka-henninger
Copy link
Contributor

This fixes #162. The computation of the non-gower (e.g., euclidean) distance function was off-by-one as the dist() function already only gives the off-diagonal components of the distance matrix.

@christophM
Copy link
Collaborator

Thanks Mirka, good catch.

If you have time, could you maybe add a test for this behavior? You could use the example from #162. If you don't have the time, I would just merge the pull request and add one later.

@mirka-henninger
Copy link
Contributor Author

Hi Christoph,
Thanks for taking a look at that.
I added a test for the euclidean function that was used for fitting the LocalModel and for all distance functions using get.weight.fun().
Best, Mirka

@codecov-io
Copy link

Codecov Report

Merging #163 (fff827b) into master (f1edf3b) will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #163      +/-   ##
==========================================
+ Coverage   90.88%   91.00%   +0.11%     
==========================================
  Files          17       17              
  Lines        1667     1667              
==========================================
+ Hits         1515     1517       +2     
+ Misses        152      150       -2     
Impacted Files Coverage Δ
R/LocalModel.R 97.59% <100.00%> (+2.40%) ⬆️

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 f1edf3b...fff827b. Read the comment docs.

@christophM
Copy link
Collaborator

Perfect, thanks!

@christophM christophM merged commit 067a00d into giuseppec:master Feb 3, 2021
Copy link
Collaborator

@pat-s pat-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mirka-henninger Would you mind cleaning up this file with respect to coding style?
There are superfluous whitespace introduced here and some indentions are totally off.

You can make your life easier by calling styler::style_pkg() or styler::style_file() after you're done.

Not sure if more files were touched - appreciated if you could include those as well if that's the case :)

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.

Weights in LocalModel for non-gower distance measure
4 participants