How I started with learning AI in the last 2 months

Written by shivalgupta | Published 2017/09/15
Tech Story Tags: artificial-intelligence | machine-learning | startup | entrepeneurship | deep-learning

TLDRvia the TL;DR App

Beginning with the most important skill of the 21st century

Everyone is very busy these days. There is just so much going on with our personal and professional lives. On top of it, lo and behold, something like artificial intelligence starts to gather steam and you learn that your skillset is getting terribly outdated over next two years.

When I shutdown my startup Zeading, I woke up to this rude awakening. It looked like was missing out on something very unique.

The relevance of a full stack developer will not be enough in the changing scenario of things. In the next two years, full stack will not be full stack without AI skills.

It was time to take action. And I did what I thought was the only course of action to take now — to update my skills as a developer, my mindset as a product guy and my philosophy as an entrepreneur to become data oriented.

As Spiros Margaris, renowned venture capitalist and thought leader in AI and Fintech so eloquently said to me,

If startups and companies rely only on cutting-edge AI and machine learning algorithms to compete — it will be not enough. AI will be not a competitive advantage but a requirement. Do you hear anyone saying they use electricity as a competitive edge?

Building my first neural network

Photo by — Unsplash

The common advice was to sign up for Andrew Ng’s course on Coursera. It is a great place to begin but I found it hard to stay awake for long. Not to say that the course was bad or anything, but I really suck at staying attentive in lectures. My mode of learning has always been by doing, so I thought why the hell not, let’s implement our own neural network.

I did not jump straight to neural nets because it is some better way to learn. I was trying to familiarize myself with all the words in the domain so I can learn to speak the language.

The first assignment is not to learn. But to familiarize.

Coming from a pure Javascript and Nodejs background, I didn’t want to switch stacks just yet. So I searched for a simple neural net module called nn and used it to implement an AND gate with a dummy input. Inspired by this tutorial, I chose the problem that for any three inputs X,Y and Z the output should by X AND Y.

var nn = require('nn')var opts = {layers: [ 4 ],iterations: 300000,errorThresh: 0.0000005,activation: 'logistic',learningRate: 0.4,momentum: 0.5,log: 100}var net = nn(opts)

net.train([{ input: [ 0,0,1 ], output: [ 0 ] },{ input: [ 0,1,1 ], output: [ 0 ] },{ input: [ 1,0,1 ], output: [ 0 ] },{ input: [ 0,1,0 ], output: [ 0 ] },{ input: [ 1,0,0 ], output: [ 0 ] },{ input: [ 1,1,1 ], output: [ 1 ] },{ input: [ 0,0,0 ], output: [ 0 ] }])

// send it a new input to see its trained outputvar output = net.send([ 1,1,0])console.log(output); //0.9971279763719718

Such happiness!

In my personal opinion, this was the most confidence building step that I had taken. When the output flashed as 0.9971, I realized that the network learned how to do an AND operation and ignore the additional input on its own.

This is mostly the gist of machine learning. You give a computer program a set of data and it adjusts its internal parameters in such a way that it gains the ability to answer questions on new data with a decreasing error from what it observed from original data.

This method, as I would later come to know, is also known as gradient descent.

Photo by — Sebastian Raschka

Priming my mind for artificial intelligence

Photo courtesy — Unsplash

Once I was brimming with confidence after I had made my first artificial intelligence program, I wanted to know what more I can do with machine learning as a developer.

  • I solved a couple of supervised learning problems such as regression and classification.
  • I used a very limited data set to try to predict which team will win a given IPL match using multivariate linear regression. (The predictions were really off, but it was kind of cool)
  • I played along with the demos on Google Machine Learning cloud to see what all things AI can do today (well enough that Google was doing it as a SaaS product)
  • I stumbled upon AI Playbook, an awesome resource organized by Andreessen-Horowitz, the esteemed venture fund. Truly one of the most handy resources for developers and entrepreneurs.

  • I started watching Siraj Rawal’s awesome channel on Youtube that is centered around Deep Learning and Machine Learning.
  • I read this awesome Hacker Noon post about how the showrunners at Silicon Valley built the Not Hotdog app. This was one of the most approachable examples of deep learning that we can do.
  • I read Andrej Karpathy’s blogs, who is Director of AI at Tesla. Even though I couldn’t understand anything at much and it gave me a headache, I found out that after trying for some more time the concepts do actually begin to make sense.
  • With some courage, I started to implement some of the deep learning tutorials verbatim (copy and paste) and tried to train the model and run the code on my local machine. Most times, it sucked because of the high training time most models take and I didn’t have a GPU.

Gradually, I switched my tools from Javascript to Python, and installed Tensorflow on my windows machine.

This whole process was centred around passively consuming contents and building references in your mind so I can use later when I get a real consumer problem to work on.

As Steve Jobs said, you can only connect the dots looking backward.

Catching the chatbot train

Photo by — Unsplash

Being a major fan of the movie Her, I wanted to build chatbots. I took up the challenge and managed to build one using Tensorflow in less than two hours. I outlined this journey and the business needs of it in one of my articles a few days back.

Fortunately, the article got really went viral and was featured in TechInAsia, CodeMentor, and KDNuggets. It was a great moment for me, personally, because I’ve just begun with tech blogging. But I think that this article was one of the landmark moments in my AI learning journey.

It got me to make many friends on Twitter and LinkedIn, with whom I can discuss AI development at length and depth and can even reach out should I get stuck. I got a few offers to do consulting projects and the best part of all, young developers and AI beginners started to ask me how I began with AI.

Which brings us to why I’ve written this article. To help more people take cues from my own journey and start their own.

Starting is one of the most challenging parts of any journey.

Salt and pepper

Photo by — Unsplash

It was definitely not easy. When I started getting stuck with Javascript, I jumped to Python almost overnight and picked up how to code in that. I started to get irritated when my models won’t train on my i7 machine or when even after hours of training, they would return gibberish results like a 50–50 probability of a team winning a Cricket match. Learning AI is not like learning a web framework.

It is a skill that requires awareness of what is going on at the microscopic level of calculations and find what is more responsible for your output — your code or your data.

AI is also not just one subject. It is an umbrella term used for anything from simple regression problems to killer robots that are going to kill us someday. Like every other discipline you get into, you might want to cherry pick the kinds of things in AI you want to be really good at like computer vision or natural language processing, or God forbid, world domination.

In a conversation with Gaurav Sharma from Atlantis Capital, a reputed industry leader in AI, Fintech, and Crypto, he confided to me that:

In the age of artificial intelligence, “being smart” will mean something completely different. We need people to perform the higher-order critical, creative, and thinking and the jobs that require high emotional engagement.

You have to be fascinated by how computers suddenly learn how to do things on their own. Patience and wonder are the two key principles that you should cling.

This is a big, big journey. Very tiring, very irritating and exceptionally time consuming.

But the good part is, like every other journey in the world, this one also starts with a single step.

Thanks for reading :) If you enjoyed it, hit that clap button below as many times as possible! It would mean a lot to me and encourage me to write more stories like this

Let’s also connect on Twitter, LinkedIn, email or at my blog shivalgupta.com


Published by HackerNoon on 2017/09/15