🤖 Building AI Using Pen and Paper
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.
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 Worked | Salary ($) |
|---|---|
| 1 | 1000 |
| 2 | 2100 |
| 3 | 2900 |
| 4 | 4200 |
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)
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 Worked | Salary ($) |
|---|---|
| 1 | 1 |
| 2 | 4 |
| 3 | 9 |
| 4 | 16 |
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
Leave 🤖 Building AI Using Pen and Paper to:
Read more #technology posts
Best Posts From RXGE
We have not curated any of rxge's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From RXGE
- DeFi, the technology for tomorrow
- 🤖 Building AI Using Pen and Paper
- If You Wear Glasses, You Should Read This
- This Person Does Not Exist
- Ask: What are you doing this week?
- Ask: What are you doing this week?
- You Can Be Identified By the Way You Type
- I Made a Tool to Find the Most Profitable Cash-out Strategy!
- Calm and Energetic Music to Listen to While at Your Computer
- How to Get a Free Domain With HTTPS