Former UK.gov IT man and Python king's guide to neural networks

Tariq Rashid on programming AI

Brain image via Shutterstock

Interview If you're going to learn about neural networks, you could do worse than learn it from someone who got five A levels (all grade As), has his MSc in Advanced Computing, and can tell you how to build your own neural network in 30 lines of code, even if you don't know any calculus.

There aren't many people fitting that description, but we know one.

Tariq Rashid, former lead enterprise architect for data analytics capability at the Home Office, has turned his attention to the topic in his book Make Your Own Neural Network.

But how did a chap who spent the last seven years promoting open-source software in the UK government, a place where IT comes in big boxes and mega contracts and then invariably runs late and over budget, come to write a "how-to" book on something as happening and now as AI?

El Reg first encountered Rashid back in 2011, when he was advocating open source in government. He spent his time there helping to steer its IT policy in the direction of open source through two elections, and occasionally surfaced to talk about how the government was missing a trick by not exploring the concept more closely.

Before he worked as lead architect at the Home Office, Rashid spent five years on and off working as a scientist in nuclear graphite physics at BNFL Berkeley (did we mention he got another masters, in physics, from Cambridge?). He moved to London and worked at a startup, then spent a spell at Easynet before a year as an IT architect and manager at Barclays Investment Bank. He jumped to a government job in 2009.

"There's a marked difference in speed between the private and the public sector," he says. "The culture in government isn't fast-moving or fast-changing." He spent a lot of his time gently pushing in the right places to change that culture.

"It hasn't been hands-on technical, it's about modernising the way government works." One of his remits involved improving security, and this brought other wins that he says made things easier for government employees.

For example, in 2014 he led a project to modernise how the public sector thought about securing devices. That enabled them to expand from using just BlackBerry devices into support for Android, iOS and Chromebooks. "I was proud of that," he adds. Around 700,000 public sector workers in the UK must follow the government's policy framework around mobile devices, so changing it expanded their options.

Three words: Secret Python fun

While transforming policy is rewarding, it didn't satisfy Rashid's inner geek. It turns out that he's just as interested in neural networks as he is in making the Cabinet Office more open-source friendly. His masters in Advanced Computing focused on machine learning and data science, and he never lost that interest.

"If your day job doesn't do it, you tend do it outside work," he says. He attends meetups and other technology networking events, and also hosts his own groups. His London Python meetup has attracted nearly 4,000 Pythonistas, and Rashid also organises meetings around algorithmic art.

There's a lot of interest in artificial intelligence, but there aren't many people who are good at teaching it. "It just isn't that well explained," he says. "There isn't that much effort in taking content and putting the effort and work in to make it accessible."

This is what prompted the neural networking book, which he self-published on Amazon in March 2016. He had already written another, teaching people how to create Mandelbrot fractals as an introduction to some of the underlying mathematics.

"I didn't really raise awareness of the first book; it was more of an experiment for myself to see how the process worked," he says.

Both got solid reviews on Goodreads, but the neural networking book struck a chord with readers. It has been in the top three in its own categories on Amazon for almost a year, receiving an Amazon #1 best-seller badge. Tech publishing house O'Reilly bought the German rights, and it is now being translated into Korean, Japanese, Chinese and Russian.

Most instructional books throw you in at the deep end with some mathematical heavy lifting that can be daunting even for professional programmers. This book relegates the maths to an appendix on calculus that the average 15-year-old could understand.

The idea behind the book is that anyone can learn to code a neural network. To this end, he divides the main body of the book into three parts. The first introduces the concept of neural networks, while the second gets into the detail of implementing it. The third part explores more ideas, such as creating your own training data and working out how your neural network made a decision.

Accessibility is Rashid's main focus here. This, along with his general interest in the language, is why he uses Python as the language for the book. The implementation section introduces people to the language from scratch.

"Python was never designed to be particularly good at number crunching," he points out. "It wasn't particularly designed to be good at AI. It was a general language, and its unique standout thing was that it is easy to learn, easy to understand and easy to read."

Accessibility is one of Python's biggest qualities, making it a common tool in teaching kids to code, which is another of Rashid's passions. His own eight-year-old is a Python coder too.

"Python is the shortest distance from an idea to working code," says Rashid, who has been using Python since 1998. That's important in AI-related fields like machine learning and deep learning, where the workflows involve lots of tweaking and training.

AI developers will change some parameters in their training data and tweak their neural network models before retraining the data and analysing the results. A language like Python that makes the tweaking easier is a powerful asset.

There is another reason why Python became such a popular language for AI, Rashid adds.

"If there's any kind of speciality, it can be built separately as libraries. It's now the de facto for that because of the system of libraries and tools that you can add onto Python." He cites Numpy, the library for handling complex data structures, scikit-learn, the machine learning library, and the natural language toolkit as examples.

There's a Python library for most things. If you needed to save a princess in Python, something like:

import princess

princess.rescue(castle)

would probably sort it.

Sponsored: The Joy and Pain of Buying IT - Have Your Say


Biting the hand that feeds IT © 1998–2017