🤖 Building AI Using Pen and Paper

avatar

Artificial Intelligence, or AI for short has taken the world by storm. Every major company now uses some form of AI. This makes it even more important to grasp what AI is.


src

The history of AI, and where we are now

It may surprise you to learn that AI has been with us since 1952. It is not a new concept by any standards and a lot of our theories were postulated ages ago.
What’s changed is the amount of computing power and data we have at our disposal to bring into existence these wonders.

The (bare) basics

AI is simply decisions made by a computer. Nothing less and nothing more.
While this definition is indeed broad, it serves a satisfactory base for our futher reasonings.

Now, let’s break the two words to further distil.

  • Artificial: Anything that is not natural (or organic if you will) is artificial
  • Intelligence: Intelligence is the ability to adapt and learn from situations

That’s it! AI is simply a computer program makes predictions on data.
Therefore, even a series of if-else statements constitute AI; as we’ll soon see, there are far more fun ways to build predictors.

AI is an umbrella term

AI is a broad term used for any smart program. As we’ll soon see, there are many different subsets to this. Please take a look at the following exhibit:

src
Deep Learning branches into many different fields that are not shown here.

Let's build a simple predictor with pen and paper!

To demonstrate how simple AI really is, let's begin with a very simple prediction problem. Consider the following data:

Years WorkedSalary ($)
11000
22100
32900
44200

Now answer this:

What salary should you expect after working at this company for 7 years?

By intuition, the answer is likely to be in the ballpark of $7000. But how did you know this? You looked at the data, and basically extrapolated the next sequence.
Very clever of you.

AI is great for a linear problem like this one because of high correlation between the two variables. When the correlation is closer to zero, linear regression becomes useless.

Linear Regression

Time for some super quick math. To calculate slope:

and to calculate bias (or Y intercept)

src

Let's understand the variables:
x̄: Mean of x's
ȳ: Mean of y's
x̅y̅: Mean of {g : Result of xy ∈ (years_worked, salary)}
(x̄)²: x̄, squared
x̅²̅: Mean of {x : x ∈ years_worked}
mx̅: Slope × x̄

After some calculations, we get the following:
x̄ = 2.5
ȳ = 2550
x̅y̅ = 7675
(x̄)² = 6.25
x̅²̅ = 7.5

Finding Slope
m = ((2.5 * 2550) − 7675) / (6.25 − 7.5)
= −1300 / −1.25 = 1040
Finding Bias
b = 2550 − 1040 × 2.5 = −50

We have our slope and bias!

The equation thus is:

y = 1040x − 50

Testing it

Coming to our earlier question, what will my salary be after 7 years of work? Let's ask the machine 🤖
y = 1040 × 7 - 50 = $7230
Not too bad!

Appreciating what you've just done

Notice that our little equation satisfies all characteristics of an AI:

  • It 'learns' from data
  • It makes predictions
  • If you run it as a program, it's also artificial!

Limitations

Looking at this, it's immediately obvious that our regression won't work very well for data like this:

Years WorkedSalary ($)
11
24
39
416

Linear regression lines are unable to fit on exponential data. We need something more complex.

Also, the amount of data you have also matters, very little data will lead to the line fitting poorly, leading to extreme predictions.

Where to go from here

Now that you know how AI works and limitations with simple models, you can move onto more complex models like neural networks.


The field of AI and ML in general is hot. New discoveries and applications are being found regularly, some plain stupid, others magical.
What a time to be alive!

Thanks for reading till the end! 👋
@rxge



0
0
0.000
5 comments
avatar

Congratulations @rxge! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

You distributed more than 1000 upvotes. Your next target is to reach 1250 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @hivebuzz:

Hive Power Up Day - The countdown is ticking
Hive Power Up Day - Let's grow together!
0
0
0.000
avatar

Hi @rxge that is AI so simply and beautifully explained
the topic of your post got me attracted and the post is an interesting read.

0
0
0.000
avatar

Dear @rxge

I usually love topics related to technology and AI and I kind of enjoyed yours, however I must admit that seeing all those equations made me initially worried ... worried that I won't understand a bit from this post :)

I also found it a bit amusing to realize, that you managed to compact "history of AI" into 3 sentences hahaha. Not much of a history, isn't it? :)

ps. please remember to set up beneficiary to ph-fund (instead of project.hope) in the future :)

Yours, Piotr

0
0
0.000
avatar

Greetings dear @crypto.piotr

This article was more technical than historical - Project HOPE boasts many articles on the history of AI.
The lack of hands-on articles is bad, since our more technical readers don't want to read a shallow and bland article on AI, but rather go in-depth on how it works, the math behind it, and so on.

Also, apologies for setting up the wrong beneficiary, haha.

Thanks for reading!

0
0
0.000