This is how AI accuracy is also measured.
That’s why you gotta use more metrics like recall and precision
We could probably improve on that significantly without losing speed.
return $x < 8That should yield one additional correct answer, while also confusing anyone who thinks it just returns false.
And if we just hard coded and checked the first 20 or so primes before always returning false, we would probably get noticeable improvement (depending on the total range).
I’ve seen so many game jam entries where the code is like this. Delicately balanced and using so many assumptions to just get the thing out the door.
It’s funny when they decide to make a full game out of it and realize that it’s gonna take them 6 months just to undo the tech debt of the original “demo”
Just put “Precondition: x must not be prime” in the function doc and it’ll be 100% accurate. Not my fault if you use it wrong.
95.121% of the time it works everytime.
A similar experiment I did comes to mind from 3 years ago.
For the fun of it I was trying to train a few deep neural network configurations (LSTM, a few variations of FCNs, …) to trade shitcoins and downloaded 4 years of 1h candles.
The first easiest idea was to prepare the training data to fire three signals, buy, sell, do nothing (I know a terrible choice). The cost function was setup to do the simple thing and maximize the overall profit (I know an other terrible choice). Fast forward 30min of training and the final outcome is a model that outputs “do nothing” in 100% of the cases.
Diamond Hands in action. Buy and hold is not as profitable as simply never buying and just holding.
Fast forward 30min of training and the final outcome is a model that outputs “do nothing” in 100% of the cases.
To be fair, your program demonstrated the most reliable way to win at crypto! 😉
I am screenshoting this so it will be screenshot of a screenshot of a screenshot then post it somewhere else
Not even adding some watermark? smh
ifunny
You could simplify it even further by removing the int x parameter of the function…
Even better, do the work at compile time to respect the customers resources:
const bool isPrime = falseSo elegant! This is too valuable for GitHub, sell this directly to the Saudi government.
It approaches 100% accuracy
Warning: unused variable
Just add it to the pile I guess
I’m confused, shouldn’t this be printing false no matter what the input is?
that’s the joke, since most numbers aren’t prime, this algorithm is technically highly accurate despite being completely useless.
The output is not the output of the algorithm, it’s the output of the unit test.
95% of numbers up to that point at not prime. Testing the algorithm that only says “not prime” is therefore correct 95% of the time. The joke is that, similar to AI, the algorithm is being presented as a useful tool because it’s correct often but not always.
The test suite probably looks something like this:
int tests_passed=0; int tests_failed=0; for(int i=0;i<100000;i++){ printf("test no. %d: ", i); if(is_prime(i)==actually_is_prime(i)){ printf("passed\n"); tests_passed++; }else{ printf("failed\n"); tests_failed++; } } //...Ah that makes more sense thanks. So the bottom one is a unit test and not the code being run itself
You kind of suck at logic…
You sound like my mom!
…95.121%
???It’s a decimal point, not thousands
I said something similar here about an election fraud detection system with 99.999% accuracy.
Is this not at all stochastic, or do I just not know what stochastic means?
maybe it would be better to say that it is stochastically accurate?
I’ve had managers who follow that exact algorithm.
But when the input is all prime numbers then the accuracy is 0.

also btw icymi, this is a post about LLMs
True











