National Learn to Code Day

On Saturday, I took part as a mentor in National Learn to Code Day with Ladies Learning Code. There were about 50 learners of all ages. The topic was “Using Data to Solve Problems: An Introduction to Artificial Intelligence and Machine Learning for Beginners”, led by Solmaz Shahalizadeh, the data team directory at Shopify in Ottawa.

The topic seemed like an oxymoron at first – how can beginners possibly cover in one day what could easily span multiple graduate courses? But actually, it worked great, and I think everyone learned a lot.

Continue reading →

How to learn to code

I just read a great post by Jessica Duarte on teaching beginners to code. It is all so true. Especially #5, making mistakes:

You [the instructor] have to ride out the mistakes. Make them often. Let the class fix them.

It’s essential for students to see and experience the process of working through mistakes. Right now, I am starting to use git and Github for our manakin research at the Smithsonian. A major benefit is that it allows us to make mistakes safely.

Duarte is organizing the 2017 National Learn to Code Day on Intro to Machine Learning and Artificial Intelligence. I look forward to helping out with the Ottawa chapter in on September 23!

Does biology explain the sex ratio in tech?

Here’s what bugs me about James Damore’s recent anti-Google screed: it’s a terrible misuse of biology.

The question he addresses is: Why are there so few women in tech and tech leadership? In his memo to Google, Damore offered an explanation (note: I added the numbers):

On average, men and women biologically differ in many ways. These differences aren’t just socially constructed because:

(1) They’re universal across human cultures

(2) They often have clear biological causes and links to prenatal testosterone

(3) Biological males that were castrated at birth and raised as females often still identify and act like males

(4) The underlying traits are highly heritable

(5) They’re exactly what we would predict from an evolutionary psychology perspective

I’ll assume, for the sake of argument, that points (1)-(4) are more or less true.

Continue reading →

Data sharing, reproducibility and peer review

I just reviewed my first manuscript where the authors provided a reproducible analysis (i.e., they shared their data and analysis script with the reviewers). This is something my coauthors and I have tried to provide with our recent studies, but it was my first time experiencing it as a referee.

I think it really helped, but it also raised new questions about traditional peer review.

Continue reading →

The Hummingbird Festival in Sedona

I just got back from the Hummingbird Festival in Sedona, Arizona. It was an honour to be invited there to present our work on flight.

Sedona Hummingbird Festival, 2017.

Photo by Maria Mahar at www.hummingbirdpictures.net

The audience at the festival had a ton of great questions and I learned a lot. For example, the Anna’s hummingbirds are a fairly recent arrival in Sedona, just as they are in Vancouver, because urbanization has also allowed the species to gradually expand its range east into the desert (as well as north). I wonder how that has affected the hummingbird community there? I also learned that it is pretty easy to set up an outdoor Drosophila colony as a protein source for breeding hummingbirds.

We saw the Grand Canyon and more bats, hummingbirds, and aura photographers than ever before in one place. Arizona has great insects, too. My favourite? The “pleasing fungus beetle” we spotted at Starbucks.

View from the south rim of the Grand Canyon

Photo by Charlie Croskery.

How do babies learn words?

My 10-month old daughter just proved that she understands some words. Now, when we tell her to “clap your hands”, or even just talk about clapping, we get a round of applause. Pretty cute! This wasn’t one of the things we were actively trying to teach her, like “daddy”, “mommy”, “dog”, or “milk” – I haven’t seen evidence that she knows those yet.

It just goes to show how learning works: motivation trumps deliberate efforts to teach. Clapping is just plain fun.

It’s spooky to think about what else she might come to understand without us knowing.

Flight school

Our research on hummingbird flight is featured in the July 2017 National Geographic!

The article is all about hummingbird science, and how new techniques are allowing us to see aspects of their behaviour that aren’t available to the unaided eye. You can read the print article here, see a beautiful video summary here, and another one here. Here’s one of an Anna’s hummingbird in a wind tunnel. He’s remarkably good at keeping his head steady as the wind ramps up:

The photographer, Anand Varma, took a great shot of my vision experiments at UBC that shows a bird perching in a strange, Tron-like environment of glowing green stripes:

Hummingbird in the virtual reality flight tunnel

Photography and video by Anand Varma in National Geographic.

Between getting the scene right, adjusting the lighting, and then waiting for the bird to act in just the right way, this one photograph took an entire week of work (hands on work that is, no photoshop!). Given all the other complex shorts in the article, it’s easy to see how the whole endeavour took a couple of years – much like a scientific study. Working with Anand that week, it was interesting to see how many other parallels there are between what he does and our research. A lot of trial and error, a lot of patience, and a lot of coping with the quirks and surprises of animal behaviour.

The article ends with a scene from the summer when the writer, Brendan Borrell, spent a couple of days with me in the lab. I have the honour of being described as emerging from the lab with a “sheen of sweat” on my forehead. It is embarrassing, but true! It was a hot day and we were working hard in that room.

There is also a nice editorial about the project here.

Peacock Day

Saturday, March 25 was Peacock Day at the Los Angeles Arboretum. I was looking forward to giving a talk at this event for months because it was a chance to return to my stomping grounds at the best time of year.

The event had guided peacock walks, peacock-themed art activities, sitar music, and an Indian food truck (because the species is originally from India). It was a hit – when I arrived in the afternoon there was a huge lineup at the park gates. Total attendance was over 4,400, the biggest day of the year for the Arboretum. There was even a bump in attendance the following day (2,800), because of people who missed the peacocks on Saturday.

My talk was in Ayres Hall (the same building we used to trap many of the females 7 years ago), with 170 people in the audience. I suggested that if we want to give credit where credit is due, we should really call it Peahen Day, because peahens are responsible for the evolution of the peacock’s amazing display.

I also talked about why I think the species does so well in California (and other places). I think it’s because peafowl are social (they stick together as an effective defense against most predators), because they are quick learners, and because the chicks spend a long period of time following mom – around 9 months, actually. That’s a long time for a bird! It provides many opportunities for mom to transmit skills that allow her offspring to handle new environments, like what to eat, how to hide, and even how to cross the road.

I think the main thing we’ve learned from our research on peafowl is the importance of dynamic signals during mate choice. i.e., it’s not just what a peacock has that makes him beautiful, but also how he uses it. A major theme in evolution research today is whether sexual selection speeds or hinders adaptation. Although we don’t yet know whether sexual selection has promoted adaptation in peafowl, we can say that they have spread around the world because of their sexually-selected traits. We brought peacocks to California, Hawaii, Florida, New Zealand, and many other places, because they are beautiful in our eyes as well as those of the peahen.

Troubleshooting and iteration in science

The scientific method is taught as far back as elementary school. But students almost never get to experience what I think is the best part: what you do when something goes wrong. That’s too bad because self-correction is a hallmark of science.

In ecology and evolution, most graduate students don’t get to experience iteration firsthand, because they are often collecting data right up until the end of their degree. I didn’t experience it until my postdoc, when we failed to repeat a previous experiment. It took several experiments and a lot of time  – two years! – to figure out why. In the end, it was one of the most rewarding things I’ve done.

Wouldn’t it be great if undergraduate students actually got to do this as part of their lab courses (i.e., revise and repeat an experiment), rather than just writing about it?

One thing that can come close – teaching you how to revise and repeat when something doesn’t work – is learning to code.

How to mentor

Yesterday I was asked about how I mentor in research. This is an area where I still have a lot to learn, however, there are at least four things that I think are really important:

1. Confidence**.
Instilling confidence is probably the most important thing a mentor can do. Science is about unknowns and learning how to become an expert. And that requires confidence.

So how do you instill confidence?

2. Basic programming and learning how to “script”.
This was a real catalyst for me and a huge boost to my confidence. Once I had mastered some basic programming in R, it allowed me to start treating data like an experimental subject. Want to understand what happens when you ignore pseudoreplication in your data? What about how collinearity might influence the results of your analysis? It’s not too hard to write a simulation to figure that out. A lot of basic programming is troubleshooting, a useful and transferable skill. Acting like an experimenter also comes naturally – I see it all the time with my 4-month-old daughter!

Learning how to write scripts is also key to making your workflow efficient and reproducible. Filtering, tidying, and graphing your data is 90% of the work. Doing that through code is way more efficient and leaves a record of what you did, making it easier to correct errors later on. And if you can generate publication-quality graphs purely through code, it will save you a huge amount of time making tweaks. And believe me, you will need have to make a lot of tweaks. Finally, scripting means your work can be used by others (including, and perhaps especially, your future self).

3. Students are scientists, too.
There is nothing I’ve done that couldn’t be done by an undergraduate, if they had enough time. One of the best things grad school was our weekly seminar series. We’d have an MSc exit seminar one week followed by a distinguished visiting professor the next. As a student, your work is every bit as important.

4. Treating feedback as an opportunity.
I think it’s important to provide students with lots of constructive feedback – and also, to help them develop an ability to deal with it. In science (and in life), rejection happens. I got another huge boost when I stopped worrying about negative feedback and started looking at it as a problem-solving opportunity. This is a broadly transferable skill.

Taken together, the points above are pretty circular: it takes confidence to handle feedback, but also dealing with feedback forces you to gain confidence. So “fake it until you make it” really works. As a mentor, I think it’s important to treat students as fellow scientists, to provide them with lots of opportunities to act as peer reviewers and reviewees, and to model the process of using feedback to solve problems.

Update to #1 above, on confidence: I also try to emphasize that the value of science is based on the quality of the data collected and clear dissemination of the results – and not whether it supports a particular hypothesis, or has a p-value < 0.05. I think this is a major stumbling block for a lot of students. Your thesis does not hang on the results of one test! The cure to this kind of thinking includes a better understanding of what p-values really mean and the limitations of null hypothesis statistical testing (NHST), and a focus on reporting the data (including effect sizes, confidence intervals, and individual variation).

** Related: I think a lack of confidence is a major cause of the leaky pipeline for women in STEM (and perhaps other under-represented groups). Many women choose careers outside of science despite aptitude (see for example this 2009 study by Ceci et al.). There’s some very recent evidence that gender stereotypes about aptitude – which could shape children’s interests as well as their confidence – begin as early as 6 years old (see here).

A murder and a mutant

I woke up the other day to see this:

A little closer:

Those aren’t leaves covering the trees – they’re crows! There must have been a few thousand of them (the picture only shows part of the flock, which extended to cover several other trees and rooftops). This is the third time this winter that I’ve seen a mega-roost in downtown Ottawa. Each time it has been on days that are much colder than usual. By noon, the flock had dispersed.

We had more bird encounters in Quebec last week where we saw a partial albino black-capped chickadee:

Here’s a black-capped chickadee with regular plumage, for comparison:

In domestic birds, partial albino (pied) mutations are recessive and fairly rare. It took about 100 years of cockatiel breeding before the pied mutation was established in the US, in 1951. I can’t find published numbers for chickadees, but bird banders counting mourning doves have recorded only 1 partial albino among 10,749 individuals. So this was probably a pretty rare bird! And here’s Ada, no longer impressed by a regular old chickadee:

Learning to science

From Alison Gopnik’s The Gardener and the Carpenter:

Imagine if we taught baseball the way we teach science. Until they were twelve, children would read about baseball technique and history, and occasionally hear inspirational stories of the great baseball players. They would fill out quizzes about baseball rules. College undergraduates might be allowed, under strict supervision, to reproduce famous historic baseball plays. But only in the second or third year of graduate school, would they, at last, actually get to play a game.

Bird-inspired drones

This Christmas the strong winds decorated the trees with shiny new drones:

(photo by Rod Croskery)

Drones of the future are going to get a lot more maneuverable.

A group at Imperial College London has now built an aquatic diving drone with wings that can tuck in for protection during rapid plunges, inspired by the hunting behaviour of seabirds in the family Sulidae (gannets and boobies).

And a Swiss team has developed a drone with feather-like elements that allow the wing to fold into a range of configurations, analogous to the way birds can overlap their wing feathers. This allows the drone’s wings to be adjusted to suit the conditions – reducing wing area in strong winds, for example.

These advances should make it possible for drones to maneuver in a greater range of tough-to-access environments, just like birds.

Both studies are published in a new issue of Royal Society Interface Focus:

Siddall et al. Wind and water tunnel testing of a morphing aquatic micro air vehicle.

Di Luca et al. Bioinspired morphing wings for extended flight envelope and roll control of small drones.

Girls do science

One of the best things about maternity leave is watching my daughter learn new things, almost daily. A few weeks ago she realized she could control her feet. This week she’s using her hands to grab at objects and starting to pull them in for further, mouth-based inspection. It really is exponential – the more she learns, the more she is able to figure out.

Children also learn a lot from what they hear. And they are apparently sensitive to the particulars at a surprisingly young age. Take, for example, the phrase “some birds fly” vs. the generic version “birds fly”. Psychologists have shown that halflings as young as two years old can tell the difference between these two phrases, and they can also use the generic version appropriately. What’s more, when adults use generic language in conversation with very young children, the children are able to infer new categories and make predictions about the world. This has been shown in experiments where psychologists talk about new, fictional categories (like Zarpies and Ziblets) with children. The results of these studies suggest that children are essentialists: i.e., they tend to carve up the world into categories, and view members of the same category as sharing a deeper, inherent nature. And these categories are easily transmitted through language.

This can have some unintended consequences. In her book The Gardener and the Carpenter, Alison Gopnik describes a study by Susan Gelman and colleagues where mothers and their children were given pictures of people doing stereotyped (a girl sewing) and non-stereotyped (a girl driving a truck) activities, and their conversations were recorded and quantified. It turns out that even mothers who were feminists used generic language most of the time. Moreover, there was a correlation between how often mothers used generic language and how often their children did.

Worst of all, moms used generics that reinforced the very stereotypes they were trying to combat. As Gopnik puts it:

Saying “Girls can drive trucks” still implies that girls all belong in the same category with the same deep, underlying essence.

I can’t help but wonder how this might affect our daughter as she grows up.

Although her book is not meant to be prescriptive, Gopnik does say that we probably can’t avoid this by careful wording – it just wouldn’t work to try to consciously control our language. Instead, the best antidote may be to have children observe many examples and talk to many different people.

How hummingbirds control flight

We have a new study out on how birds use visual cues in flight. Here is a summary:

Thanks to Charlie for helping to capture the video footage! The study is a collaboration with Tyee Fellows and Doug Altshuler at UBC.

For the experiments, we used eight high-speed black & white cameras to capture the entire length of the 5.5 metre-long flight tunnel (I only had space to show two in the Youtube video above). The cameras were part of an automated tracking system that tracked the birds’ motion, and determined the birds’ 3D flight paths from the different camera views. This works similar to the way multiple cameras are used to make 3D movies.

Hummingbirds were great subjects, not only because they are incredible fliers, but also because they are sugar fiends! They have to feed every 10-15 minutes throughout the day. This meant that we were able to design big experiments and test a wide range of visual conditions.

Here are two other clips that illustrate the data from the tracking system:

The best part about this project was that we started with a pilot study that seemed like a failure, at first. We tried to repeat what had been previously shown for other birds (based on a pioneering study of budgies), but we did not see the same results. At first, that can be pretty disappointing. But it also gives you the chance to think of new ideas, and then figure out ways to test them. I think this evolution from failed experiments to ones that work is the most exciting part of science! The catch is that it can take years to get there. I really started to appreciate this once I began working with birds in the lab.

Dakin, Fellows & Altshuer. 2016. Visual guidance of forward flight in hummingbirds reveals control based on image features instead of pattern velocity. PNAS, in press.