Artificial Intelligence vs Traditional Programming

The future is Data Science, Machine Learning, and Business Intelligence. Data related jobs in the GCC have grown to over 80,000, with the average monthly salary of a data scientist in Dubai over AED 30,000 showing a 25% growth in the field since 2020. This article will introduce Artificial Intelligence (AI) and Traditional programming and compare the benefits of using each programming system. 

Introduction to Artificial Intelligence and Traditional Programming

Traditional Programming is a rule-based system, which means you need to know all the rules before you start programming. You have your own rules which you then make  into an algorithm and use that data. After that, you write your traditional programming, for example python coding, javascript, or more. You write your programming in your preferred language and you will get an output.

Let’s discuss an activity recognition programme. If you want to write a programme to know whether a person is walking, running, cycling, or anything else. In a traditional programming approach, you write your own rules. For instance, if it’s the speed of a person, you measure the speed.

You write your programming as: if(speed<4){status=WALKING;} or if(speed<4){status=WALKING;} else {status=RUNNING;} or if(speed<4){status=WALKING;} else {status=RUNNING;} else {status=BIKING;}.

You need to know all the possible outcomes or parameters, and based on them you make your algorithms and rules. 

In AI or Machine Learning, you have some answers and some data, then you use machine learning to get rules. So the difference is, in Traditional Programming you know the rules, however, in AI Programming the rules are your output.

In Traditional Programming, you start by studying the problem then you write the rules of that problem, and you evaluate the process. If something doesn’t work, you analyze the errors then repeat the process. Once you evaluate and it all works, you launch!

In the Machine Learning approach, you study the problem, then train the Machine Learning algorithm using your data.. Next, you evaluate the solutions, if there is a problem you analyze the errors and repeat the process. When it works, you launch.


Input: 0, 8, 15, 22, 38

Output: 32, 46.4, 59, 71.6, ?

When you input 0 you will get 32 as output. When you input 8, you will get 46.4, when you input 15 you will get 59, and when you input 22 you will get 71.6. If you input 38, what would be the output? The answer is 38! How? 

These inputs and outputs are from F=C* 1.8 + 32. In a traditional approach, if we want to solve this equation and find F and we know the C so we write a simple equation. In Python it would be:

Def function(C): F= C * 1.8 + 32 return F

Here you’re putting the input C as a parameter. 

In the Machine Learning approach, we have the data, which is the input, and we know some of the outputs. So we create a model and train it using the data. The model will learn from the data provided and it will give us the rule. Which would be the F = C * 1.8 + 32. Sometimes it won’t be 100% accurate but it would be close to reality. What happens during the prediction, the model itself creates an algorithm by itself. The model figures it out and gives an assumption on the rule. 

In a Google Collab, we use functions for machine learning and data science purposes. Example of Traditional Programming:

Def fun(c):

F = (c * 1.8) + 32

Return f


The output would be 32.0

If you change it to fun(45) and run it then your output would be 113.0.

In Machine Learning Programming, you can create the same problem on Google Collab. We can use a Machine Learning library called TensorFlow, which is developed by Google and is an open-source right now. In TensorFlow, they have already created many Machine Learning models that you can use.

Once you execute the needed cells, you define the input, which would be the C and the output which would be the F. 

Input is -40, -10, 0, 8, 15, 22, 38

Output is -40, 14, 31, 46, 59, 72, 100

The length of your input and your output should be the same. 

Then, we use another Machine Learning library called Keras, which makes things easier as it is an open-source independent from Google. Next, you compare the models and train the model. While you train the model, everything is mentioned; inputs and outputs, so the machine knows everything it needs to be trained. Next a graph appears which helps you analyze how your model performed. Once all that is set, you ask your model the questions you have, for example: if my input is 8, what would my output be? Then the model predicts the answer, which would be around 46.29.

The rule will appear at the end. With the equation F = C * 1.8 + 32, you can tell that we never give the model that equation, it generates it.

Why would I need Machine Learning if I can do it with the Traditional Approach? 

You can do simple problems with limited variables in Traditional Programming, but with stock market predictions and other things that have thousands of variables, it is more ideal to use Machine Learning or AI Programming. In situations such as spam filters in emails, you can categorize which emails are spam or not by you stating specific words, numbers, or unusual characteristics that link together to spam. You set the rules in Traditional Programming, however, in Machine Learning, you don’t have to make the rules, you just have to train the models with the data you input. Later, you use this model to predict whether the emails are spam or not. The benefit of Machine Learning also is you can always measure the performance of your model then finetune it or optimize it over time.

More complex situations are like voice recognition, natural language processing and so on where you would have to use Machine Learning Programming.

How many times in a real-world situation do we have to make a new algorithm model?

In the real world, we always use models from the libraries that have  been previously created. We do not have to go and create these complex mathematical functions for models because they have already been created and some people keep improving these existing models. As a Data Science or Machine Learning practitioner, what we usually do is choose the best one and there are a lot of hyperparameters we can adjust in a Machine Learning Programme. However, you should know which one to choose, the concept behind the existing model and how to fine-tune it.

For more information on AI and Traditional Programming, watch the full Mini-Class by Salman Khan below.

Register now for our Data Science Course and learn more.

Related Articles


Your email address will not be published. Required fields are marked *

Ready to start your Data Science Journey? Join our Data Science & Machine Learning BootcampLEARN MORE