Lakeside reverie: The Blue Dragonfly

In the summer in Tarrytown the dragonflies appear overnight. They can be seen in the afternoon in well lit alcoves along the lakes edge perched on branches that jut out of the water, and flitting about defending their little outpost from any interlopers.

The Blue Dasher species with their shimmering electric blue coloration is especially mesmerizing. Their coordination and aerial prowess are really something. Why do dragonflies never accidentally hit into you, when flies, bees and all manner of flying insect can’t seem to help themselves?

Their pose is reminiscent of a helicopter’s, head down, tail up and a tendency to swerve from side to side.

Occasionally, their hover will be interrupted and they will zip about in a seemingly random direction for a second, only to return to their original position. They will frequently harry any flying insect, dragonfly or other which enters their vicinity. At first glance, this can appear to be a predation move, if the insect is something small like a mayfly, but after watching for a few seconds, it becomes clear the little fly gets away without a scratch.

Dragonfly skirmishes are a real spectacle, a dog fight in miniature. Sometimes the Blue Dasher will spar with dragonflies of the same species, a duel in electric blue faster than the eye can track. Other times, their most frequent sparring partner appear to be the fiery red Eastern Amberwing, a worthy opponent. After the interloper is warded off, the Blue Dasher will return to its perch to regain its strength and soak up more sunlight.

This perch defense behavior appears to be an elaborate mating ritual of sorts. The Blue Dashers eck out its a little alcove, wooing a mate, zipping about, discomfiting any rival that wanders there.

Dragonflies have a head that is something like 80% compound eye, wrapped around nearly their whole head. This gives them excellent vision: They can see in nearly 360 degrees at a very high ‘refresh’ rate with something akin to binocular vision.

Dragonflies have very high success rates when hunting, but I’ve never seen a Blue Dasher catching anything or even hunting something. The closest behavior I can think of which might fit this, is when I’ve seen larger dragonflies seemingly hunting in fields (I can’t think of any other reason they would be here, and they tend to be at the same heights as swallows who also appear to be hunting).

Amazingly, they do have predators, despite their speed and agility. One such is the cunning Cat Bird. The Cat Bird will perch on the branch of a dead tree near where dragonflies are frolicking, pick out a target and then make a quick 1-2 feet dash to try and catch them. It’s hard to tell exactly what their trick is, but they seem to have some strategy other than brute force and speed which the dragonflies are susceptible to.

Another predator of dragonflies is yellow jackets and wasps who somehow manage to restrain and butcher them despite their larger size.

One mystery of dragonflies: have they been under the pressure of natural selection recently, or are their adaptations more static in nature. Are they just a ‘perfect’ organism for their niche, with no further improvements needed so long as the environment stays more or less the same?

Late Jurassic period

A remarkable thing about the Blue Dasher is that it only lives for the season. As summer ends you see fewer and fewer of them as they die off going into the Fall. They disappear slowly, and then all at once, with a few of their larger cousins hanging in longer, but eventually succumbing, leaving the little alcoves a little less frenetic in preparation for winter.

H.G Wells’s Time Machine

A tale of three centuries 

H.G Wells’s “The Time Machine” contains some incredible digressions.

1895:

“Seeing the ease and security in which these people were living, I felt that this close resemblance of the sexes was after all what one would expect; for the strength of a man and the softness of a woman, the institution of the family, and the differentiation of the occupations are mere militant necessities of an age of physical force. Where population is balanced and abundant, much child-bearing becomes evil rather than a blessing to the State; where violence comes but rarely and offspring are secure, there is less necessity – indeed there is no necessity – for an efficient family, and the specialization of the sexes” 

Here he’s speaking of the Eloi, the physically diminutive and mentally naive surface dwellers who are descendants of humanity. The Eloi sexes are harder to differentiate than modern persons. It’s a fun trend to explore, we see this lack of differentiation at least in professional ‘white collar’ occupation where the gender gap has become smaller over time.

“So, in the end, above ground you must have the Haves, pursuing pleasure and comfort and beauty, and below ground the Have-notes, the workers getting continually adapted to the conditions of their labor” 

Wells had an interest in socialism and you can see some Marxian influence here. The premise of the Eloi and Murlock divide was basically that the rich became richer and lived in refinement where as the murlocks struggled living miserable lives. The tables turn in this future though because the ‘aristocracy’ have become so adapted to gentle conditions that they have wholly lost their fear and ability to fight. A bit like the dodo bird who with no natural predators had no fear of man and was hunted to extinction in a decade because of it. The Murlocks on the other hand have maintained their cunning and ferocity, being on the razor edge of evolution and struggle (they actually eat the Eloi). 

The events of the time machine are in the far-flung future but it’s fun to think about this prediction or scenario in the 125 years since it was written. As it happens humanity is more or less enjoying a golden age now. Compared to the blustery war years or the social upheavals of the industrial revolution era things are pretty peachy now. This begs the question: Are we going down the Eloi path as a civilization? Has prosperity lead to a lethargic generation of do-nothing good timers? 

I would argue, No, that it hasn’t: The decade is near closing (December 2019 as I write this) and thinking back on just the last decade I see a wave of technical advancements and changes. Mobile computing stands out in my mind as just one example: In 2009 I didn’t use my phone to stream the music I was listening to, hail an uber, board a plane and order food. There’s a lot of efficiency gains there. Just taking the plane example: Before the internet age, you had to go into the airport, see the check-in desk to get checked in and print out your boarding pass, find a directory to navigate the airport and so forth. Afterwards, you could be checked in and know your seat number while still in your pajamas in bed!

“The too perfect security of the upper-worlders had led them to a slow movement of degeneration, to a general dwindling in size, strength and intelligence” 

“Nature never appeals to intelligence until habit and instinct are useless. There is no intelligence where there is no change and no need of change”

(Interesting theory on the origin of intelligence.) 

1960: 

The 1960 film adaptation of the book is also a masterpiece. It keeps very close to the source material with a couple fun riffs thrown in here and there, for example: when the time traveler first jumps into the future, he finds himself in the midst of some kind of nuclear attack. The populace is fleeing into underground bunkers or safe houses and the air raid sirens are blaring. 

The great fears of the post war world come true and the world is blown to smithereens in some apocalyptic “The Day after Tomorrow” style ending. It’s indicated that the Morlocks develop from those folks who took safety underground and presumably lived out the destruction above for a few generations to become the phantasmal Morlocks . 

2002 

This adaptation takes the most liberties with the source material but I think it’s my favorite. Guy Pearce plays the time traveler. There’s a beautiful tragic love story to kick things off where the time traveler’s fiancé is shot in Central park by a robber attempting to steal their engagement ring.

The time traveler attempts to fix this by going back in time and taking the fiancé through another segment of the park or avoiding the park all together. Regardless of what he does she dies. This spurs him on his quest to find out why he can’t change the past, he thinks that they would certainly know the answer to this question in the far-flung future…

The Eloi of this future are neither diminutive like the novel nor simpering like the 1960 film. Here we have a mulatto race of future hunter gatherers. This bit was probably influenced in part by the expectation that the skin color differences that we have today will eventually average out yielding up a face like this: 

Wells would probably appreciate this expansion of the source material, his own contemporaries had just uncovered The law of regression to the mean a few years prior (Sir Francis Galton). Galton even gave a widely publicized demonstration at the legendary Royal Society on the topic. 

The 2002 version has its own insights on the future. Or at a minimum a glimpse into the odd manias and obsessions of the double aughts: 

In future New York, people ride around on bicycles presumably because the world’s oil supply has been depleted and cars are no longer economical. 

The future is struck not by war but by environmental disaster. The time traveler spends a few eons in a frozen waste engulfed in some glacier. (This brings to mind the Laurentide ice sheet which buried New York and most of New England under a mile-thick sheet of ice, tens of thousands of years ago.)

The film shows the influence of computers and is the first adaptation where they play a central role in the plot: 

The Eloi speak of a ghost hidden in a cavern who turns out to be the AI of the long lost New York Public Library. The idea of AI as an enduring memory of humanity is briefly explored here. 

Also striking are the CGI sequences: breathtaking in scope and a gentle tease of the kinds of things that machines can now do!

Featured

Can a neural net read a 5 year old’s handwriting?

I recently went up to visit my Mom for her birthday and while up there came across this pretty cute birthday card on the mantle: 

The author of this amusing well wish is my mom’s latest ward, 5 yr old Peter from up the block. This is a pretty bad ass dragon if you ask me! 5 year old me would nod with silent approval. 

It’s fun because you have to puzzle out the letters a bit. Some are pretty near the mark like the T and O but a few other such as the various e’s are more than a little obscure. To an outsider they might be illegible but being in possession of a brain and some context, not all together impossible to discern. My mother’s name is Rhea, it’s her birthday, therefore the meaning of the young author’s scribbles is “To Rhea, Peter”. 

This got me to thinking: What would a machine make of this birthday card? Put more provocatively: Can a neural net read a 5 year old’s handwriting? 

Well, we don’t have to guess the answer to this question, we can try it. 

The neural net we’ll use is the same one that’s all the rage these days: A convolutional neural net with several hidden layers. You’ve probably heard them go by the name of “deep learning” and other fancy buzzwords. More or less the same sort of nets that power the various machine learning implementations you’re familiar with like Alexa, Facebooks image classification and presumably what’s behind Tesla’s self driving cars. 

We’ll use pytorch as our library which is essentially a machine learning library written in python and developed by Facebook.  

A fair amount of massaging the data was required but the reader versed in machine learning will know that that’s most of the work. The code here took barley a hlf hr to cobble together. The image manipulation on the other hand took a few hrs (I probably could of sped that up by writing a script to do these operations but then I would have had to figure that out which would’ve took who knows how long. The dilemmas of the lazy man!). 

Here’s an example of the processed data: 

But isn’t that cheating?! No, not really, I’m working around the difference in conditions between the birthday card and the training data set: EMNIST. The data set is in black and white, the birthday card, green text on white background. 

So, now on to the experiment: Using a net with 2 convolutional layers, 2 fully connected layers, max pooling and 4 epochs (number of times you run over the training data), here are the results. 

Actual message: 

TO RHEA 

PETER 

Machine read: 

TO RHOA 

PPTOR 

At first glance this might not seem too good, but it definitely got a good portion of the message correct. 8/11 characters correct, or about 73%. If this was a test to pass the first grade we’d make the cut. Also if you consider it from the perspective of chance we can definitely see that out net is working to some extent. 

There’s 26 possible characters (letters in the alphabet) and 11 letters in the message. So if our program was just guessing the letters, the chances that it would correctly guess all letters is an astronomical 1/3,670,344,486,987,776‬ chance. Looking at it from the inverse: What are the chances that it would correctly guess 8/11 characters? 

1/208,827,064,576 or about a 1 in 200 Billion chance. 

So with that in mind we might not thumb up our nose at the little program so lightly.  

The astute reader will realize that this is a very bad experiment scientifically: The writers which contributed to the EMNIST data set were all adults and given specific paper and marker to write with. Those initial conditions are totally different than our young author: green crayola marker and construction paper. None the less I think the experiment is telling. 

Perhaps more interesting than evaluating the machine: we can evaluate the kid. Technically minded readers will notice this as what’s termed a reverse turing test. Given an individuals actions how sure are we that they are in fact a human and not a machine. 

In our case it would be more like: How close is our kid to being an adult in terms of handwriting. If he’s basically writing at an adult level we would expect our program to easily read his message 100% accurately or very near to. Well based on the test, I’d say pretty darn close. He’s got a few kinks to work out but our young author is well on his way. 

Like the handedness of his ‘e’s’: 

Face down e’s, inverted e’s and half finished e’s. This is interesting because it’s a trend. Although I have no 5 year old, I’ve seen enough examples of their writing to notice that they tend to have trouble with handedness. Backwards P’s, b’s and the like are common in young children. There’s something interesting there but it’s hard to say what. The same issues don’t seem to plague letters like T and A which are symmetrical and to which the writer need not pay attention to handedness.