Tired of ads? Enjoy an ad-free experience by signing up.
  • Insights
    This article was written by a TIA community member. Insights pieces undergo the same rigorous editorial process that newsroom-produced articles have.
Shival Gupta · · 6 min read

How I taught myself AI in the last 2 months

developer-working

Photo credit: Sergey Galyonkin.

People are busy nowadays. There are a lot of things going on in our personal and professional lives. And lo and behold, something like artificial intelligence starts to gather steam, and you realize that your skill set is going to be terribly outdated in the next two years.

When I shut down my startup, Zeading, it was a rude awakening. I felt like I 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—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 told me,

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

Building my first neural network

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.  It’s not to say that the course was bad. I just really suck at paying attention to lectures. My mode of learning has always been by doing, so I thought, why the hell not implement my own neural network?

I did not jump straight to neural nets because 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 Node.js 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 be 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 output
var output = net.send([ 1,1,0]) 
console.log(output); //0.9971279763719718

Such happiness!

Priming my mind for AI

Catching the chatbot train

Salt and pepper

Stay ahead in Asia’s tech landscape

You've reached your 2 free content limit for the month. Sign up for free to read the full story.

🏄 For casual readers / 👶 Free

Basic

US$0

Free forever

Get instant access to this article and more every month

0 premium content

Unlimited news briefs

5

5 articles

Ad-free reading experience

Just US$0 per day

⌛Sign up in 20s. No payment details needed.

📖 For learners / 👍 Starter

Lite

US$4.92/month

Billed annually at US$59/year

Get instant access to this article and more every month

4

4 premium content

Unlimited news briefs & articles

Ad-free reading experience

Just US$0.17 per day

Cancel anytime

Our subscriber community includes professionals from these companies:

Stay updated on the go with our mobile app.

Get latest insights with smoother, more personalized experience through TIA mobile app.

Community Writer

Shival Gupta

Product enthusiast, entrepreneur and generally a nice person to be around.