Repository navigation
MAINT: Handle overflow in i0 for large inputs like 713.0 - #32223
Conversation
Using math log this overflow problem is solved issue numpy#32209
|
For the second time you ignored the AI disclosure. You're risking a ban. |
|
Hi @jorenham, I apologize for not filling in the AI Disclosure properly. AI Disclosure: No AI tools were used. I wrote all the code and math myself based on my understanding of:
I can explain the mathematical reasoning: Please let me know if you need any clarification on the implementation. Thank you! |
|
You did not fill in the AI disclosure in the PR, so I assumed this was a fully automated AI PR, of which we get quite a lot recently. So since you seem to be a human and even know what you're talking about, I'll re-open this. In the future, be sure to state that you did or did not use AI in the AI disclosure in the PR template, as explained in our AI policy |
added case for np.inf in piecewise call Co-authored-by: Nathan Goldbaum <[email protected]>
Co-authored-by: Nathan Goldbaum <[email protected]>
hariomlohardev
left a comment
There was a problem hiding this comment.
Looks good
Co-authored-by: Nathan Goldbaum <[email protected]>
Add test for i0 function to handle infinity correctly.
hariomlohardev
left a comment
There was a problem hiding this comment.
looks good
hariomlohardev
left a comment
There was a problem hiding this comment.
looks good to me
hariomlohardev
left a comment
There was a problem hiding this comment.
looks good and all done
|
Looking good. I’d like someone besides me to look at this. I think it needs a release note too. |
|
when this will merge |
|
It could be a while, it depends on how long it takes for other reviewers to weigh in. NumPy doesn’t move very quickly. |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
|
@hariomlohardev please be patient. Spamming us won't help. |
Thanks for the heads up, and sorry — I didn't mean to spam. My intent was just to let people on the related open issues know this fix is in progress so they're not duplicating effort, but I get how it can come across as pushy. I'll be more mindful about it going forward. Appreciate your patience! |
|
We talked about this at a triage meeting and agreed this is fine to change. Can you add a release note? See |
|
DONE SIR (❁´◡`❁) |
…that exist About now says what the days actually go into — mathematics from axioms, derivatives by hand, a Value graph with backprop and gradient descent in NumPy before any framework — and points at micrograd_hk as the shipped proof. Django/FastAPI/LangChain/RAG leave About; they stay in Contact, where hiring people read, and as trailing keywords in the meta. Work: spam_classifier, practice_code and pkg_jupy out, micrograd_hk, peek and inkdown in. Edited in data.json, which is the file the homepage actually renders (it overrides DEFAULT_DATA per key) — the DEFAULT_DATA fallback in index.html now matches it, statuses included. The /projects archive is generated from projects-data.json and is untouched, so the live spam_classifier demo still works. Open source: the fallback list no longer invents PRs. If the live fetch fails, the four /000000 placeholder links are gone and what shows is three real contributions — numpy/numpy#32223, static-analysis#1866, reflex#6861. Portrait: was hotlinked from image.qwenlm.ai at 1.2 MB. Now repo-hosted, 30 KB webp with a 67 KB jpg fallback, 900x900, on both home and /about. FAQ: 4 questions to 7 — why self-taught, the 18-month route, how to follow along — and the FAQPage markup rebuilt to mirror all seven exactly, so the rich result stays valid. Head: title, description, og and twitter cards lead with AGI from first principles; Person JSON-LD points its image at the portrait instead of a certificate scan and gains the from-scratch topics. /about carries the same Person object so the two pages stop contradicting each other.
…that exist About now says what the days actually go into — mathematics from axioms, derivatives by hand, a Value graph with backprop and gradient descent in NumPy before any framework — and points at micrograd_hk as the shipped proof. Django/FastAPI/LangChain/RAG leave About; they stay in Contact, where hiring people read, and as trailing keywords in the meta. Work: spam_classifier, practice_code and pkg_jupy out, micrograd_hk, peek and inkdown in. Edited in data.json, which is the file the homepage actually renders (it overrides DEFAULT_DATA per key) — the DEFAULT_DATA fallback in index.html now matches it, statuses included. The /projects archive is generated from projects-data.json and is untouched, so the live spam_classifier demo still works. Open source: the fallback list no longer invents PRs. If the live fetch fails, the four /000000 placeholder links are gone and what shows is three real contributions — numpy/numpy#32223, static-analysis#1866, reflex#6861. Portrait: was hotlinked from image.qwenlm.ai at 1.2 MB. Now repo-hosted, 30 KB webp with a 67 KB jpg fallback, 900x900, on both home and /about. FAQ: 4 questions to 7 — why self-taught, the 18-month route, how to follow along — and the FAQPage markup rebuilt to mirror all seven exactly, so the rich result stays valid. Head: title, description, og and twitter cards lead with AGI from first principles; Person JSON-LD points its image at the portrait instead of a certificate scan and gains the from-scratch topics. /about carries the same Person object so the two pages stop contradicting each other.
Using math log this overflow problem is solved
issue #32209
PR summary
This is the fix to an overflow issuse
np.i0(713.0) returns inf instead of a finite value
changed to this
this is in file : lib_function_base_impl.py
THE MATH
using logs we can control the overflow of exp so that it will return and finite value and not inf
new math formula for function is
exp(x + log(val) - 0.5 * log(x))
First time committer introduction
Hi I'm Hariom Lohar (@hariomlohardev). I'm a Python developer interested in AI/AGI and right knwo learning basics in neural network and probability and statistics
I found this issue through exploring NumPy's codebase and noticed the i0() Bessel function had a numerical stability problem with large inputs. Since I have a math background and experience with numerical methods, I decided to fix it.
AI Disclosure