My path to machine learning

The Institute’s Data Analytics Strategy Consultant, Rob Daly, shares his passion for data and tips on how you can become a data scientist. 

Data analysis is at the core of actuarial work and always has been. When I started my career, I recall my boss, Tom, having a tense conversation with the systems people as to the importance of keeping old policy records to do lapse analysis. That was in the day when storage was expensive, and the systems area wanted to save money by deleting old records. Tom knew the importance of this data to the company and argued well to retain it. All the actuaries I know have similar stories about data and their quests to improve it.

Three years ago, I took some time out to do a Masters of Economic Analysis and it was an eye-opener into how public policy is shaped. The quality of analysis that goes into policy decisions in Australia is strong and government departments and their ministers know how important it is. We are seeing this with the current COVID-19 response. The course showed me how economics had advanced since I last studied it at school and really improved my statistics knowledge. I learnt the latest techniques for dealing with missing variables and hard-to-estimate outcomes. These could all be applied to actuarial work. For instance, we believe that motivation impacts return to work but you can’t measure motivation directly. Instead, could we figure out proxies and ‘instruments’ to estimate motivation?

Throughout the course there was intriguing references to non-parametric techniques and a mysterious course that could help explain these. My interest was piqued and last January, I started a course on Machine Learning that revealed these mysteries. It taught me how to make a computer correctly identify the difference between a shirt and a dress (harder than you think) and how to make a picture of a red panda smaller. It also explained what a neural net is and how to convolute and recombine them. I have now just finished a course at Stanford that taught me how a computer can understand language.

Here are some thoughts on how you too can become a data scientist. Graduates from data science degrees (that is data scientists) are armed with an in-depth knowledge of coding, statistics and machine learning. New actuaries are being taught all three techniques and can be data scientists. Even if it’s been some time since uni, your actuarial mindset is well suited to adopting data science techniques. Trust me – it’s not so hard once you get started.

Coding is a learned grammar that is used to instruct computers to do things. Becoming a coder is like learning a written language without the complexity of actually speaking the language – much as I learned Irish and French at school! First you need to understand the rudiments of the grammar and learn a basic vocabulary, then practice until you learn to solve more and more complex problems. Initially, you fumble around using google searches to remind yourself of the name of a function or how ‘lists’ have a different grammar than ‘sets’. As time passes, you remember more and more and become proficient.

The Actuaries Institute has recently promoted DataCamp as a way to learn coding online that is relevant to data science and there are many other options (e.g. EDx, code academy). If you prefer the written word both O’Reilly and ‘for Dummies’ book series have many good options. For even cheaper options (free!) look at the Python beginners guide at I also quite liked the rigorous approach in ‘Learning Python the hard way’ but must admit I did not complete it! will become your favourite website.

Like many actuaries, I started my career coding Fortran to run projections on a mainframe. Then spreadsheets took over, starting with VisiCalc (anyone under 40 will need to look that up!) and then new software called Excel. With the advent of actuarial and modelling software, many actuaries stopped coding. Even still, once you know how to code everything else becomes easier. So, if you coded in the past dust off those skills with one of the courses above.

Actuaries are already well versed in statistics. You may want to brush up on the topic such as I did with the economics course. To be honest, it’s not essential as you can apply machine learning without knowing the theory. However, sometimes it’s good to know how the engine works, not just that it does. Wikipedia is your friend here as there are some excellent articles and a google search will fill in the gaps. If nothing else read up on linear algebra (especially if you want to make red pandas smaller!).

Machine learning has a long history in computer science with Arthur Samuel coining the phrase in 1959. Look for his paper on Google Scholar to see how he taught a computer to play checkers (or draughts). It shows the basics of using lots of examples to teach a computer. Progress on machine learning has been a mixed bag with great advances in some areas (e.g. chess) but still some way to go in others (e.g. natural language understanding). Machine learning has seen rapid progress in the last few years such as driverless cars and personal assistants (e.g. Siri, Alexa).

In a nutshell, machine learning is the process of defining a problem, selecting a model, finding lots of training data, training the model and finally testing it with real world examples. This sounds similar to the control cycle. All these steps require a person to do them, that is to apply intelligence. You are guiding the machine that then learns in a more limited capacity.

The problem needs to be defined as precisely as possible to get good outcomes. For instance, the problem of describing what is in a picture is much harder than “can you see a car in this picture”. Model architecture has advanced a lot recently. Greater computer power allows very complex models to be constructed. Modern techniques such as random forests and convoluted or recurrent neural nets can produce uncannily good models but often require significant volumes of data. Finding the training data is always a practical constraint, particularly if humans are needed to label outcomes to help train the computer. This can be an issue in actuarial work if there is insufficient data to train the model and a statistical uplift to an existing actuarial technique may be a better solution.

Training the model requires a solution for a complex set of mathematical calculations. The model I just used in a natural language task had 110 million weights or parameters in it and was trained on the whole of Wikipedia (I didn’t do the training – some smart people at Google did). One common technique is to iterate the model using stochastic gradient descent, a technique that is based on Newton’s 300-year old method of solving equations. It’s a wonderful technique and the steps are: guess an answer, calculate the outcome (the ‘forward pass’), determine how wrong you are (the ‘loss’), work out the slope of the outcome (this is the ‘gradient’ using calculus), improve your guess with the loss and the slope (‘backwards pass’) and repeat with the hope that you ‘descend’ to the right answer. The stochastic part refers to the fact that this works if you do it for a random sample of your data which is a much more practical approach than repeating it for all the data every time. Before you panic about doing this yourself, remember that most of the code you need is freely available on the internet (again those people at Google, Facebook, Python, Hugging Faces and many universities).

There are many ways to get started on the road to data science. A colleague of mine (who is a lawyer) started by entering Kaggle contests and greatly enjoyed the process. If you want a more structured approach, there are plenty of courses (like DataCamp, or the Stanford course at Coursera) to consider. Or maybe just download R and start working through Hadley Wickham’s tutorial at The Actuaries Institute is building more machine learning into their content too. The most important step is to start, so you can put your skills to work helping your employer, your clients and the public, as a whole.

Free DataCamp courses available until Friday 22 May

For a limited time, DataCamp are offering free online courses until Friday 22 May. This is a great opportunity to test drive the full range of data science, machine learning, R or Python courses which are available. Don’t miss out on this unique offer and view the full list of courses.

CPD: Actuaries Institute Members can claim two CPD points for every hour of reading articles on Actuaries Digital.