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

Examples/fix knn #903

Merged
merged 6 commits into from
Feb 14, 2022
Merged

Examples/fix knn #903

merged 6 commits into from
Feb 14, 2022

Conversation

ClaudiaComito
Copy link
Contributor

@ClaudiaComito ClaudiaComito commented Jan 20, 2022

Description

The knn demo stopped working at some unspecified time.

Here's a version that runs. However, it returns a different accuracy depending on the number of MPI processes I run it on:

(heat-dev3.8) Claudias-MBP:heat c.comito$ mpirun --tag-output --use-hwthread-cpus -n 1 python demo_knn.py 
[1,0]<stdout>:Accuracy: [0.9333333373069763]
(heat-dev3.8) Claudias-MBP:heat c.comito$ mpirun --tag-output --use-hwthread-cpus -n 2 python demo_knn.py 
[1,0]<stdout>:Accuracy: [0.5333333611488342]
[1,1]<stdout>:Accuracy: [0.5333333611488342]
(heat-dev3.8) Claudias-MBP:heat c.comito$ mpirun --tag-output --use-hwthread-cpus -n 3 python demo_knn.py 
[1,1]<stdout>:Accuracy: [0.9833333492279053]
[1,0]<stdout>:Accuracy: [0.9833333492279053]
[1,2]<stdout>:Accuracy: [0.9833333492279053]
(heat-dev3.8) Claudias-MBP:heat c.comito$ mpirun --tag-output --use-hwthread-cpus -n 4 python demo_knn.py 
[1,0]<stdout>:Accuracy: [0.7666666507720947]
[1,1]<stdout>:Accuracy: [0.7666666507720947]
[1,2]<stdout>:Accuracy: [0.7666666507720947]
[1,3]<stdout>:Accuracy: [0.7666666507720947]

~~Help would be great @mtar @coquelin77 @Inzlinger ~~

EDIT Feb 8.: The unstable accuracy is due to a getitem call within KNearestNeighbours.predict(), where the indices are distributed and not ordered, see #914. Since it's not a specific knn problem, this PR is ready for review.

Issue/s resolved: #

Changes proposed:

  • update demo script

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation update

Memory requirements

N.A.

Performance

N.A.

Due Diligence

  • All split configurations tested
  • Multiple dtypes tested in relevant functions
  • Documentation updated (if needed)
  • Updated changelog.md under the title "Pending Additions"

Does this change modify the behaviour of other functions? If so, which?

no

skip ci

@ClaudiaComito ClaudiaComito added the help wanted Extra attention is needed label Jan 20, 2022
@ClaudiaComito ClaudiaComito added this to the 1.2.x milestone Jan 20, 2022
@codecov
Copy link

codecov bot commented Jan 20, 2022

Codecov Report

Merging #903 (6a0b2de) into master (c6ebf00) will decrease coverage by 4.42%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #903      +/-   ##
==========================================
- Coverage   95.49%   91.07%   -4.43%     
==========================================
  Files          64       64              
  Lines        9793     9793              
==========================================
- Hits         9352     8919     -433     
- Misses        441      874     +433     
Flag Coverage Δ
gpu ?
unit 91.07% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
heat/optim/dp_optimizer.py 24.19% <0.00%> (-71.89%) ⬇️
heat/core/stride_tricks.py 81.53% <0.00%> (-12.31%) ⬇️
heat/core/devices.py 86.66% <0.00%> (-11.12%) ⬇️
heat/nn/data_parallel.py 84.13% <0.00%> (-10.35%) ⬇️
heat/cluster/spectral.py 85.71% <0.00%> (-8.58%) ⬇️
heat/core/communication.py 89.90% <0.00%> (-6.86%) ⬇️
heat/core/tests/test_suites/basic_test.py 91.26% <0.00%> (-4.86%) ⬇️
heat/core/linalg/qr.py 97.30% <0.00%> (-2.70%) ⬇️
heat/utils/data/partial_dataset.py 92.30% <0.00%> (-2.06%) ⬇️
heat/core/linalg/basics.py 94.22% <0.00%> (-1.31%) ⬇️
... and 7 more

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 c6ebf00...6a0b2de. Read the comment docs.

@ClaudiaComito ClaudiaComito removed the help wanted Extra attention is needed label Feb 8, 2022
@ClaudiaComito ClaudiaComito added the documentation Anything related to documentation label Feb 9, 2022
@coquelin77
Copy link
Member

coquelin77 commented Feb 14, 2022

NOTE: the accuracy bug is still open, however this PR fixes the issue that the classifier in the example was not called previously (as noted in the first comment)

see #914

@coquelin77 coquelin77 merged commit 66da5c2 into master Feb 14, 2022
@mtar mtar deleted the examples/fix_knn branch February 28, 2024 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Anything related to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants