Quantum Field Theory [1]

Hi I've learned a lot of physics over the years ... Some of it was dry (introductory optics was booooring) but most of it was pretty cool. One of the single most interesting topics I studied however, was a physical theory called 'quantum field theory', whose aim was to unite the worlds of quantum mechanics with the idea of fields and of special relativity to create a really powerful set of tools for describing phenomena at the smallest scales.

What's a field?

In physics, a field is simply an entity which can be described by a number (or series of numbers) distributed in space. For example, we can consider the temperature across a room as being what is known as a 'scalar field' (scalar = 1 number to describe the field at each point in the room) or we can consider the wind across a country as a 'vector field' (vector = (x,y,z) direction of the wind, for example drawn by an arrow, at each point across the country). Fields crop up a whole lot in physics, and in fact the study of them mathematically is known as 'field theory'.

Further to this, there is a distinction in physics between what are known as 'classical' or 'quantum' field theories. Classical field theories include the theory of electromagnetism, or of general relativity (gravity). They are denoted 'classical' by the fact that they describe classical or pre-quantum physics, not that they are necessarily any simpler or don't still provide fertile research ground.

The whole aim of a classical field theory, is to describe mathematically the properties of a given field (or set of fields) and how they interact with matter. For example, electromagnetic field theory provides a description of how electric and magnetic fields interacting with objects which possess charge, such as electrons and protons. General relativistic field theories describe how objects with mass interact with one another and create changes in the gravitational field through their distortion of spacetime.

So, that's a field theory, but what make 'quantum' field theories so interesting?

What's a quantum field?

The description of the behaviour of very small objects in the universe is  often accomplished by using the tools of quantum mechanics. Quantum mechanics tells us that the world of the very small (atoms, nuclei, electrons, protons, quarks etc) is a world in which the normal rules of motion do not apply. For example, electrons are both waves and particles at the same time and they can be in two places at once. What became clear through the 20th century however, was that quantum mechanics was not providing a complete picture of behaviour at very small scales for a variety of phenomena.

For example, the electromagnetic (EM) field around a point charge, for example the electron, was a bit of a conundrum. Physicists like Jordan, Heisenberg and Born had developed a method for creating a quantum field theory for the free EM field in the mid 1920s (think photons). This was an excellent start but it didn't have the concept of interactions in it, so if you plopped an electron into your system you couldn't really say much about it.


Embedding Insight Through Prediction Driven Logistics - Data AI Summit Talk - Nov 2020

Bit of a golden oldie here from Nov 2020! Do you even remember what life was like pre-pandemic? This was the talk I gave with Helena on our work at Aggreko with prediction driven logistics. Essentially all about how we were building models to perform regression on fuel levels and maintenance issues.

Some super cool stuff and a big profile event which was great!

Speaker blurb from the conference.

Hope you enjoy!

Machine Learning Architecture - Designing Scalable Solutions

A large part of my job involves designing, building and deploying machine learning solutions for the company I work for. In this post I'm going to quickly highlight some of my key thoughts on this so that if you are new to ML architecture, you can have some good pointers to get from from "blank sheet of paper" to "deployed and running" faster.

The Main ML Architectures

The way I see it, there are only a few ML solution architecture types (they may have fancy names somewhere but I won't know them). I reckon you could assign most, if not all, machine learning implementations into one of these categories (probably because they are so vague/wide-reaching):

  1. The ML Microservice
  2. The Streaming process,
  3. The  Batch process,
  4. The  Integrated approach

I'll go through each of these and list some examples to get you acquainted with what I mean.

The ML Microservice

Imagine you have a map based product, and the user can interact with this product by clicking on one of the entities on the map, for example a truck, and then they can click a button that says "Predict ETA at destination". If I was building an ML based solution for providing that prediction then it would most likely be behind a REST API to some application that read in a request for a prediction and quickly returned that prediction. One way of doing this would be to deploy a lightweight web application (like a Flask app) to a cloud based hosting service. You could design the Flask app to read in your pre-trained machine learning model from a model repository (cloud based storage) and serve predictions via a simple HTTP request-response interaction.

The Streaming Process

In a 'streaming' approach, you are going to work directly with the data as it comes in. This is a type of 'event driven' architecture, whereby an action in one part of the system initiates the next and so on. It is particularly useful for processes which can be a bit ad-hoc in terms of frequency requirements. For example, you may want a streaming process to analyse click data from your web site as it comes in since the production of results works on the same frequency as the ingestion of the data. When there are more clicks, there will be more analysis, when there are no clicks, no analysis. This also means that you do not have to wait for some threshold amount of data to be ingested before performing your action, like you might in a 'batch' approach (see below).

You can do this using tools like Apache Kafka or Spark Streaming.

The Batch Process (or 'ETML')

If the solution has the aim of producing a relatively standardised dataset with some kind of machine learning result on a schedule or very consistent basis, then it may make sense to deploy this as a batch processing service. In this case, you build a pipeline that extracts data, performs the relevant transformations to prepare for modelling, you then perform the model based calculations and surface the results. These steps are why I often call this 'ETML' ('ETL' being 'Extract, Transform, Load', 'ETML' is 'Extract, Transform, Machine Learning').

In my experience, this sort of architecture is often the easiest to develop and deploy. You are building something that is very stable and you usually do not have to worry about successful triggering of the pipeline. In streaming or dynamic services for example, you have to ensure that the REST API request or the event-driven trigger you employ works appropriately in a variety of circumstances through rigorous testing. For a scheduled batch process this is usually much simpler. You just set up your schedule via a cron job or other process, ensure that it works the first few times and then you're off.

The Integrated Approach

This final option is really a kind of exceptional case. I can totally imagine a scenario where you want to embed the machine learning capability directly within some general solution, rather than externalised as a separate service or process. Some good examples where this may apply are:

  • 'Edge' deployments: When you have machine learning running on an IoT device, potentially one with limited connectivity, it might make sense to directly put the machine learning functionality in your main piece of software. However, I would recommend actually following the 'ML Microservice' approach here using something like Docker containers.
  • Integration with another microservice: In this case, you may already be developing a microservice that performs some simple logic and the machine learning is really just an extension or variant of that. For example, if you have already built a Flask web app that returns some information or result, the machine learning could just be another end-point.
  • Out of the box product: If your team is in charge of adding functionality to a piece of software that you are selling onto a client, you may have to package up the machine learning inside the solution somehow. I'm less sure how this would work and I do think that you'd be better using a microservice approach in general.

In Summary

There's a few different ways to package up your machine learning solutions, and it's important to understand the pros and cons of each.


Whoa There! The Data Community and Covid-19

The coronavirus pandemic and its affect on our daily lives do not need an introduction - we are all living through it this rather surreal situation. So, I'll just get right to it:

 What can the data science/analytics community do to help in this crisis? 

I think this is actually a really tough question. Given that, in this article I wan't to try and chew over some of my thoughts on this. I'm keen to get the conversation going in the wider analytics community, so please comment with thoughts and suggestions on electricweegie.com, Twitter, LinkedIn. Wherever you find this article and/or me, let's get chatting.


The Dangers of Being a Convincing Amateur

The global (and my local) data community consists of an amazing, diverse bunch of supremely talented and passionate people, who often want to go out and "make the world a better place" (as corny as that sounds). They want to do this through building analyses, products, services and technologies that entertain, guide and enable us in ways we never thought possible before. Just think where we were 10 or even 5 years ago in terms of big data, IOT, machine learning and the cloud to get a sense of how our capabilities and reach have grown as data professionals.

Now, when something like a global pandemic hits in this glittering age of data and technology, what are this community going to do other that roll up their sleeves and get analysing and building? Exactly.

I absolutely commend this, and I am desperate to get stuck into this problem myself, but I think we must tread carefully as a community. It is very easy to convince yourself that because you know your way around industrial or academic data problems you can just start creating analyses on Covid-19 datasets and that this will automatically be helpful.

I think there are a few things that can quite quickly go wrong if we, as a community, get ahead of ourselves and do not do the necessary and important groundwork.

Basically, on an important topic like this one, there is nothing more dangerous than convincing amateurs. And let's be honest, if you do not already work in epidemiology or have some training in that area, you are an amateur. It will be a new topic, but because of your years churning out data science and analytics solutions you will be able to build something sophisticated that looks great and uses cool sounding techniques. In other words, you'll be a very convincing amateur.

This can be really dangerous because if we in the analytics community start churning out analyses left, right and centre without key knowledge of this field, we could be coming to conclusions or making suggestions that are very convincing but potentially dangerous. And, as we all know, this is definitely a dangerous situation.

This week I have already seen analyses published on LinkedIn looking at things like case rates and calculated fatality rates for Covid-19 data from across the world where the authors drew some stark conclusions about the efficacy of state interventions or extrapolated outbreaks with some interesting (but ultimately misleading) exponential functions. I am not saying here that these analyses shouldn't have been done, but what I am saying is that

a) there are better things we could/should be doing as a community and

b) we will all need to be careful about the language we use and how we communicate.

Fine, Andy, you aren't happy - so what do we do?


Levelling Up & Leveraging What You Know

First, let's consider the case where you really have your heart set on analysing the outbreak data (who doesn't love an armchair epidemiologist?).

In this case, the least you can do is level up your knowledge before you go drawing strong conclusions from your data. At a base level read this thread from Adam Kucharski on Twitter. Kucharski is an associate professor at the London School of Hygiene and Tropical Medicine where he works on, you guessed it, epidemiology. I'd really also recommend his book, The Rules of Contagion (not sponsored btw). You can also do the usual and audit a MOOC, for example I am currently doing the 'Epidemics' course from UPenn on Coursera. Doing this sort of reading will at least get you comfortable with the basics of the field.

I would then suggest that when exploring the Covid- 19 datasets, don't try to do too much interpretation or extrapolation. This way you won't fall into the trap of over-reaching or making any drastic suggestions. I still think doing some exploratory and statistical analysis super useful so by all means get stuck in. Just check yourself as you go though and be mindful of how you communicate your results - if you think you've discovered some weird quirk of the pandemic or some previously unknown intervention side effect, you probably haven't*.

If you are keen to look at the relationships between interventions and case rates or fatalities then please try and work in collaboration with someone who knows what they are talking about (but obviously be mindful that if they are indeed a disease modeller, they may be working flat out already and will not have much to give you an education).

The other very important way we can all help is by leveraging what skills we have and what fields we know inside out. It might require some thought, but I am almost certain that all of you out there have skill-sets you can apply in a way that will genuinely help people in this pandemic.

Some ideas to get the ball rolling:

1. Dashboarding & Visualisation: I think one of the ways we can absolutely help other scientists working on this is to bring together the datasets they need and provide them with the tools they need to interact with it dynamically and easily. This is  something that so many of you out there will be world class at. If you have developed Power BI or Tableau dashboards for organisations, if you're a whizz at building R Shiny or Flask Apps for customers then you can probably build something that will allow researchers to interact with relevant Covid-19 datasets and to glean insights from them.

2. Getting the Message Out: Whatever country you are in just now you have no doubt been watching a lot of press conferences, briefings and announcements by world leaders, health experts and of course the World Health Organisation (WHO). The greatest weapons we have in the fight against Covid-19 are the advice, suggestions and knowledge being expounded by WHO and other scientific bodies on an almost daily basis. Can you help get their message across? Perhaps you can build some web scraper that brings together all of the relevant health body advice in your country, or can you build automated alerts that link to different government sources to help people keep track? Could you even use those skills you developed in marketing analytics to work out the best ways to re-share, plug and package all this information so that the message gets out to the most people and the advice is followed?

3. Support the System: By far I think the best thing we can do is support the organisations and people who will both fight the disease and also keep your country running throughout this crisis. In the UK we've already seen some of the systems and processes we rely on in our daily lives being stretched and strained. For example we've had people panic buying and leaving supermarket shelves empty, even when there is no shortage of food or essential items. We've had to call up thousands of retired and lapsed medical staff to make sure we can cope with the coming surge in Covid-19 cases and the government have had to step in with a promise to pay people's wages. This is all unprecedented stuff and will not be solved by creating another Jupyter notebook that tracks the cases of Coronavirus. These are challenges to the system that supports our way of life. So what we need to is find the people that are working to solve problems in logistics, economics, communications, transport, energy, social care and so on and ask if they need data produced or analysed, and help them if we can. If we can do this guided by their expertise (similar to my point on epidemiology above) then we will all automatically be so much more effective and our voluntary efforts will have more of an impact.

I have seen two great examples of this the other day (and I'd be keen to hear if you have found more!):

1. Crowd Fight Covid19 : This initiative is acting as a market place for scientists to help one another and collaborate. Why not see if anyone needs a data scientist or data analyst? From the site:

"Our proposal: This is a service for COVID-19 researchers. They only need to state a wish or a task, which can go from a simple time-intensive task to be performed (e.g. transcribe data, manually annotate images), to answering a technical question which is beyond their expertise, or to setting up a collaboration. They only need to explain their request in a few lines. Then, another scientist makes the effort of understanding that request and making it reality."

2. UCL made a call for mathematical modellers and data scientists to help them with their research. The call was filled up pretty quickly, but I bet you there are others like it out there. Seek these sorts of partnerships out!


If I was to summarise what I have been saying in a few bullet points it would be this:

  • Data skills can definitely help people during this crisis
  • Do not be an armchair epidemiologist, but by all means support epidemiologists (and other health care professionals) with your experience and skill sets. Most preferably under their guidance
  • Do work on tools to enable relevant professionals
  • Work on getting the public health messaging out there
  • Think laterally about the problems you can help solve. You may not think that helping the NHS work out who to send their most urgent advice to is as sexy as predicting the number of cases in a country, but you will definitely save more lives.

*I mean you might have .... but you probably haven't.


Space Travel - Some Thoughts

I've been reading a few books about space travel and humans living off Earth recently, the latest two being:

  1. Beyond - Our Future In Space by Chris Impey,
  2. Blue Mars by Kim Stanley Robinson.

And these have got me thinking about our near term prospects for travelling both within the solar system and beyond. This is a fascinating area, and one where experts know so much more than me, but I just wanted to pull together some of my thoughts on this from reading these (and other) excellent books and resources.

The Big Picture

Humans love to explore, Chris Impey's book has a really good chapter on this where he discusses the human journey from sub-saharan Africa. Where I didn't feel so comfortable was on some of his arguments around the biological determinism of some people's risk aversion vs others. He may have painted a sound picture of the science but I'd like to investigate more - I'm always very sceptical of claims like this. Anyway, the point he makes is that we, as humans, are always looking for the next frontier and that naturally this now means we are looking to explore the planets and stars.

In the medium to long term, it's also clear that being a multi-planetary species will increase our odds of long-term survival, since we (to borrow a software analogy) won't have a 'single point of failure'. We'll be more robust as a species to any extinction level events since these will almost always only occur at the planetary level.

In the nearer term, space also means big business and potentially a huge resource source for future endeavours. In Beyond, Impey covers this point a few times, highlighting ideas around mining asteroids for resources etc. What Impey is excellent at doing in this book is always caveating these ideas with reasonable calculations of required energy and financial expenditure. It's so easy to assume "we'll go mine the moon for Helium" without realising that it probably isn't worth the huge cost required.

Stanley Robinson's book's are also excellent on this point. There is no waving of a technological magic wand that makes colonisation (and later terraforming) of Mars look easy. Everything is painstakingly shown to be a series of small wins, each with (well explained) incremental improvements in technology and reasonable expenditures of time and energy. The only time where there is a bit of a 'hand wave' explanation for a piece of technology is in the 'gerontological treatments' developed in the first of the Mars trilogy books (Red Mars). These treatments allow for the large extension of human lifetime and create a whole host of interesting psychological, political and even economic considerations both on Mars and Earth, but as mentioned are not exactly 'near term' technology by the sounds of things. Then again, rapid progress in medicine and the current thrust for innovation in gerontology may prove me wrong in the near future, but I am definitely no expert in this area (this interview with Laura Deming in the FT was really interesting).


Big Rockets (Some Assembly Required)

I am always fascinated by questions around visiting and colonising other planets because to me, as alluded to above, it just seems so damn hardImpey highlights this fact with some interesting calculations around the required energy and fuel expenditure needed to get to the nearest stars.

For example, the first calculation is one done by NASA [1], apparently to get to a school bus size payload to Alpha Centauri in 900 years (Alpha Centauri is 4.37 light years from the Sun, so this is about equivalent to travelling at 0.48% the speed of light) would require more chemical rocket fuel than there is mass in the universe .... So no chance there really.

The next rung up in complexity / speculative tech becomes fission or fusion based pulse propulsion engines,  but apparently even a fusion engine would still require 1011 kg of fuel, or roughly "1000 supertankers worth", to get to our nearest stellar neighbour in under a millennium. So again pretty damn hard.

Even when Impey considers matter-antimatter rockets (loved by science fiction aficianados), and assuming 100% conversion to kinetic energy of the fuel, we're still talking about "the energy consumption of the entire United States for six months" to get a 2k ton space shuttle to Alpha Centauri in approx. fifty years .... As I said, travelling to another star is really damn hard.

Ok, so what happens if we rein in our ambition a bit and consider planetary rather than interstellar travel. This is where the Mars Trilogy comes in. When the 'first hundred' explorers set off on the Ares spacecraft, they are aiming to reach Mars using a Type II Hohmann transfer orbit in about 300 days. This is not far off what's typically deemed the time it takes to get to Mars using current technology, given a launch during the appropriate window, which can give you a travel time from between 9 months to 1.5 years [2]. So this means that it's definitely feasible to get to the Red Planet in a reasonable timescale. It still won't be easy due to having to deal with the psychological and physical challenges of travelling for that long in space but lets leave that to the side for the moment.

If we stick with that potential technology stack for the moment, how long will it take to explore the rest of the solar system?

A simple way to do this is to simply use the travel times for different probes we have sent across the solar system as a good base estimate. Missions with personnel may take different times for a variety of reasons but let's assume we can use these probe travel times as a useful approximation. This article lists a good number of bodies we've sent probes to, but here are some highlights:

  1. Venus - 15 months (Magellan mission). This is interesting as Venus is closer to us than Mars in terms of distance from the Sun, but this mission must have taken this long due to the choice of transfer orbit and departure window.
  2. Jupiter - 6 years (Galileo mission).
  3. Neptune - 12 years (Voyager missions). The voyager missions were designed to study the 4 gas giant planets (Voyager 1 Jupiter and Saturn, Voyager 2 Uranus and Neptune). Calculations in 1965 revealed that there would be a once in 176 year alignment of the planets that meant a single spacecraft could technically explore all four of the gas giants. Voyager 2 was launched first and then Voyager 1 launched a few months later in 1977. Voyager 2 was so named because it would reach Jupiter and Saturn after Voyager 1. The full timelines and a lot more information about the Voyager missions are given here in a pretty amazing set of resources from NASA.

It should be clear from these numbers than using our current technology, or something close to it, to explore the solar system will still be, yup you guessed it, pretty damn hard!

One ray of light coming from the Mars Trilogy books is (spoiler alert!), when late in Blue Mars 'fusion pulse propulsion' technology is developed (similar to that mentioned above in the discussion of Beyond). As I stated above, this still makes getting to nearby stars pretty hard but, as explored in the booked, it would act to drastically shrink the subjective size of the solar system. In the book, travel time between the planets goes from months and years to weeks and days, and drastically reduces or removes the need for complex transfer orbits. This acts to accelerate the development and intensify the political manoeuvering of the different colonies throughout the solar system, leading to a period of rapid expansion of the human races civilisational footprint known as the Accelerando. Now, don't get me wrong, the prospect of creating a pulsed fusion propulsion system is not one we can currently entertain for the near future, since we haven't even been able to generate sustainable net energy gain in a fusion reactor. This doesn't mean it is not attainable in the next few decades however, and if it does become feasible, it is clear that the implications for solar system travel are potentially more transformative than for the prospective of interstellar travel.


In summary, I'd recommend reading 'Beyond' by Chris Impey and the Mars Trilogy by Kim Stanley Robinson. Even if they tell you that space travel on the interplanetary and interstellar scales is pretty damn hard, they are still great reads packed with interesting science and fun speculation about what's possible in humanity's near future.


[1] I've linked to the page quoted as a source in 'Beyond', but it looks like the page no longer has the original calculation (it seems to have been archived).

[2] More information about transfer times to Mars in this article: https://www.space.com/24701-how-long-does-it-take-to-get-to-mars.html



Educating Clients about Machine Learning and AI

The responsibilities of a data scientist or machine learning engineer can vary tremendously depending your industry, the company you work for, the type of projects you typically work on and what stage of your career you are at. An important and, I believe, commonly overlooked skill that is key to master if you want to progress in your data science career however is ‘teaching the client’.

I know that there will be many ways of interpreting what I mean by this so I am going to focus on a very specific problem often faced by data scientists who have to map out the problem with clients (either internal or external):

How do you communicate the ideas, concepts and potential utility of machine learning and AI to non-experts in a way that:

  1. Empowers them to make decisions based on fact and not hype,
  2. Helps them understand the what is required to successfully implement machine learning and AI,
  3. Manages their expectations.

This is no easy task, but in this article I am going to share some of the things I have learned from discussing, designing and executing machine learning projects with a variety of clients and managers. Hopefully there will be something in my experience that you can apply to your own work!

WTF is AI, WTF is ML?

It is so important not to go in all guns blazing when explaining what may be a complex solution to a client. Focus on the high level concepts, what data you are using and, most importantly, if and how it solves their problem.

The best place to start with someone who has heard only tangentially about machine learning or AI is to try and define it for them. The key is not to go all heavy in jargon like these from wikipedia:

In computer science AI research is defined as the study of “intelligent agents”: any device that perceives its environment and takes actions that maximize its chance of successfully achieving its goals.[1] Colloquially, the term “artificial intelligence” is applied when a machine mimics “cognitive” functions that humans associate with other human minds, such as “learning” and “problem solving”

Machine learning is a field of computer science that uses statistical techniques to give computer systems the ability to “learn” (e.g., progressively improve performance on a specific task) with data, without being explicitly programmed.”

That’s not to say there is anything wrong with these descriptions, they are just a bit … academic. Some of the ways I’ve tried to explain machine learning and AI to clients is by saying something like the following:

You can think of the field of AI as simply the study of how we make computers behave, act and solve problems like humans or animals. Machine learning is a subset of AI where algorithms don’t have to be programmed with hard coded rules (‘if this is the case, then do that’) in order to solve a problem but they work out how to solve specific types of problem through exposure to data.”

Now admittedly this is quite similar to the above, but I feel that it’s a bit less intimidating for a non-scientist or someone new to the field (as most business managers and clients are likely to be!).

Another great tactic is to give examples/concrete use cases. For example, imagine you want to predict the number of umbrellas that you are going to sell in a shop because you want to make sure you have enough stock. You have a look at the data and it’s clear that when it rains, more umbrellas are sold. So you hard code a rule in your system that says ‘if weather forecast predicts rain, order 100 umbrellas’. That’s a very basic way to solve the problem but a client will clearly understand this as your “baseline”. You can then tell them that if you wanted to do this with machine learning, you take the data and tell a machine learning algorithm that the number of umbrella’s is the “target” and the other data are what can be used for predicting this target. The algorithm then takes in the data and produces a model so that when you feed it similar data to what you’ve fed it before (for example the day of the week, the weather forecast and how many umbrellas you sold over the past week) then it makes a prediction with a given accuracy. The first is you hard coding a solution, the second is a machine learning or data science solution.

This is a bit contrived, but I feel that a concrete example like this covers a lot of technical topics, like “targets”, “covariates/features”, “training/testing”, “lift” and even “autoregression” without splattering jargon everywhere. An example like this can be used in many contexts, and most people will get the transferability to any other prediction problem.

Can we get one of them AlphaGo’s? Managing expectations

The next thing you have to do is educate your client or partner on the reality of all of this cool capabilities. A lot of people will have seen AlphaGo beat Lee Sedol or computer vision software successfully count the number of faces in a crowd and think that your problem must be easy. It is very rarely the case.

To manage expectations, just tell the client what you think is feasible given what you know about their data and set up. If you have successfully completed projects with similar starting points before then you are onto a winner, since you can draw quite heavily on this experience and use it as an excellent example. Don’t panic if you haven’t though, managing expectations is still very doable.

First, always make sure people are aware that machine learning is really centred around doing one of the following:

  1. Classifying something — telling you what something is,
  2. Predicting something — telling you what is likely to happen,
  3. Grouping something — pointing out things which are similar.

The optional 4th point to add to this list is ‘Solving something — acting intelligently to achieve a goal’ (read ‘reinforcement learning’), but if the client is new to ML this could create more confusion than is necessary at this point.

Using these stripped back and simplified definitions of classification, regression and clustering then the client can hopefully see a bit more clearly mind than what ML is actually useful for, and they can reign in their expectations accordingly. They can also then hopefully see (with your guidance) that if an algorithm is good at classifying something (e.g computer vision counting faces), then it doesn’t mean the same algorithm can ‘predict something’ (forecast umbrella sales). This helps to highlight the fact that its ‘horses for courses’ when it comes to ML and there is ‘no free lunch’.

Secondly, always bring it back to the ultimate goal, which is to solve a given (business) problem for the minimum amount of investment (time, energy, money). If it is not going to be necessary to predict the number of umbrellas to 99% accuracy every day then it isn’t even worth thinking about. Reiterate the Pareto principle that in many cases ‘80% of the effects arise from 20% of the causes’, so past a certain point you’ll only get small gains for a lot more effort.

Finally, to help reign in expectations, it is sometimes important to highlight that when some company makes a big announcement about some new amazing machine learning system ,they are only showing you the sparkling whites and not their dirty laundry. Any of these highly publicised systems (computer vision as a service systems from cloud providers are one particular case) will have areas where it doesn’t apply, can produce erroneous results and often will have been the result of an army of people with a lot of resources focussed on producing this one particular tool. This doesn’t mean you can’t solve your client’s problem, it just means that they have to be aware that machine learning projects are like any other project, more ambitious goals will require more resource. It’s that simple.

We Are Stardust

Article originally published at http://isciencemag.co.uk/features/we-are-stardust/.

The human body consists of around 37.2 trillion cells, each made up of different kinds of molecules, and each containing several different types of atoms that are categorised into elements. These elements, built into molecules like DNA, RNA, enzymes, proteins, haemoglobin and others, constantly execute an array of processes within your body that keep you alive and functioning.

But where do all of these building blocks come from? The answer to this question may seem somewhat surprising. The simplest elements in the universe can be traced back to the Big Bang itself, but the majority of the elements inside our bodies can be traced back to processes that occur inside stars. We are all stardust.

Stellar Nucleosynthesis

Stars are huge thermonuclear power plants that release vast amounts of energy into space, mainly through the fusion of simple elements into heavier elements. For stars with a mass up to one and a half times that of our sun, the main process is the fusing of hydrogen to form helium. Energy released in this process counterbalances the effect of gravity such that as long as the star has hydrogen to burn, it does not collapse.

This process of nuclear fusion occurs in most stars over periods spanning billions of years. Our Sun has been burning hydrogen for around 4.5 billion years, and we estimate that it has about another 4.5 billion years of fuel left. Although the main nuclear reaction occurring in the star produces helium by fusing hydrogen atoms, sometimes the reaction goes further. In the core of stars with masses close to that of the Sun, helium atoms can fuse together to create beryllium, which can then fuse with helium to create carbon, the most important element for life on Earth. Heavier stars (more than eight times the mass of the sun) can create even heavier elements, such as the calcium and iron that are integral for your body to function.

Stellar Death, Terrestrial Life

As a star runs out of fuel and reaches the end of its life several things may happen, depending on its mass. If a star is large enough (about greater than three times the mass of the Sun), after it has used up its hydrogen fuel it begins fusing helium in a cooling, expanding outer shell. These ‘Red Supergiants’ continue burning for around a million years or so before instantly collapsing under their gravitational interactions. This collapse causes one final rebound due to energetic interactions within the core and the star explodes into a spectacular ‘supernova’, throwing elemental products out into interstellar space.

Smaller stars (of about the same mass as the sun) also expand as they use up their fuel. However, the end of their lives is a much tamer affair as they shed off their outer layers into a ‘planetary nebula’ – a cloud of dust that surrounds the core.

The dust that is left in the aftermath of stellar death contains a wide variety of elements, including those very heavy elements produced during the end stages of the star’s life. This interstellar debris then begins to collect under its own gravity: swirling, colliding and clumping together to create large pockets of gas which will eventually collapse under gravity to produce a new star. The heavier elements will similarly collect to produce rocky material and eventually form planets like the Earth. The elements that were created inside the star and expelled at the end of its life then reside throughout the planets formed. The majority of the time, these elements will have combined to form complex compounds, found as minerals in the Earth’s crust.

As life evolved on this planet, it used the raw materials in these compounds to build sophisticated biological systems. Fast forward approximately 4.5 billion years and you have the huge cornucopia of plant and animal life that we observe on Earth today, including ourselves. So whenever you think of the origins of life on this planet, and think of the origin of the parts that make up your own body, remember that you should thank your lucky stars that you are here. Literally.

Images: Tycho Supernova Remnant (NASA).

Sun, Waves and Carbon - Quick Points on Energy in 2018

A quick look at some of the trends and issue to watch out for in 2018 in energy and environment:

Solar Power

Solar power has been expanding rapidly these past couple of years due to advances in technology and uptake meaning that it is now cheaper than traditional fossil fuels . In fact, the drop in price of solar (and wind) energy infrastructure has been such that a study in late 2017 pointed out that it is actually cheaper to install new solar and wind energy that it is to run (already built) coal and nuclear power plants.

Projections for 2018 suggest that this positive trend will continue, with new  global solar installations expected to exceed 100 GW for the first time ever in 2018, with China dominating demand.

I also have to mention that it looks like the first commercial distribution contract for perovskite solar cells (which my PhD is on) has been signed between Saule technologies and Skanska group. This is an exciting step forward for a technology with huge potential which has continually had major questions asked about its commercialisation potential.

Wind Power

Although wind power often gets lumped into discussions about solar (I committed this same sin in the previous paragraph) it is important to note that the wind energy sector is different and has its own challenges and opportunities.

Among the opportunities are exciting developments like a report from the Global Wind Energy Council in Oct 2017, which suggested that wind could account for 20% of global energy capacity by 2030. There have also been some ambitious projects proposed like the super-sized North Sea wind farm Dutch Power are looking to build, with a possible generating capacity of 30GW and complete with its own artificial island.

I personally feel that the growth of offshore floating wind farms will be a very interesting trend, as explained in further detail in this report by Willis Towers Watson, a huge amount of potential wind energy is located above deep sea locations. For example, that report states that

"80% of the offshore wind resource in Europe is located in waters deeper than 60 meters and has a potential capacity of 4,000GW."

As a Scot, I'm also proud that the first offshore floating windfarm (a 30MW project run by Statoil) was opened off the North East coast of Scotland in Oct 2017. It will be exciting to see more projects like this come online both in Scotland, Europe and the rest of the world in 2018.

Carbon Trading

Finally, as I am currently reading "Earth: The Sequel" by Fred Krupp and Miriam Horn , which is an interesting though slightly outdated look at different enterprises in renewable technology and argues heavily for a carbon cap and trade scheme, I thought I'd finish with a point on carbon trading in 2018.

As this brief article on the David Suzuki Foundation website highlights, there are two clear ways to incorporate environmental damage due to release of carbon dioxide (or indeed other greenhouse gas emissions) into our current economic model that do not require governments attempting to choose specific technologies to back through subsidies: a carbon tax or a so called "cap and trade" scheme.

In a carbon tax model, every unit of CO2 emitted is taxed at some fixed rate. For example, in Sweden the rate is currently $150/tonne of CO2 emitted. This directly discourages the burning of fossil fuels and other activities which emit greenhouse gases and therefore stimulates the growth of the renewable sector. Of the two models, this is the easiest for governments to implement.

In a cap and trade system, the government sets an 'emissions ceiling' which the entire economy must fall below. Emissions quotas are then divided out among potential polluters, for example through auction, and polluters cannot exceed these quotas. If they do then they must buy pollution quotas from other parties who have spare quota to sell in order to cover the difference. As time progresses the government successively lowers the cap, thus reducing the overall emissions produced by the economy. This encourages polluters to reduce their carbon emissions so that they can potentially sell there remaining carbon quota on the market, the market of course also acting to set the price of these quotas. The cap and trade scheme allows businesses the freedom to choose how they reduce their emissions whilst also providing a direct economic incentive to do so.

Of these two I like the idea of cap and trade systems best, as the cap itself provides a certainty about the total amount of greenhouse gas emissions that will be emitted. To my mind this is the clearest way to lower carbon emissions as in line with the reductions agreed to in the Paris Climate Agreement.

Due to my interest in this, it was exciting to hear that China are moving to introduce a carbon cap and trade scheme which it is believed could reduce their peak emissions timescale from 2030 to even earlier. Since China having its peak emissions by 2030 or earlier will be key to the world meeting the Paris Climate Agreement targets of less than 2 degrees warming above pre-industrial levels, I think this is great news.

How did Newton know it was an inverse square law?

I passed a sign in Glasgow today** that told me I was on "Newton Street". I've passed it hundreds of times on my way to the Mitchell library, which I've been frequenting a lot as I race to finish my PhD thesis, and never noticed it before. This got me thinking about good ol' Isaac and his phenomenal contribution to our understanding of gravity. As a physicist, Newton's laws and theory of gravitation are among the main first lessons you learn at University (and even at school). Specifically, we learn that the force between two objects with masses M and m is proportional to the product of these masses and inversely proportional to the square of the distance between them, or in mathematics

Now, the more I think about this formula, the more something puzzles me. I can understand the supposition that the force is proportional to the mass of each object, it makes sense that a more massive object would provide more gravitational interaction than a smaller one. You could rationalise this from observing the solar system through telescopes since Galileo's day - larger planets have more moons and the Sun has everything in the solar system orbiting around it. And if you know it's proportional to some power of the mass, why not just assume the linear relationship (i.e no powers of 2 or 3 etc, I'm supposing this is how Newton's thinking went but the reasoning behind the linear dependence on mass may have been more subtle than this). But how did he know that the gravitational force followed an inverse square law? I think answering this question will be an interesting exercise in showing people how the scientific method works when applied to theoretical physics (I would argue that Newton's law of gravitation is the first example of pure theoretical physics that actually worked!).

Well, it turns out it seems that it's not too difficult to see where it comes from. The realisation that gravity came about from an inverse square law was through Newton doing the following:

1) supposing that gravity was universal, i.e the same law was responsible for an apple falling to Earth and for the moon orbiting the Earth and

2) knowing that he could rely on the most up-to-date observational data, which suggested that objects fell towards the Earth with an acceleration of 9.8 ms-2 and that the moon was accelerating towards the Earth at a rate of 0.00272 ms-2.  He also had to know that the moon was approximately 60 times further away form the centre of the Earth than the surface of the Earth was to the centre of the Earth.

Taking these two observations together Newton could just take the ratio of the two accelerations and observe that they are proportional to the relative distance squared

By the way it useful to note that taking a ratio like this is often a very clever idea, since it means that all the other stuff in Newton's law (which he didn't know yet!) cancels out, so he only needs to focus on the stuff he does know about (the accelerations and distances).

So this is a basic bit of theoretical physics (using your 'noggin' to work something out about how the universe works), but it is important to realise that Newton, and indeed all theoretical physicists, can't do this on their own. Remember, Newton had to rely on experimental data to feed into and check his reasoning. Theoretical physics without reference to experiment is not physics, it is just mathematics. This is important to remember, especially when you read articles in newspapers or popular science magazines about "genius theoretical physicists makes new discovery" - think Stephen Hawking, the people at CERN, Albert Einstein - they didn't, and couldn't, have done it without the most important thing in physics, experiments.

To continue this idea that theory isn't everything in physics, in a future post I will discuss how physics now has three "pillars", whereas before it had two,  theoretical, experimental and computational. Until then, Tschüss!

** Note: I wrote this aaages ago and forgot to publish it ... I'm no longer going to the Mitchell library every day.