Electoral Predictions

As something of a political anorak and a member of a political party, I thought I should make some political predictions for the 2015 General Election (polling on 7th May).

It’s difficult to call between Labour and the Tories as to who will have the most seats post election. The polls show a pretty much dead heat, and I don’t see either party making great gains or loses over the campaign. Labour have had a built in advantage which means that they get more seats for the same percentage of the vote as the Conservatives. It’s not clear if Labour’s “Scottish Problem” removes this advantage. My hunch is the Tories will do a little better than the polls are suggesting but both will have something around the 270 seat mark with Labour in the lead.

As a Liberal Democrat eternal optimism is something of of a pre-requisite. I joined the party when it had 22 seats and 22% of the national vote. I anticipate we’ll still get more than that after this election. I’m holding out for about 40 which is in excess of what pollsters predict. My reason for this optimism is that Liberal Democrat votes are local votes, and once in place Liberal Democrat MPs are difficult to dislodge, basically because they do a good job for their constituents (see here). 

The most interesting thing will be the SNP. I’m finding it a bit difficult to believe the predictions of an SNP landslide in Scotland, perhaps erroneously. My thinking is that they lost the independence referendum by some margin outside the central belt. It’s possible that the rise of the SNP vote represents a wider disaffection with Labour, not seeing them as representing Scottish interests in Westminster. I’m really struggling to believe they will exceed 50 seats but this is my biggest opportunity to be really wrong. Dropping the SNP seat count will benefit Labour.

UKIP will get nowhere, I actually have a bet with someone that they will have no further MPs beyond the two they currently have by defection. I anticipate they will poll relatively highly (i.e. above 10%), similarly the Greens who I don’t think will get a further seat. I suspect many will be jolly glad that UKIPs votes don’t convert into seats, perhaps fewer will be pleased when the same thing happens to the Greens for the same reason.

The likelihood is that no one party or even pair of parties (aside from Labour and Tory) will have sufficient seats to form a stable coalition. The key interesting thing is whether SNP or Liberal Democrats will have sufficient seats to make a coalition government, or at least a confidence-and-supply government with either Labour or Tory. It’s difficult to see the Liberal Democrats going for another round of coalition with the Tories with any enthusiasm, I see a fair chunk of the party being happy to try it with Labour. I’m not sure Labour will want coalition, they appear to have ruled it out absolutely with the SNP.

A Labour – SNP coalition would very definitely not be what we voted for, no English or Welsh voter could have voted for the SNP. The SNP is standing no candidates outside of Scotland. The party leader, Nicola Sturgeon, is not standing for a Westminster seat. The votes SNP MPs make in Westminster will often not effect their constituents, only those of English and Welsh constituents (see here). The SNP has shown little interest in matters south of the border other than to blame the English for all their woes, and to ensure that English students in Scottish universities pay English levels of fees whilst Scots, and indeed students from the rest of the EU, don’t. Not a happy guide as to how they might treat English interests in future. I can see a Labour-SNP coalition being quite damaging for Labour since I can imagine both Tories and Liberal Democrats will make a great deal of this lack of mandate.

Left thinking people, on the whole, appear happy with the electoral status quo. And so too do the Conservatives, the clue is in the name. But truly the Westminster system is broken, the Scots benefit from a fair degree of independence from Westminster with elections held using proportional systems at both local and national level. The rest of the UK could do with the same. 

…when the sun is eclipsed by the moon

Friday 20th March 2015 saw a solar eclipse visible over the British Isles, subject to the vagaries of the British weather. I have some form in taking pictures of the sun through my telescope. With solar eclipses taking place in the UK only once every 10 or so years (the last one was in 1999), I thought it worth the effort to take some pictures.

The key piece of equipment was the Baader AstroSolar filter mount I made a while back. It’s designed to fit on my telescope but works pretty well for naked-eye viewing and with my Canon 600D camera. I used a Canon 70-300m lens, mainly at the maximum zoom with varying exposure parameters depending on cloud. I used autofocus in the main but manually set exposure time, aperture and ISO. Consumer cameras aren’t designed to give good auto exposure for usual activities such as eclipse observations.

Here’s a closeup of the filter:

solarfilter

The uninitiated may not be impressed by the finish on this piece of equipment but as a scientist of 20 years standing I’m happy to report that I’ve had plenty of stuff in my lab in similar style – it’s good enough to do the job.

Solar eclipses last a surprisingly long time, this one was a little over two hours with first contact of the moon on the suns disk at 8:26am in Chester. This photo was taken at 8:26am, you can just see the moon clipping the edge of the sun top right.

IMG_5217 

By 9:01am things were well under way. The birds had started their evening song around this time and it was starting to feel unusually dark for the time of day.

IMG_5227

The maximum of the eclipse was at 09:30am, by this time clouds had appeared and I used them as an ad hoc solar filter.

IMG_5261

By 09:50am we were well past the maximum:

IMG_5283

The last photo I managed was at 10:18 before the sun disappeared behind the clouds:

IMG_5292

Finally, this is a collage of the majority of pictures I took – some of them are pretty rough:

010 - Eclipse - 20mar151

Book review: Engineering Empires by Ben Marsden and Crosbie Smith

engineering-empiresCommonly I read biographies of dead white men in the field of science and technology. My next book is related but a bit different: Engineering Empires: A Cultural History of Technology in Nineteenth-Century Britain by Ben Marsden and Crosbie Smith. This is a more academic tome but rather than focussing on a particular dead white man they are collected together in a broader story. A large part of the book is about steam engines with chapters on static steam engines, steamships and railways but alongside this are chapters on telegraphy and mapping and measurement.

The book starts with a chapter on mapping and measurement,  there’s a lot of emphasis here on measuring the earth’s magnetic field. In the eighteen and nineteenth centuries there was some hope that maps of magnetic field variation might provide help in determining the longitude. The subject makes a reprise later on in the discussion on steamships. The problem isn’t so much the steam but that steamships were typically iron-hulled which throws compass measurements awry unless careful precautions are taken. This was important as steamships were promoted for their claimed superior safety over sailing vessels, but risked running aground on the reef of dodgy compass behaviour in inshore waters. The social context for this chapter is the rise of learned societies to promote such work, the British Association for the Advancement of Science is central here, and is a theme through the book. In earlier centuries the Royal Society was more important.

The next three chapters cover steam power, first in the factory and the mine then in boats and trains. Although James Watt plays a role in the development of steam power, the discussion here is broader covering Ericsson’s caloric engine amongst many other things. Two themes of steam are the professionalisation of the steam engineer, and efficiency. “Professionalisation” in the sense that when businessmen made investments in these relatively capital intensive devices they needed confidence in what they were buying into. A chap that appeared to have just knocked something up in his shed didn’t cut it. Students of physics will be painfully aware of thermodynamics and the theoretical efficiency of engines. The 19th century was when this field started, and it was of intense economic importance. For a static engine efficiency is important because it reduces running costs. For steamships efficiency is crucial, less coal for the same power means you don’t run out of steam mid-ocean!

Switching the emphasis of the book from people to broader themes casts the “heroes” in a new light. It becomes more obvious that Isambard Kingdom Brunel is a bit of an outlier, pushing technology to the limits and sometimes falling off the edge. The Great Eastern was a commercial disaster only gaining a small redemption when it came to lying transatlantic telegraph cables. Success in this area came with the builders of more modest steamships dedicated to particular tasks such as the transatlantic mail and trips to China.

The book finishes with a chapter on telegraphy, my previous exposure to this was via Lord Kelvin who had been involved in the first transatlantic electric telegraphs. The precursor to electric telegraphy was optical telegraphy which had started to be used in France towards the end of the 18th century. Transmission speeds for optical telegraphy were surprisingly high: Paris to Toulon (on the Mediterranean coast), a distance of more than 800km, in 20 minutes. In Britain the telegraph took off when it was linked with the railways which provided a secure, protected route by which to send the lines. Although the first inklings of electric telegraphy came in in mid-18th century it didn’t get going until 1840 or so but by 1880 it was a globe spanning network crossing the Atlantic and reaching the Far east overland. It’s interesting to see the mention of Julius Reuter and Associated Press back at the beginning of electric telegraphy, they are still important names now.

In both steamships and electric telegraphy Britain led the way because it had an Empire to run, and communication is important when you’re running an empire. Electric telegraphy was picked up quickly on the eastern seaboard of the US as well.

I must admit I was a bit put off by the introductory chapter of Engineering Empires which seemed to be a bit heavy and spoke in historological jargon but once underway I really enjoyed the book. I don’t know whether this was simply because I got used to the style or the style changed. As proper historians Marsden and Smith do not refer to scientists in the earlier years of the 19th century as such, they are “gentlemen of science” and later “men of science”. They sound a bit contemptuous of the “gentlemen of science”. The book is a bit austere and worthy looking. Overall I much prefer this manner of presentation of the wider context rather than a focus on a particular individual.

Book review: Data Science at the Command Line by Jeroen Janssens

 

datascienceatthecommandlineThis review was first published at ScraperWiki.

In the mixed environment of ScraperWiki we make use of a broad variety of tools for data analysis. Data Science at the Command Line by Jeroen Janssens covers tools available at the Linux command line for doing data analysis tasks. The book is divided thematically into chapters on Obtaining, Scrubbing, Modeling, Interpreting Data with “intermezzo” chapters on parameterising shell scripts, using the Drake workflow tool and parallelisation using GNU Parallel.

The original motivation for the book was a desire to move away from purely GUI based approaches to data analysis (I think he means Excel and the Windows ecosystem). This is a common desire for data analysts, GUIs are very good for a quick look-see but once you start wanting to repeat analysis or even repeat visualisation they become more troublesome. And launching Excel just to remove a column of data seems a bit laborious. Windows does have its own command line, PowerShell, but it’s little used by data scientists. This book is about the Linux command line, examples are all available on a virtual machine populated with all of the tools discussed in the book.

The command line is at its strongest with the early steps of the data analysis process, getting data from places, carrying out relatively minor acts of tidying and answering the question “does my data look remotely how I expect it to look?”. Janssens introduces the battle tested tools sed, awk, and cut which we use around the office at ScraperWiki. He also introduces jq (the JSON parser), this is a more recent introduction but it’s great for poking around in JSON files as commonly delivered by web APIs. An addition I hadn’t seem before was csvkit which provides a suite of tools for processing CSV at the command line, I particularly like the look of csvstat. csvkit is a Python tool and I can imagine using it directly in Python as a library.

The style of the book is to provide a stream of practical examples for different command line tools, and illustrate their application when strung together. I must admit to finding shell commands deeply cryptic in their presentation with chunks of options effectively looking like someone typing a strong password. Data Science is not an attempt to clear the mystery of these options more an indication that you can work great wonders on finding the right incantation.

Next up is the Rio tool for using R at the command line, principally to generate plots. I suspect this is about where I part company with Janssens on his quest to use the command line for all the things. Systems like R, ipython and the ipython notebook all offer a decent REPL (read-evaluation-print-loop) which will convert seamlessly into an actual program. I find I use these REPLs for experimentation whilst I build a library of analysis functions for the job at hand. You can write an entire analysis program using the shell but it doesn’t mean you should!

Weka provides a nice example of smoothing the command line interface to an established package. Weka is a machine learning library written in Java, it is the code behind Data Mining: Practical Machine Learning Tools and techniques. The edges to be smoothed are that the bare command line for Weka is somewhat involved since it requires a whole pile of boilerplate. Janssens demonstrates nicely how to do this by developing automatically autocompletion hints for the parts of Weka which are accessible from the command line.

The book starts by pitching the command line as a substitute for GUI driven applications which is something I can agree with to at least some degree. It finishes by proposing the command line as a replacement for a conventional programming language with which I can’t agree. My tendency would be to move from the command line to Python fairly rapidly perhaps using ipython or ipython notebook as a stepping stone.

Data Science at the Command Line is definitely worth reading if not following religiously. It’s a showcase for what is possible rather than a reference book as to how exactly to do it.

Book review: Remote Pairing by Joe Kutner

 

jkrp_xlargecoverThis review was first published at ScraperWiki.

Pair programming is an important part of the Agile process but sometimes the programmers are not physically co-located. At ScraperWiki we have staff who do both scheduled and ad hoc remote working therefore methods for working together remotely are important to us. A result of a casual comment on Twitter, I picked up “Remote Pairing” by Joe Kutner which covers just this subject.

Remote Pairing is a short volume, less than 100 pages. It starts for a motivation for pair programming with some presentation of the evidence for its effectiveness. It then goes on to cover some of the more social aspects of pairing – how do you tell your partner you need a “comfort break”? This theme makes a slight reprise in the final chapter with some case studies of remote pairing. And then into technical aspects.

The first systems mentioned are straightforward audio/visual packages including Skype and Google Hangouts. I’d not seen ScreenHero previously but it looks like it wouldn’t be an option for ScraperWiki since our developers work primarily in Ubuntu; ScreenHero only supports Windows and OS X currently. We use Skype regularly for customer calls, and Google Hangouts for our daily standup. For pairing we typically use appear.in which provides audio/visual connections and screensharing without the complexities of wrangling Google’s social ecosystem which come into play when we try to use Google Hangouts.

But these packages are not about shared interaction, for this Kutner starts with the vim/tmux combination. This is venerable technology built into Linux systems, or at least easily installable. Vim is the well-known editor, tmux allows a user to access multiple terminal sessions inside one terminal window. The combination allows programmers to work fully collaboratively on code, both partners can type into the same workspace. You might even want to use vim and tmux when you are standing next to one another. The next chapter covers proxy servers and tmate (a fork of tmux) which make the process of sharing a session easier by providing tunnels through the Cloud.

Remote Pairing then goes on to cover interactive screensharing using vnc and NoMachine, these look like pretty portable systems. Along with the chapter on collaborating using plugins for IDEs this is something we have not used at ScraperWiki. Around the office none of us currently make use of full blown IDEs despite having used them in the past. Several of us use Sublime Text for which there is a commercial sharing product (floobits) but we don’t feel sufficiently motivated to try this out.

The chapter on “building a pairing server” seems a bit out of place to me, the content is quite generic. Perhaps because at ScraperWiki we have always written code in the Cloud we take it for granted. The scheme Kutner follows uses vagrant and Puppet to configure servers in the Cloud. This is a fairly effective scheme. We have been using Docker extensively which is a slightly different thing, since a Docker container is not a virtual machine.

Are we doing anything different in the office as a result of this book? Yes – we’ve got a good quality external microphone (a Blue Snowball), and it’s so good I’ve got one for myself. Managing audio is still something that seems a challenge for modern operating systems. To a human it seems obvious that if we’ve plugged in a headset and opened up Google Hangouts then we might want to talk to someone and that we might want to hear their voice too. To a computer this seems unimaginable. I’m looking to try out NoMachine when a suitable occasion arises.

Remote Pairing is a handy guide for those getting started with remote working, and it’s a useful summary for those wanting to see if they are missing any tricks.