Showing posts with label science. Show all posts
Showing posts with label science. Show all posts
Monday, January 2, 2012
New Scientific Programming Blog
This is my personal blog where I post on a wide range of topics. I've decided to make a second blog devoted specifically to the concept of scientific programming. You can find it at http://www.sciprogblog.com. I'll be posting various tips and tricks for scientists and other professionals who haven't been formally trained as programmers but find themselves programming out of necessity and want to learn more.
Thursday, September 15, 2011
Open data needs to be accessible
I'm trying to acquire two very different datasets in completely different fields right now: infectious disease incidence data from the CDC Morbidity and Mortality World Report, and CMIP5 global climate models. They both illustrate a simple truth: making data public is just the first step. If no one can access it in a reasonable way, it's essentially just as closed as if you were to not provide any kind of access.
I've started writing an automated tool to do this for me using spynner, an automatic browsing module for Python that understands JavaScript. The tools is about 500 lines of code so far and climbing. The process is like this: log in to the website, click on a model, wait ~10 seconds for the JavaScript to run, check which experiments are available on the page, open a new copy of the browser window (so I don't have to retrace my steps after each download), click the first experiment, wait 10 seconds... To give you an idea of how obnoxious this is, for their research, the Utah Climate Center wants data from: 18 models, 54 experiments, 6 frequencies, 4 realms, and 31 variables. This amounts to many terabytes of actual data, and many, many iterations of "click a link and wait ~10 seconds." Once this tool is finished, it will need to run on a server for hours, probably days, to download everything.
The Morbidity and Mortality World Report (MMWR) is available from the CDC's website via a web interface: choose a year (1996-2011) and week number (1-53) from lists, press submit, choose a table number (there are 10-12 tables per week per year), press submit, and you're presented with an HTML table containing data for a subset of the notifiable diseases. Okay, CDC, now suppose I'm interested in large scale patterns: I want to download data for all diseases for a five year period. This is going to involve hitting "submit" 6,360 times (5 * 53 * 12 * 2). Sure, I could write a script to do it automatically, but the output is a bunch of HTML tables, each of which has a slightly different format making it difficult to "scrape" out the data.
(After toying with the idea of trying to build a scraper, I made contact with the CDC back in June to try to acquire the raw data behind the online tables. I thought this would be faster. I was mistaken. I've had a few responses, but I'm still waiting for the actual data.)
But, believe it or not, the CMIP5 data is far worse. CMIP5 stands for Coupled Model Intercomparison Project - intercomparison! To me, the word "intercomparison" suggests that data for multiple models should be easy to download simultaneously. Not so. Again, a web interface stands in your way, only this time it uses asynchronous JavaScript to build each page so you can't just go to a specific URL to get your data. You have to narrow things down by clicking on a Model, then an Experiment, then a Frequency (monthly, yearly, etc.), then a Realm (land, atmosphere, ocean), and finally a variable. At this point a list of models will be provided, with only ten results per page. You have to check a box for each dataset you want (at this point I typically want all of them), press "download all," download the WGET script they provide (seriously?) and run it.
I've started writing an automated tool to do this for me using spynner, an automatic browsing module for Python that understands JavaScript. The tools is about 500 lines of code so far and climbing. The process is like this: log in to the website, click on a model, wait ~10 seconds for the JavaScript to run, check which experiments are available on the page, open a new copy of the browser window (so I don't have to retrace my steps after each download), click the first experiment, wait 10 seconds... To give you an idea of how obnoxious this is, for their research, the Utah Climate Center wants data from: 18 models, 54 experiments, 6 frequencies, 4 realms, and 31 variables. This amounts to many terabytes of actual data, and many, many iterations of "click a link and wait ~10 seconds." Once this tool is finished, it will need to run on a server for hours, probably days, to download everything.
It's great that we've seen such an explosion of publicly available data, but one of the key words there is available. For some very important datasets, in terms of availability, we still have a long way to go.
Saturday, June 25, 2011
Americans don't trust experts
Here in America we only accept people as experts if they agree with us. And when we're easily convinced that someone is an "expert" who says things that coincide with our preconceptions, we open ourselves up to easy manipulation in the "wars of the experts" that play out in the media every day on a wide range of topics.
I've taken a lot of coursework in biology, particularly focusing on ecology. While ecology often presupposes the veracity of the climate change hypothesis, I am by no means an "expert" on climate change - the closest I come is having taken a year of general chemistry. I happen to accept the consensus that human activities are contributing to it. I've never done any research in climatology, so my task becomes to weigh the evidence and the various claims made to explain it, and determine who has the most compelling view. A little research shows an overwhelming international consensus by scientific organizations. It seems highly unreasonable to disagree with such a vast group of concurring professionals, especially since I don't claim access to some secret evidence that can disprove their claims. I really don't know anything about the models they use to predict climate change. But they're the ones doing the research, and I do trust that the checks and balances inherent refereed journal publication will weed out hypotheses that cannot be supported.
Many people find it difficult to reach the same conclusion, however, because there are "experts" on both sides. A little more searching reveals over 31,000 (over 9,000 PhD-holding) scientists who have signed a petition asserting that "there is no convincing scientific evidence" (I guess it depends on how you define "convincing") and even that "increases in atmospheric carbon dioxide produce many beneficial effects upon the natural plant and animal environments of the Earth." Many (over 40%!) of these "scientists" have only a Bachelor's degree; some have degrees in areas such as economics, some are medical doctors who treat patients and do not conduct scientific research on any topic, others are physicists who do not devote a significant part of their time to studying climate specifically but claim knowledge of "fundamental physical and molecular properties of gases, liquids, and solids." While the total number of signatories seems impressive, when you look more closely at its makeup the group hardly seem qualified to provide an opinion on this issue. In fact, only 39 (0.1% of all signers) identify themselves primarily as climatologists; to contrast, 9.7% of signers are medical doctors and a whopping 32% are engineers. Experts to be sure, but not experts on climate science.
Climate change, vaccination-induced autism, evolution, whether or not HIV causes AIDS, the effectiveness of unproven alternative medicine techniques that are taught without criticism...all debates in which people hold strong emotional attachments to their own viewpoints, and in which there are seeming "experts" arguing for the dissenting opinion. The average person is not trained to discern credibility in scientific claims and may just go with their feelings or make a decision for social, religious, political, or economic reasons. The media, by providing equal time to "both sides of the issue," tends to exacerbate the problem by creating the appearance of balance, when in reality only one side of the debate can be considered credible. A logical approach shows no reason to believe that vaccines cause autism, and studies have thoroughly debunked this idea, yet often anecdotes and a poor understanding of statistics cause parents to trust any "expert" that suggests such a link.
We live in a democratic society; the general public, not scientists, dictate policy, which makes it important to communicate and foster both a better understanding of science and more trust in scientists as people who are genuinely committed to solving important problems and are here to help. It's dangerous when emotions trump evidence in deciding truth. The scientific community struggles to really convey the strength of its positions - and "scientists" who claim expertise in a field they are not directly involved in aren't helping scientific credibility in general.
It's also important that the public learn to accept their own lack of expertise and defer decisions requiring advanced knowledge to those who have devoted themselves to the study of the particular issue. As Americans, it seems that distrust of authority is in our blood. But if we continue to hold stubbornly to emotional arguments that can be refuted by logic, and refuse to listen to those who have real knowledge, we will not be equipped to make the progress we'll need to face the big challenges of today and the future.
I've taken a lot of coursework in biology, particularly focusing on ecology. While ecology often presupposes the veracity of the climate change hypothesis, I am by no means an "expert" on climate change - the closest I come is having taken a year of general chemistry. I happen to accept the consensus that human activities are contributing to it. I've never done any research in climatology, so my task becomes to weigh the evidence and the various claims made to explain it, and determine who has the most compelling view. A little research shows an overwhelming international consensus by scientific organizations. It seems highly unreasonable to disagree with such a vast group of concurring professionals, especially since I don't claim access to some secret evidence that can disprove their claims. I really don't know anything about the models they use to predict climate change. But they're the ones doing the research, and I do trust that the checks and balances inherent refereed journal publication will weed out hypotheses that cannot be supported.
Many people find it difficult to reach the same conclusion, however, because there are "experts" on both sides. A little more searching reveals over 31,000 (over 9,000 PhD-holding) scientists who have signed a petition asserting that "there is no convincing scientific evidence" (I guess it depends on how you define "convincing") and even that "increases in atmospheric carbon dioxide produce many beneficial effects upon the natural plant and animal environments of the Earth." Many (over 40%!) of these "scientists" have only a Bachelor's degree; some have degrees in areas such as economics, some are medical doctors who treat patients and do not conduct scientific research on any topic, others are physicists who do not devote a significant part of their time to studying climate specifically but claim knowledge of "fundamental physical and molecular properties of gases, liquids, and solids." While the total number of signatories seems impressive, when you look more closely at its makeup the group hardly seem qualified to provide an opinion on this issue. In fact, only 39 (0.1% of all signers) identify themselves primarily as climatologists; to contrast, 9.7% of signers are medical doctors and a whopping 32% are engineers. Experts to be sure, but not experts on climate science.
Climate change, vaccination-induced autism, evolution, whether or not HIV causes AIDS, the effectiveness of unproven alternative medicine techniques that are taught without criticism...all debates in which people hold strong emotional attachments to their own viewpoints, and in which there are seeming "experts" arguing for the dissenting opinion. The average person is not trained to discern credibility in scientific claims and may just go with their feelings or make a decision for social, religious, political, or economic reasons. The media, by providing equal time to "both sides of the issue," tends to exacerbate the problem by creating the appearance of balance, when in reality only one side of the debate can be considered credible. A logical approach shows no reason to believe that vaccines cause autism, and studies have thoroughly debunked this idea, yet often anecdotes and a poor understanding of statistics cause parents to trust any "expert" that suggests such a link.
We live in a democratic society; the general public, not scientists, dictate policy, which makes it important to communicate and foster both a better understanding of science and more trust in scientists as people who are genuinely committed to solving important problems and are here to help. It's dangerous when emotions trump evidence in deciding truth. The scientific community struggles to really convey the strength of its positions - and "scientists" who claim expertise in a field they are not directly involved in aren't helping scientific credibility in general.
It's also important that the public learn to accept their own lack of expertise and defer decisions requiring advanced knowledge to those who have devoted themselves to the study of the particular issue. As Americans, it seems that distrust of authority is in our blood. But if we continue to hold stubbornly to emotional arguments that can be refuted by logic, and refuse to listen to those who have real knowledge, we will not be equipped to make the progress we'll need to face the big challenges of today and the future.
Sunday, May 8, 2011
Science Denial
Vaccination, global warming...why do we have such a pervasive culture of distrusting scientists?
That's not to say that you should blindly accept anything. But when smart people who study something for a living all agree about something (say, that there's no link between autism and vaccination) and you can analyze the data yourself and it clearly points to the same conclusions (like a study of 537,000 Danish children that showed no difference in autism rates between vaccinated and unvaccinated children...) I just don't understand the arrogance it must take for someone to ignore that and think they somehow know better, based on the word of some politician or celebrity. We have outbreaks in Utah of both pertussis and measles because people think they know better than doctors and scientists.
I guess Galileo would argue that this isn't a new problem, though.
That's not to say that you should blindly accept anything. But when smart people who study something for a living all agree about something (say, that there's no link between autism and vaccination) and you can analyze the data yourself and it clearly points to the same conclusions (like a study of 537,000 Danish children that showed no difference in autism rates between vaccinated and unvaccinated children...) I just don't understand the arrogance it must take for someone to ignore that and think they somehow know better, based on the word of some politician or celebrity. We have outbreaks in Utah of both pertussis and measles because people think they know better than doctors and scientists.
I guess Galileo would argue that this isn't a new problem, though.
Tuesday, December 7, 2010
Science's Worst Nightmare
Science's worst nightmare: being regulated by Joe Citizen.
Watch this video by Republican House whip Eric Cantor, and tell me if you're as terrified for the future of science in America as I am.
Cantor is on a personal mission to eliminate "wasteful spending" in government. To that end, he's encouraging "citizen review" of government agencies - starting with the NSF. Specifically, funded research projects that Cantor doesn't agree are useful. Cantor names the "hard sciences" as a worthy recipient of funding - according to him, this means physics, chemistry, and medicine - only fields in which a Nobel prize could be earned. I guess everything from ecology to psychology, sociology, linguistics... are just wasteful spending. He also encourages vigilant citizens to turn in individual award numbers of awards he feels are wasteful, as if he's building a case against the NSF.
The reason this worries me is, frankly, that the American public shows itself time and time again to be, on average, quite stupid and ignorant. There's a reason that NSF panels of actual scientists decide on the merit of awards, not Joe Citizen. When you consider the fact that 50% of Americans don't believe in evolution or the big bang, 20% (one in five) don't believe that the earth orbits the sun, and 10% don't believe in continental drift (source), this is probably not the place for the unschooled masses to dictate policy. Your average citizen is not in a position to judge science based on its merits.
Can you just see it? "This research is about some kind of fish or something! What do I care about fish? This is a waste of my tax money!" Glenn Beck then picks up the fish research story - what an absurd example of government waste! Downvoted.
I think Biology, because of the political nature it has somehow acquired, is in serious jeopardy because of proposals like this. I also wonder where Cantor thinks Computer Science falls on the usefulness scale. In the video, he specifically derides a project involving the development of a computer program, and the way he says those words doesn't give me a lot of hope on that front either.
Coincidentally, I made a comment about this a month ago in regard to a vote taken about whether or not the public wanted a county library system in Cache County, Utah -
Watch this video by Republican House whip Eric Cantor, and tell me if you're as terrified for the future of science in America as I am.
Cantor is on a personal mission to eliminate "wasteful spending" in government. To that end, he's encouraging "citizen review" of government agencies - starting with the NSF. Specifically, funded research projects that Cantor doesn't agree are useful. Cantor names the "hard sciences" as a worthy recipient of funding - according to him, this means physics, chemistry, and medicine - only fields in which a Nobel prize could be earned. I guess everything from ecology to psychology, sociology, linguistics... are just wasteful spending. He also encourages vigilant citizens to turn in individual award numbers of awards he feels are wasteful, as if he's building a case against the NSF.
The reason this worries me is, frankly, that the American public shows itself time and time again to be, on average, quite stupid and ignorant. There's a reason that NSF panels of actual scientists decide on the merit of awards, not Joe Citizen. When you consider the fact that 50% of Americans don't believe in evolution or the big bang, 20% (one in five) don't believe that the earth orbits the sun, and 10% don't believe in continental drift (source), this is probably not the place for the unschooled masses to dictate policy. Your average citizen is not in a position to judge science based on its merits.
Can you just see it? "This research is about some kind of fish or something! What do I care about fish? This is a waste of my tax money!" Glenn Beck then picks up the fish research story - what an absurd example of government waste! Downvoted.
I think Biology, because of the political nature it has somehow acquired, is in serious jeopardy because of proposals like this. I also wonder where Cantor thinks Computer Science falls on the usefulness scale. In the video, he specifically derides a project involving the development of a computer program, and the way he says those words doesn't give me a lot of hope on that front either.
Coincidentally, I made a comment about this a month ago in regard to a vote taken about whether or not the public wanted a county library system in Cache County, Utah -
In a republic, the idea stands on its own merits, not based on what people think of it, and I'm very glad for that - I shudder to think what would happen if the general public voted every publicly funded project up or down. If the political situation in Utah is any indicator of the rest of the country, I'm sure research in "liberal" fields such as ecology would be one of the first things to go.Looks like I spoke too soon. It might be time to start looking at grad programs at Cambridge...
Sunday, November 28, 2010
Rethinking Math Education
I just watched Conrad Wolfram's (WolframAlpha) TED talk called "Teaching kids real math with computers" and thought he had some great ideas. Wolfram advocates teaching kids to solve math problems like they will in the real world, with computers, instead of stressing learning how to calculate by hand which in today's world is more or less useless.
The topic of math education reminds me of my own experience with public school math. In 3rd through 6th grade I was in a "gifted" program where, among other things, we were allowed to go at our own pace in math. The minimum amount of assignments that needed to be turned in a week was set, but you could complete as many as you wanted beyond that. As a result, I was working on the 6th grade math curriculum in 4th grade, and by 5th grade had finished it and worked through books on algebra, geometry, and trigonometry. In 6th grade, my teacher, having run out of books, assigned me and another student to build a scale model of the school - which was a little too much freedom for a couple of 6th graders, because we never actually got anything done that year.
After 6th grade, the system started to fail me. In 7th grade I easily tested into an "honors" math class, which consisted solely of arithmetic and some "pre-algebra." For the next several years I took pre-algebra (again - after moving and switching schools, this was once again the most advanced option), geometry, algebra, and pre-calculus, covering very little material beyond what I had taught myself in elementary school. In 12th grade I took AP Calculus, dropped the class halfway due to boredom and still managed to pass both parts of the AP test - because I understood the fundamentals, and didn't need to spend half a year drilling them.
The lack of advanced options for smart students, in my experience, turns them into slackers. There is absolutely no merit in doing three years' worth (or even a single year) of drills in "pre-algebra" once you grasp the concepts you're working with. It becomes grunt work, and this is why, until college, I viewed math as something that I was naturally good at but found dreadfully boring.
Anyway, I think that Wolfram's suggestions have a lot of potential for keeping advanced students more involved in learning about math. I liked the idea of being given free reign to solve a real problem - for example, "what type of car insurance should I buy?" This is a real world application of math that will stick with a student much longer than quadratic equation drills. Give the students some parameters (what type of car, mileage) and let them gather data and solve the problem on their own. I think this type of approach to education is needed to generate students that are computationally literate - which is more important in today's world than being able to crunch numbers by hand.
The topic of math education reminds me of my own experience with public school math. In 3rd through 6th grade I was in a "gifted" program where, among other things, we were allowed to go at our own pace in math. The minimum amount of assignments that needed to be turned in a week was set, but you could complete as many as you wanted beyond that. As a result, I was working on the 6th grade math curriculum in 4th grade, and by 5th grade had finished it and worked through books on algebra, geometry, and trigonometry. In 6th grade, my teacher, having run out of books, assigned me and another student to build a scale model of the school - which was a little too much freedom for a couple of 6th graders, because we never actually got anything done that year.
After 6th grade, the system started to fail me. In 7th grade I easily tested into an "honors" math class, which consisted solely of arithmetic and some "pre-algebra." For the next several years I took pre-algebra (again - after moving and switching schools, this was once again the most advanced option), geometry, algebra, and pre-calculus, covering very little material beyond what I had taught myself in elementary school. In 12th grade I took AP Calculus, dropped the class halfway due to boredom and still managed to pass both parts of the AP test - because I understood the fundamentals, and didn't need to spend half a year drilling them.
The lack of advanced options for smart students, in my experience, turns them into slackers. There is absolutely no merit in doing three years' worth (or even a single year) of drills in "pre-algebra" once you grasp the concepts you're working with. It becomes grunt work, and this is why, until college, I viewed math as something that I was naturally good at but found dreadfully boring.
Anyway, I think that Wolfram's suggestions have a lot of potential for keeping advanced students more involved in learning about math. I liked the idea of being given free reign to solve a real problem - for example, "what type of car insurance should I buy?" This is a real world application of math that will stick with a student much longer than quadratic equation drills. Give the students some parameters (what type of car, mileage) and let them gather data and solve the problem on their own. I think this type of approach to education is needed to generate students that are computationally literate - which is more important in today's world than being able to crunch numbers by hand.
Saturday, November 27, 2010
Eliminate the Computer Science major
I believe we should do away with Computer Science as a field of undergraduate study - at least, the way it's implemented right now.
It's a given that, generally, a Geology major is studying to be a geologist. Likewise, a Biology major is training to become a biologist, and an Art major will probably end up an artist of some kind.
Computer Science students, however, don't go to college to become computer scientists. They go to learn "programming."
Theoretical computer science involves complex math and theory that is useful and interesting and takes a sharp mind to fully comprehend; most undergrads don't care and increasingly are not being exposed to it. Instead, popular languages are being taught in undergraduate courses, with the intention of preparing students for future work (see Joel Spolsky's The Perils of JavaSchools for another take on this phenomenon.)
The sad thing is, having worked one-on-one with several recent Computer Science graduates, I don't believe that they're learning much about programming, either. Students with a passion for programming study it in their free time, work on their own projects, and do most of their learning outside of the classroom. Fresh graduates with a BS in Computer Science and no real experience programming just don't have the skills they need to do anything but grunt work. As an undergraduate Biology student, my first CS course was on bioinformatics algorithms and had several Masters students, and when I was able to implement the algorithms quicker and more efficiently than CS students, I saw how lacking my school's curriculum was.
Solutions thus far have been to dumb down the CS degree by using higher level ("easier") programming languages and teaching less theory and advanced math. I think that aiming to dumb down the curriculum in order to prepare students for a corporate programming career is killing off the pool of intelligent academic computer scientists. The solution? Accept that there's a difference and offer two distinct majors: Computer Science and Programming.
The immediate result would probably be a huge shift of students from CS to Programming. Maybe some CS departments would cease to exist due to lack of interest. Programming students would learn the basics they need to succeed in the corporate world (similar to some "Information Systems Management" programs, but with a more straightforward focus on the technical aspects of development.) But smart CS students wouldn't be hampered by the dumbing down of their programs of study. They'd be exposed to more current topics in research and have the opportunity to take more advanced courses. They'd be allowed to choose from emphasis areas more in line with the current directions of academia. The Computer Science department would be a fraction of its current size but the per capita ability and motivation would go up, and these students would go on to be the brilliant researchers of the future. Their peers in the Programming department could get the high-paying job at the corporation of their choice, or start their own companies.
Let's accept that there's a difference between the two types of student, and start treating them differently.
Edit: Based on comments from several readers, I think "Software Engineering" is a much better name for my proposed vocational split-off than "Programming." Also, this pattern has already been implemented at some Universities, including Purdue (see CS vs. Computer and Information Technology) although as of yet it's hardly pervasive.
It's a given that, generally, a Geology major is studying to be a geologist. Likewise, a Biology major is training to become a biologist, and an Art major will probably end up an artist of some kind.
Computer Science students, however, don't go to college to become computer scientists. They go to learn "programming."
Theoretical computer science involves complex math and theory that is useful and interesting and takes a sharp mind to fully comprehend; most undergrads don't care and increasingly are not being exposed to it. Instead, popular languages are being taught in undergraduate courses, with the intention of preparing students for future work (see Joel Spolsky's The Perils of JavaSchools for another take on this phenomenon.)
The sad thing is, having worked one-on-one with several recent Computer Science graduates, I don't believe that they're learning much about programming, either. Students with a passion for programming study it in their free time, work on their own projects, and do most of their learning outside of the classroom. Fresh graduates with a BS in Computer Science and no real experience programming just don't have the skills they need to do anything but grunt work. As an undergraduate Biology student, my first CS course was on bioinformatics algorithms and had several Masters students, and when I was able to implement the algorithms quicker and more efficiently than CS students, I saw how lacking my school's curriculum was.
Solutions thus far have been to dumb down the CS degree by using higher level ("easier") programming languages and teaching less theory and advanced math. I think that aiming to dumb down the curriculum in order to prepare students for a corporate programming career is killing off the pool of intelligent academic computer scientists. The solution? Accept that there's a difference and offer two distinct majors: Computer Science and Programming.
The immediate result would probably be a huge shift of students from CS to Programming. Maybe some CS departments would cease to exist due to lack of interest. Programming students would learn the basics they need to succeed in the corporate world (similar to some "Information Systems Management" programs, but with a more straightforward focus on the technical aspects of development.) But smart CS students wouldn't be hampered by the dumbing down of their programs of study. They'd be exposed to more current topics in research and have the opportunity to take more advanced courses. They'd be allowed to choose from emphasis areas more in line with the current directions of academia. The Computer Science department would be a fraction of its current size but the per capita ability and motivation would go up, and these students would go on to be the brilliant researchers of the future. Their peers in the Programming department could get the high-paying job at the corporation of their choice, or start their own companies.
Let's accept that there's a difference between the two types of student, and start treating them differently.
Edit: Based on comments from several readers, I think "Software Engineering" is a much better name for my proposed vocational split-off than "Programming." Also, this pattern has already been implemented at some Universities, including Purdue (see CS vs. Computer and Information Technology) although as of yet it's hardly pervasive.
Subscribe to:
Posts (Atom)