AI and Data Science for Dummies — Chat with Classmates
By: Praful Krishna
Tags: Machine Learning, Data Science, Neural Networks, Artificial Intelligence, Programming

These are my answers to questions about AI and its business practice, discussed among ~200 of my fellow classmates from IIT Bombay. They are modified slightly to protect privacy, to remove specific references and for better narration. This is the first part of a series of these posts. The second part discusses insights about ‘Why Doesn’t AI Work?’ , the third about ‘AI Hacks That Do Work.’ and the last about ‘Why and How to Get Started with AI.’

Data Science

At the simplest level data science is just that — a scientific analysis of data. In the fourth grade, when we all learned how to make simple graphs, we had become data scientists already.

You would think that I am exaggerating to make a point. Well, lookup Microsoft corporate strategy, and its focus on a new product called PowerBI — they are making a massive push on it as a way to cement Windows based systems in enterprises. Then look up demos they have for PowerBI. There is plenty available on YouTube. These demos talk about dash-boarding and how the extremely powerful software can visualize your darkest, deepest data to make excellent plots. And then tell me if a fourth grader can’t make those dashboards.

Of course, there is a lot more to PowerBI than making bar graphs, but the point is that even at that simplest level data science can be very powerful. Add mean and standard deviation to it, and you have covered almost everything in the world of business analytics. Sure, the size of data has bloated recently, particularly because of a take off in deployment of sensors and embedded devices (IoT). Still, your biggest intellectual problem as a data analyst is how to clean the various formats of data, rather than how to process it.

Artificial Intelligence

There is a small portion of data science world that focuses on using data to write better programs. Here is the intuition behind it. The simplest programs are ‘Do X’. They are very powerful and make up the foundation of the programming world.

Smarter programs say ‘If A do X else do Y.’ I don’t have to explain this, except to say that almost all programming in the last century, and most of programming in this, is as simple as that. Rules engines, and the so-called expert systems are but a set of chained, nested and looped if-else statements.

The breakthrough behind the field of artificial intelligence started with a simple question — can a machine automatically figure out the condition A in that statement and write these rules itself. We can convert ‘If A do X else do Y’ to ‘c = Cx if A else Cy’ and then depending on the value of c we can perform X or Y. Suddenly this is as simple as a classification problem. If we are given a set of pre-labelled data points, can we find a model, A, which can classify a new data point to Cx or Cy (or one of a number of classes in the generalized case)?

If we can do that then we don’t have worry about the if-else statements. All we need to do is to get that set of pre-labelled data points, also called training data, run the machine, and go home. We have learnt so many techniques to do classification from the fields of algebra and statistics — Naïve Bayes, logistic regression, decision trees, and what not.

Congratulations! If you have ever fit a line to some data, you have programmed an artificially intelligent system.

Why is this important?

So, what’s the big deal? Three things — one, this is a big deal by itself. You have no idea how many artificially intelligent systems seldom use anything more than probabilities. If you want to get more complexity, a popular machine learning algorithm is called Random Forest. It involves making decision trees based on multiple samples of the data, hence the forest, and then taking the mode or the median of the decisions by each of the trees. It’s pure statistics, nothing fancy. However, this is now empowering almost every aspect of human life. Turn anywhere, and it is likely that an intelligent machine like this is helping you along.

Neural Networks

Second, they figured something called a neural network. Each node in this network is essentially a weighted sum. You take a set of inputs, you weigh each of them and you sum them up. Simple.

Let’s make it real. In the fourth year at college one of my friends John (name changed) was really trying to impress this girl, Jane (name changed), who was a co-volunteer at a non-profit called Magic Bus. Magic Bus works for under-privileged children and organizes various camps and events in its efforts. John’s decision tree to go or not to go to an event was simple — if she was coming, John would brave everything and go. Otherwise if the event was a party (vs. a hike or a camp) and it was not raining, John would go.

Let’s say a bright-eyed data scientist plotted John’s behavior over the year, he/she could have taken three binary variables, a = whether Jane was going to attend, b = whether the event was a party, and c = whether it was going to rain. It would be very simple to write an equation p = w1.a + w2.b + w3.c, and set a threshold to predict if John was going to that event or not. That is the simple neuron in data science that everyone seems so crazy about. With the right set of weights, it would predicted John’s behavior accurately.

Let’s say Jane was also deciding based on weather forecast and the type of the event. Then there are two independent inputs, one hidden layer with a node for her decision (+ two to pass original inputs) and then one node for the final decision. How about whether John was going to wear his new jeans or not — so now we are talking about two nodes in the output layer. You can see how quickly it becomes a network of neurons.

The important thing is that we need to find the right set of weights. There are multiple algorithms to automatically detect these weights based on a given set of inputs and corresponding outputs. Something called Gradient Descent rules the roost.

It turns out that neural networks can transparently replace most statistical classification algorithms. This is very powerful, because now you can focus on one technique for a wide variety of problems. We should be teaching neural networks in seventh grade instead of linear regression. With one hidden layer between input and output a neural network can also emulate any polynomial relationship given sufficient data. This is called Multi-Level-Perceptron-1 or MLP1.

Deep Learning

Does anyone remember Newton and his iterative method of finding answers? For complex equations of the type x = f(x), with x on both sides, you would assume a value of x for the RHS, compute x on the LHS and then use that value for the RHS, and so on. You would continue till the difference between the values of x in subsequent iterations was near zero.

Same deal here — why do we have to decide directly on the inputs? We will find interim values, and then use those values to find the next set of interim values, and after doing that 100 times will we decide on the output. In other words, you are adding more and more layers of neurons between the input and the output layer. This is called a Deep Neural Network, and process of training it is called Deep Learning. It is very useful for non-linear classifications, like predicting whether a set of pixels represents a nose.

Complex AI Models

Here is the third big deal with AI, and it’s not that intuitive. To make any neural network work we must train it and get the right set of weights in the network. Turns out that the weights itself contain a lot of value.

There is a very popular model in NLP called Word2Vec. It comes up with a set of numbers (a vector) for each word. Vectors for words with similar meaning will have numbers very close to each other. You can also do things like [King] — [Man] + [Woman] and get the vector for [Queen]. These vectors in fact are the weights from certain neural networks built for some task like predicting the next word.

Once scientists figured out how the weights in neural networks carry so much value, they went crazy. Many of the most advanced models are a stack of neural networks where the weights are passed from one to another to get very sophisticated things done.

The Promise

The promise is insane. Now, as long as you have sufficient data you can teach a machine to program itself and learn most sophisticated, convoluted, non-linear relationships. The beauty is that you don’t have to understand those relationships yourselves, let alone articulate them. You can now afford to be completely ignorant. It’s not hard to imagine in the near future machines will be collecting all the data and making all the predictions, while humans will be focused on making smarter machines. Take any problem, select some [hyper-]parameters of a neural network, go to bed. Now, in fact, they have begun automating the process of selecting these hyper-parameters as well.

That is the promise. The reality? Coming up.

Next part in the series: ‘Why Doesn’t AI Work?’