Python throw-back: making mazes again

I had an escapist hobby that is captured in the history of this blog, making maze [link], and I need escape again. And now I have a 5-year-old User for the output! Cool things: the maze-making code from 7 years ago was pretty easy to get working again [links, links]; the scientific python ecosystem now has notebooks! [link]

[Photo of done mazes on paper.]

Comments Off on Python throw-back: making mazes again

Filed under combinatorial optimization

Life Expectancy and Cause-Specific Mortality by Census Tract in King County, Washington

Some new research that I’m excited about came out last week: Variation in life expectancy and mortality by cause among neighborhoods in King County, WA, USA, 1990–2014: a census tract-level analysis for the Global Burden of Disease Study 2015. http://www.thelancet.com/journals/lanpub/article/PIIS2468-2667(17)30165-2/fulltext

In some ways, it is very specific to Seattle and the surrounding county: https://vizhub.healthdata.org/subnational/usa/wa/king-county

But it is also a demonstration of the “fractal” nature of population health—the variation between life expectancy from country to country around the world is big! But it is around as big as the variation between life expectancy from county to county around the United States. And what this work shows is that even in the county where I live, the life expectancy varies between census tracts almost as much as from county to county or country to country. Inequality is happening at all scales.

Here is the data: http://ghdx.healthdata.org/record/united-states-king-county-washington-life-expectancy-and-cause-specific-mortality-census

Comments Off on Life Expectancy and Cause-Specific Mortality by Census Tract in King County, Washington

Filed under disease modeling

Links about brainstorming

https://betterhumans.coach.me/a-beautiful-observation-about-the-start-of-twitter-67ad066c0d3a
https://betterhumans.coach.me/how-to-get-promoted-based-on-merit-rather-than-hubris-e22ccca7b20a
http://www.betterevaluation.org/evaluation-options/roundrobin
https://betterhumans.coach.me/round-robin-a-dead-simple-management-skill-that-works-6ec3df250326
https://betterhumans.coach.me/a-meetings-manifesto-5a8caf6281b
http://www.internetincomecoach.com/meeting-mastery-book-review/
https://betterhumans.coach.me/rule-of-three-bad-ideas-arguments-and-brainstorming-ac0d06fbd4ee
https://betterhumans.coach.me/round-robin-a-dead-simple-management-skill-that-works-6ec3df250326

not necess related: https://hbr.org/2013/08/why-do-so-many-incompetent-men

Comments Off on Links about brainstorming

Filed under working

Half-birthday for Diversity Club

For the last six months I’ve made brief mentions of the happenings of IHME “Diversity Club” on Healthy Algorithms. What is it?

I’m not sure if I mentioned, but I’m a co-chair of the Department of Global Health Diversity Committee, and we had a strategic retreat in December, where we identified “Training (Stand-alone and in curriculum)” as one of our top three priorities. We had a good brainstorm on ways to advance this priority, and an idea that stuck with me from it was “Different types of workshops, trainings, dialogues (format and topic – individual, structural, policy)”

Diversity Club is a different type of workshop. It has low-overhead. It is regularly recurring. And it has drawn a range of interest, depending on the time of year, the topic, and the competing priorities around IHME.

You can see some of the things we’ve discussed tagged diversity club on HA https://healthyalgorithms.com/tag/diversity-club/

Looking back on them, discussing The Invisible Knapsack was the one I was most nervous about https://healthyalgorithms.com/2017/04/10/diversity-club-the-invisible-knapsack/ it went fine.

Counter-measures for implicit bias left me the most optimistic about the possibility of positive change https://healthyalgorithms.com/2017/02/24/journal-club-counter-measures-for-implicit-bias/

I’ll report back again at a year.

Comments Off on Half-birthday for Diversity Club

Filed under Uncategorized

Visual Communication in Python: Pie Charts with Matplotlib

A personal story about how I started using Python for my research: when I was a post-doc at Microsoft, I was embarrassed to ask them to buy me Matlab. But I knew how to plot things in Matlab and I didn’t have time to learn how to make a graphic look nice with Excel or whatever the preferred Microsoft tool was at the time. Matplotlib to the rescue. It was free, it looked *better* than Matlab, and then it was done.

As readers of this blog may know, I have come to use Python extensive in my research by now. But one thing that I have not changed in the 10 years since that post-doc experience is using matplotlib like it was Matlab. It might be time to change.

I recently read a short blog on the modern approach to using Matplotlib, http://pbpython.com/effective-matplotlib.html, and it seems worth a try. Do you remember a talk on data visualization I gave last fall? https://github.com/aflaxman/iths-communicating-results-visually-2

I’m going to try remaking the plots I spoke on with my old school mpl and the modern approach. Here is the first, a pie chart.

My old-fashioned way is in a notebook from my talk, and looks like this:

plt.figure(figsize=(9,8))
plt.subplots_adjust(hspace=.3, right=.8, left=.1)
plt.pie([2,98], labels=['Survived\n2%', 'Died\n98%'], colors=colors, startangle=0)

The new way is built up in this notebook here, and ends up being comparable:

fig, ax = plt.subplots(figsize=(9,8))
s.plot(kind='pie', colors=colors, startangle=0)
fig.subplots_adjust(hspace=.3, right=.8, left=.1)
ax.set_ylabel('')

Is that cooler? I’m not convinced, but I’ll keep trying.

Comments Off on Visual Communication in Python: Pie Charts with Matplotlib

Filed under dataviz

To read: Building Sustainable Financing Structures for Population Health: Insights from Non-Health Sectors

https://www.nap.edu/catalog/24760/building-sustainable-financing-structures-for-population-health-insights-from-non

Comments Off on To read: Building Sustainable Financing Structures for Population Health: Insights from Non-Health Sectors

Filed under Uncategorized

Righter signatures in Jupyter

Did you know you can change the signature of functions dynamically in Python 3? It is a bit nasty, and maybe will make things look nicer for vivarium users.

Attempt: https://github.com/ihmeuw/vivarium/pull/2
Docs: https://docs.python.org/3/library/inspect.html#inspect.Signature
SO question that got me started: https://stackoverflow.com/a/33112180/1935494

Comments Off on Righter signatures in Jupyter

Filed under Uncategorized

Introducing Vivarium

I’ve had a new line of research developing for the last 18 months or so—*microsimulation*. It started when I stepped in to help with the “Cost Effectiveness Analysis with Microsimulation” (or CEAM) project at IHME. Now it is growing and growing to take over all of my research and recreation time. Is that bad or good?

Some of this work has now seen daylight from our presentations at SummerSim and iHEA in July, and today I am please to introduce a python package that you can use, too.

The programmers I’ve been working with on this convinced me that it is not just for cost effectiveness analysis and we need a more expansive name for it. So I present to you: vivarium. https://github.com/ihmeuw/vivarium

2 Comments

Filed under Uncategorized

MAL-ED study

I needed to get up to speed on this large data collection effort, so I thought I’d collect what I found here, for my own reference and in case it was of interest to others.

> The purpose of this study was to collect longitudinal data on the relationships between malnutrition and enteric infections in children ages 17 days through approximately 2 years.
>
> The data were collected through in-person interviews in the home, anthropometry, cognitive exams, and biological samples. The samples collected included blood, urine, and stool. The households were visited twice weekly for interviews and stool samples. Anthropometric measurements were gathered at monthly intervals. Blood samples were taken at 7 and 15 months of age to assess micronutrient levels and vaccination status. Children underwent the lactulose-mannitol urine test for gut function at 3, 6, 9, 15, and 24 months.
>
> The study was conducted in subnational areas of Bangladesh, Brazil, India, Peru, Pakistan, Nepal, South Africa, and Tanzania. Each site had a sample size of approximately 200 children.

(n = 2,053)

http://ghdx.healthdata.org/search/site/mal-ed

http://ghdx.healthdata.org/series/etiology-risk-factors-and-interactions-enteric-infections-and-malnutrition-and-consequences

http://mal-ed.fnih.org/

https://jhpn.biomedcentral.com/articles/10.1186/s41043-015-0004-2

Click to access f8554f0636113e42f6d34f82347e015381d2.pdf

Comments Off on MAL-ED study

Filed under Uncategorized

I have used IPython Notebooks for my lab book for 5 years

And it is still working well. Here is what I did in my first one:

You think that is mixed yet?

Comments Off on I have used IPython Notebooks for my lab book for 5 years

Filed under Uncategorized