478
top 23 comments
sorted by: hot top controversial new old
[-] sukhmel@programming.dev 73 points 10 months ago

And if you want to increase accuracy you just add more tests

[-] bonuspoints@lemmynsfw.com 13 points 10 months ago

The failures are probably just flake then

[-] nxdefiant@startrek.website 10 points 10 months ago

"prime on my machine"

[-] corship@feddit.de 71 points 10 months ago

I wrote an ai that classifies spam emails with 99.9% accuracy.

Our test set contained 1000 emails, 999 aren't spam.

The algorithm:

[-] gandalf_der_12te@feddit.de 2 points 10 months ago

Honestly I'd rather have that, than randomly have to miss some important E-mail because the system put it in the junk folder.

[-] notabot@lemm.ee 60 points 10 months ago

All odd numbers are prime: 1 is prime, 3 is prime, 5 is prime, 7 is prime, 9 is experimental error, 11 is prime, and so on, I don't have funding to check all of them, but it suggests an avenue of productive further work.

[-] randy@lemmy.ca 10 points 10 months ago
[-] notabot@lemm.ee 6 points 10 months ago

Look, just because it breaks everything, that's no reason not to include it in a joke. We'll just have to rebuild the entire edifice of mathematics.

Seriously, thanks for the link, I hadn't considered the implications of including 1 in the set of primes, and it really does seem to break a lot of ideas.

[-] A_Very_Big_Fan@lemmy.world 23 points 10 months ago

It's been a fat minute since I last did any programming outside of batch scripts and AHK... I'm struggling to understand how it's not returning false for 100% of the tests

[-] RAM@discuss.tchncs.de 49 points 10 months ago* (last edited 10 months ago)

It is always returning false, but the screen shows a test, where a non-prime evaluating as false is a pass and a prime evaluating as false is a fail :))

[-] troublehelix@feddit.nu 26 points 10 months ago

The output shown is the result of a test for the function, not the result of the function itself.

[-] A_Very_Big_Fan@lemmy.world 11 points 10 months ago

Ooooh I see lol. Thank you!

[-] JackGreenEarth@lemm.ee 14 points 10 months ago

It's returning false for all the tests, but it only should be returning false for 95% of them, as 5% are prime.

[-] idunnololz@lemmy.world 15 points 10 months ago* (last edited 10 months ago)

How many primes are there before 1 and 2^31. IIRC prime numbers get more and more rare as the number increases. I wouldn't be surprised if this would pass 99% of tests if tested with all positive 32 bit integers.

[-] kogasa@programming.dev 14 points 10 months ago

Per the prime number theorem, for large enough N the proportion of primes less than or equal to N is approximately 1/log(N). For N = 2^(31) that's ~0.0465. To get under 1% you'd need N ~ 2^(145).

[-] sukhmel@programming.dev 4 points 10 months ago

So you better use 128-bit unsigned integers ๐Ÿ˜…

[-] idunnololz@lemmy.world 7 points 10 months ago

Wolfram alpha says it's about 4.9%. So 4.9% of numbers in the range 1 to 2^31 are prime. It's more than I expected.

[-] dbx12@programming.dev 14 points 10 months ago* (last edited 10 months ago)

It even passes over 100% of tests!

Edit: I can't read floats.

[-] Daxtron2@startrek.website 13 points 10 months ago

have y'all never seen a float before

[-] MxM111@kbin.social 10 points 10 months ago

The last line reads 95.121 %. I was confused too that it is 121%, but, sadly, no.

[-] xthexder@l.sw0.com 11 points 10 months ago* (last edited 10 months ago)

Ah yes, my favorite recurring lemmy post! It even has the same incorrect test output.

Last time I saw this I did a few calculations based on comments people made:
https://l.sw0.com/comment/32691 (when are we going to be able to link to comments across instances?)

  • There are 9592 prime numbers less than 100,000. Assuming the test suite only tests numbers 1-99999, the accuracy should actually be only 90.408%, not 95.121%
  • The 1 trillionth prime number is 29,996,224,275,833. This would mean even the first 29 trillion primes would only get you to 96.667% accuracy.

In response to the question of how long it would take to round up to 100%:

  • The density of primes can be approximated using the Prime Number Theorem: 1/ln(x). Solving 99.9995 = 100 - 100 / ln(x) for x gives e^200000 or 7.88 ร— 10^86858. In other words, the universe will end before any current computer could check that many numbers.
[-] sukhmel@programming.dev 1 points 10 months ago

But you can use randomised test-cases. Better yet, you can randomise values in test-cases once ~~and throw away the ones you don't like~~ and get arbitrarily close to 100% with a reasonable amount of tests

[-] corsicanguppy@lemmy.ca 5 points 10 months ago

why would you store comments in git?

Oh. Oh ha ha ha ha you just don't know 'checkout' from 'check out'. Clean out your desk.

this post was submitted on 22 Jan 2024
478 points (98.6% liked)

Science Memes

11189 readers
3077 users here now

Welcome to c/science_memes @ Mander.xyz!

A place for majestic STEMLORD peacocking, as well as memes about the realities of working in a lab.



Rules

  1. Don't throw mud. Behave like an intellectual and remember the human.
  2. Keep it rooted (on topic).
  3. No spam.
  4. Infographics welcome, get schooled.

This is a science community. We use the Dawkins definition of meme.



Research Committee

Other Mander Communities

Science and Research

Biology and Life Sciences

Physical Sciences

Humanities and Social Sciences

Practical and Applied Sciences

Memes

Miscellaneous

founded 2 years ago
MODERATORS