57 points · by bencollier49 · 6y ago · 74 comments
I like the way InitModel() crashes (I think) if a global pointer called bmh (short for bitmap header) isn't first initialized by calling InitBMHead() from Bitmap.cpp. I guess it's obvious to academics with giant brains that InitModel() depends on a bitmap existing.
But it gets worse - the pointer is declared in CovidSim.cpp but Bitmap.cpp reaches across the module boundary to initialize it. Sweet.
Edit: I feel bad now. It's great that this code was made public. I should be encouraging that. I think academics writing code for things like this should probably take an undergrad course on software engineering. I think the one that taught me about Abstract Data Types would be most beneficial the author(s) of this code.
(In the end the crash was due to corrupted input data, so I fixed the data and stopped debugging)
the crash was due to corrupted input data
Bad data shouldn't cause a crash. That's just sloppy.Then, you end up having to turn this 'style' of code into a product and to maintain it...
Given your concerns, I would like to mention two things:
1) the code was originally a single source file, so I'm not surprised the module boundaries are imperfect - the code is many years old and the module boundaries have existed for only a few weeks.
2) this was not written by professional software engineers, but epidemiologists, and they were working with limited budget, time, and programming experience.
If the original code was a single file and you’ve ‘fixed bugs’ then what is on GitHub can in NO way be ‘largely what was written’
This code was used to lockdown an entire country - defending the code now based on who it was written by and under what constraints is disingenuous. It must have been known that there were these issues and they ought to have been fixed before using the output for something that had such huge societal impact.
It's like saying that programmers are professional English writers, so comments and such should be written in perfect English.
IMHO the only valid criticism is if the the simulation modelling is sound and implemented accurately.
The original code as used to produce simulation results that were in turn used for reports/papers/policy should be made public.
Some code I've used from scientific papers in the past made a git tag at the time of publication, and said "Use version XXXX and the provided sample data to get the results in the paper", or something of the sort. This could allow review and improvements post-publication.
Edit: Oh this is very old code, that could be an excuse.
It's nice they aired their source code out for people to look at, least we can do is to critique without snark.
There's also a (flagged) submission on HN discussing this[3] referencing [1].
[1] (warning: possibly partisan link) https://lockdownsceptics.org/code-review-of-fergusons-model/
Wow, next they'll review one doctors handwriting and conclude that hospitals should be defunded, with their job handled by horse doctors...
Non-intended randomness is of course bad, but it's bad mainly because it makes it harder to track down causes of actually important problems with the produced distributions.
The worst problem this all out murder attempt can muster is that the code is hard to debug which frankly is should be the default assumption for all research code, not too persuasive. Models are after all just tools: what is critical is that you've made reliable predictions, not that the tools themselves are easy to use correctly.
A more interesting critique would be something along the lines of this: https://www.nicholaslewis.org/imperial-college-uk-covid-19-n... (however it's not by a subject matter expert so the problems they find might well be because the misunderstood some detail).
Of course, this kind of uncertainty needs to be dealt with, and that may have been done by running the simulation code we are presented with multiple times. It may be necessary to read both the code and the associated papers to judge this correctly.
Reliable and reproducible. I think this discussion, even if the code ends up being correct and the model OK, is worth having. It might not change anything today, but could set new (hopefully better!) standards tomorrow.
That said, that "personal level" statement is absolutely out of the line.
Carmack is OK with it, he's put his name to reviewing it. That's not to excuse the bad testing, but he hasn't thrown his hands up and run away. He worked with them constructively to make it possible for us to even see it! Be more like Carmack.
EDIT: Also be like this person: https://github.com/mrc-ide/covid-sim/issues/161 Helpful, constructive and the developers engaged with them.
Most HN users are just publicly preening. It's like a Mechanical Turk GPT2. I actually doubt they can write code.
Go click around GitHub. They screwed up a shuffle, there are uninitialised reads, RNG bugs, the works.
https://github.com/mrc-ide/covid-sim/blob/master/src/CovidSi...
That stuff is priceless:
else if (argv[i][1] == 'C' && argv[i][2] == 'L' && argv[i][3] == 'P' && argv[i][4] == '1' && argv[i][5] == ':')
I guess string comparisons are complicated. I also fail to see why they used ':' as the separator and why they didn't use a proper library to parse argv...
Perhaps the real reason is the code typically smells of Swiss cheese.
From now on I vow to trust NO academic results of computer models unless source code is published along with instructions on how to reproduce outputs (or at least similar output!)
I bet the quality of local administration would go through the roof if all mayoral candidates were forced to be proficient at SimCity.
Given the complexity, poor language/framework choice (should have used either Rust or Tensorflow), bad code design, and unclear determination of the parameters (especially the fact they don't seem to be estimated from real data with Bayesian inference, or if they are they didn't release that), as well as the ludicrous CPU and RAM usage making it impossible for most people to run it and thus check it, it doesn't seem like it has any chance of actually being a good model.
If this is the state of the art for the most important statistical modelling project in the world, we are in the dark ages.
[1].https://www.express.co.uk/comment/columnists/frederick-forsy...
https://www.theguardian.com/world/2005/sep/30/birdflu.jamess...
He said that if it was the same as the 1918 flu, you could probably scale it up to 200M people. He didn't predict 200M, he speculated that it could be that bad.
And he wasn't alone - "A global influenza pandemic is imminent and will kill up to 150 million people" said "David Nabarro, one of the most senior public health experts at the World Health Organisation"
"A Department of Health contingency plan states anywhere that there could be between 21,500 and 709,000 deaths in Britain."
An unnamed WHO spokeswoman said "best case scenario" would be 7.4 million deaths globally.
https://www.newscientist.com/article/dn7787-flu-pandemic-let...
"And yet, the models show, if targeted action is taken within a critical three-week window, an outbreak could be limited to fewer than 100 individuals within two months."
Oh, he also showed how to react and keep the number of casualties to a minimum.
Don't believe what you read in dirt rags.