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 divide-by-zero, deprecation, and futurewarnings #236

Merged
merged 4 commits into from
Oct 8, 2021

Conversation

erooke
Copy link
Contributor

@erooke erooke commented Oct 7, 2021

Currently the test suite generates a handful of warnings. These include:

  • Deprecation warnings for np.float and np.int
  • Future warnings about AffinityPropogation api changes
  • Division by 0 warnings
  • Invalid division (0 / 0) warnings
    This pull request aims to fix these warnings. It changes all occurences of np.int and np.float to int and float respectively, adds randomstate=0 to AffinityPropogation to keep previous behavior, and silences division by 0 errors as the behavior x / 0 = inf seems to be the expect behavior where they arose. It does not fix the invalid division error as I don't understand the function which raises that warning well enough to tell if NaN is expected behavior or if the data has to be cleansed somehow.

`np.float` and `np.int` have been deprecated. Replaced with the built in
`float` and `int` respectively.
`sklearn` added random state as input to `AffinityPropogation` in 0.23.
To preserve the old behavior `randomstate = 0` was added as this is the
previous hard coded value according to the docs here
`https://scikit-learn.org/stable/modules/generated/sklearn.cluster.AffinityPropagation.html`
Division by 0 in the clustering and visualization code seems to happen
in the normal course of operation and should result in `inf` thus
silencing the warnings at those points.
@codecov
Copy link

codecov bot commented Oct 7, 2021

Codecov Report

Merging #236 (d056782) into master (eb4ba35) will increase coverage by 0.04%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #236      +/-   ##
==========================================
+ Coverage   80.27%   80.32%   +0.04%     
==========================================
  Files          11       11              
  Lines         862      864       +2     
  Branches      189      189              
==========================================
+ Hits          692      694       +2     
  Misses        138      138              
  Partials       32       32              
Impacted Files Coverage Δ
kmapper/plotlyviz.py 48.17% <48.17%> (ø)
kmapper/cover.py 88.54% <100.00%> (+0.12%) ⬆️
kmapper/visuals.py 85.58% <100.00%> (+0.06%) ⬆️

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 eb4ba35...d056782. Read the comment docs.

@deargle
Copy link
Collaborator

deargle commented Oct 7, 2021 via email

@deargle deargle changed the title Fix tests Fix divide-by-zero, deprecation, and futurewarnings Oct 8, 2021
@deargle
Copy link
Collaborator

deargle commented Oct 8, 2021

Cool, thanks. I wonder why plotlyviz had not-unix line endings...

Can you make any future PRs off of not-master branches? It's okay for this one.

@deargle deargle merged commit 2a17839 into scikit-tda:master Oct 8, 2021
@erooke erooke deleted the fix_tests branch October 8, 2021 21:50
@erooke
Copy link
Contributor Author

erooke commented Oct 8, 2021

Can you make any future PRs off of not-master branches? It's okay for this one.

Sure, is there a particular branch you would like me to use?

@deargle
Copy link
Collaborator

deargle commented Oct 8, 2021

Oh, you know what, I totally misread it. I thought this was coming from your fork's master branch. Long day, sorry. PRs against this repo's master is preferred, as you've been doing.

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.

2 participants