WDIS AI-ML
10 min read
WDIS AI-ML Series: Module 1 Lesson 3: When to apply Rule Based Vs ML vs DL
Written by
Vinay Roy
Published on
09th Mar 2024

Since this series is about Machine learning, I am sure when you complete the series, you will start looking at every problem through the lens of Machine Learning. This is what many companies or tech teams are doing. They are applying Machine learning for the sake of it. Some wise person rightly said, “When you have a hammer in your hand everything around you will appear as a nail”.

It is worth reminding us of the golden rule of Machine Learning.

Remember, the purpose of Machine learning, or Deep Learning, or any other tool is to solve a user problem. The tool is not the end but a means to get there.

Now, let us try to understand when do we apply Rule Based vs Machine Learning vs Deep Learning.

There are four important components in the Artificial Intelligence Problem statement - Input, Output, Features, and Possible Values of the Feature.The purpose of Artificial intelligence in simple terms is finding a function F(x) that allows the Machine to map input to Output. Let us take an example. Suppose, given the address of the house, I want to find at what price the house will sell.

Fig: In predicting House Prices, the purpose is to Map Input (The House Identifier, Say the Address of the House, for which we are predicting the price) to the Sales Price. The f(x) in this case is the mapping that what we are generating, either through the Rule-Based Model or through the Machine Learning Model, between Input and Output.

In this case, Input is the house identifier say the address of the house. The output is the price at which the house will sell. The Features are #BR, #BA, Sq Ft, etc. and the values of the features are say for #BR - 2 BR, 3 BR, 4 BR, etc.

Now imagine a scenario where there are only four configurations of houses

This is where the Rule-Based Model shines. One can easily convert this into a series of If-Else conditions to create a rule such that if #BR is 2 and # BA is 2 then the price is $0.8M. In this case, based on Features and Values of the Features from historical data, it is Human (A programmer) who creates the rule to map Input to Output.

However, we all know, that in the real world, there are many more features than just these two, and possible values that some of the features, such as Sq ft, can take are also not finite. In that case, for a programmer to create a rule or set of rules will be impossible or even if written will require millions of ‘If Else’ conditions, which is not feasible to manage. This renders the Rule-Based Model ineffective for many situations.

In comes Machine Learning. Machine Learning resolves this by shifting the burden of rule creation from humans to machines. A data scientist still plays a key role in selecting, transforming, and validating features, but the model itself learns the complex patterns in the data that map inputs (features) to outputs (target values).

Machine Learning: Feature Extraction is done by Humans while Relationship between Features and Output is created by Machine

This allows ML models—like decision trees, random forests, and support vector machines—to handle:

  • Multivariate relationships
  • Nonlinear patterns
  • Probabilistic decisions

Deep Learning (DL) takes things further by using neural networks with many layers to model extremely complex relationships. Unlike traditional ML:

  • It requires less or no manual feature engineering (especially in text, images, and time series)
  • It excels at tasks with unstructured data (e.g., language, vision)
  • It models hierarchical features through its layered structure
Deep Learning: Feature Extraction and Relationship between features and Output is discocered by Machine

This brings us to a question: If in Deep Learning, Machines can do Feature Extraction then why do need Machine learning at all where humans have to do this task, after all, isn't the whole purpose of AI is to reduce burdens on Humans? Phrased differently

Why do we need Machine Learning when Deep Learning Exists?

1. Data Requirements and Efficiency - Deep Learning needs a lot of data.

  • DL models are data-hungry. They require hundreds of thousands to millions of labeled examples to generalize well.
  • ML models (like decision trees, logistic regression, or gradient boosting) can perform extremely well on small-to-medium-sized datasets (hundreds to thousands of rows). ML is more efficient when: Data is tabular, We have limited data,Interpretability and fast iteration matter.

2. Computation Cost and Infrastructure - Deep Learning is resource-intensive.

  • DL needs GPUs, large memory, longer training cycles
  • ML can run well on a laptop or small server. ML is faster and cheaper to deploy and retrain in many real-world business applications (e.g., customer churn, fraud detection)

3. Interpretability and Regulatory Needs - ML is easier to explain.

  • ML models offer feature importance, decision paths, partial dependence plots. ML is better when transparency is essential, like: Healthcare diagnostics, Financial decisions (e.g., credit scoring), Legal or compliance-based decisions
  • DL models are often black boxes unless XAI methods (e.g., SHAP, LIME, attention maps) are applied. Deep learning models are essetnially black boxes. Their internal weights, activations, and node connections make them:
    • Hard to interpret
    • Difficult to trust without additional tools (e.g., SHAP, LIME, attention visualization)
    Hence, while deep learning provides unmatched accuracy in many domains, it often lacks transparency, making it less suited for domains requiring explainability (like legal or healthcare) without post hoc interpretation methods.

4. Structured (Tabular) Data vs. Unstructured Data - In most business settings, structured data still dominates, making ML more relevant than it seems.

  • DL excels at unstructured data: images, text, speech, video.
  • ML excels at structured/tabular data: spreadsheets, customer records, transactions, surveys.

5. Simplicity and Maintainability - ML is often a practical first step before justifying the complexity of DL.

  • ML pipelines are easier to debug, explain, and maintain.
  • DL pipelines require expertise in model architecture, tuning, and deployment frameworks (e.g., TensorFlow, PyTorch).

Final Thought - AI’s purpose isn’t to eliminate humans—it’s to augment them intelligently.

Deep Learning automates feature discovery—but at a cost. Machine Learning remains more agile, efficient, and interpretable for many use cases where manual oversight is still valuable or required.

This is the time to introduce the concept of White Box, Gray Box, and Black Box

As we’ve seen, while Deep Learning offers powerful automation through self-learned feature extraction, it also comes with significant trade-offs—particularly in interpretability. This trade-off brings us to a crucial framework in AI and machine learning: the classification of models into White-box, Gray-box, and Black-box systems.

These terms describe how transparent a model's internal decision-making process is to humans, and they help us understand where and when certain models should or shouldn’t be used.

White-Box Models: Transparent and Interpretable - White-box models are those where we can fully inspect and understand the internal logic behind every decision.

  • Examples: Rule-based systems, linear regression, decision trees
  • Pros:
    • High explainability and trust
    • Easy to debug, audit, and comply with regulations
  • Cons:
    • Often less accurate in complex scenarios
  • Best for: High-stakes applications where explanation and accountability matter more than raw performance (e.g., healthcare, compliance)

Black-Box Models: Opaque but Powerful - Black-box models are highly complex, and their internal workings are not directly understandable by humans.

  • Examples: Deep neural networks, ensemble methods (like random forests or boosted trees)
  • Pros:
    • Very high accuracy and scalability
    • Effective with unstructured data (text, images, audio)
  • Cons:
    • Difficult to interpret or explain why a prediction was made
    • Risky in domains requiring explainability
  • Best for: Applications where performance trumps transparency (e.g., speech recognition, object detection, large-scale recommendations)

Gray-Box Models: A Balance Between the Two - Gray-box models offer a middle ground. You can inspect some parts of the decision-making process, but not all.

  • Examples: Ensemble models with feature importance metrics, simplified neural networks, explainable AI (XAI) wrappers around black-boxes
  • Pros:
    • Good performance with partial explainability
    • Suitable for critical applications with moderate risk
  • Cons:
    • Still not fully transparent
  • Best for: Enterprise use cases where moderate transparency and trust are essential (e.g., fraud detection, credit scoring)

🧭 Why This Matters

When choosing a model, it's not just about accuracy—it's also about:

  • Can we trust it?
  • Can we explain it to a regulator, stakeholder, or user?
  • Will we understand its failures when something goes wrong?

Understanding the white/gray/black box distinction helps us make informed, responsible AI decisions, especially in domains where trust and ethics matter.

In summary:

In Rule-Based Models, based on Features and Values of the Features from historical data, it is the Human (The programmer) who creates the rule to map Input to Output.
In Machine Learning Models, while the data scientists will identify which features are important, it is the Machine that will learn based on data the Rules that map Input to Output.
In Deep Learning Models, Machines will extract what features are important, and also create a rule that maps Input to Output.

Now suppose, we have a scenario where we have three Models that generate three functions as shown below

Case A).     F1: Ax + K                                      ⇒ A rule-based Model

Case B)       F2: Ax + By + cZ^2 + … + K  ⇒ A Machine Learning Model

Case C)       F3: ?                                                 ⇒ A black box model that maps input to output but we do not know what that model looks like. This is the problem of interpretability that we will discuss later in Module 3.

If we assume everything else is constant i.e. the models take the same compute, training time, and have the same accuracy of prediction. Which one shall we choose?

I hope you answered Case A) F1. Why? Because if a model is simple and achieves the same result so why introduce more complexity? But in case you chose B or C. Let me explain why that would not be the smartest choice in this scenario.

How Rule-Based, ML, and DL Models Map to White Box, Gray Box, and Black Box

Many tech people, fall prey to choosing a model that is more advanced or complex. Why? Because it looks great on slide decks. Also, many times company culture rewards complexity. You are talked of as a genius who has implemented the most advanced model. You become a folklore. you get promoted. This is great as long as the model works.

But then there is a time when the business context changes. The model is not performing well. Revenue is dropping. Your manager is breathing down your neck, asking why the model is not working. You respond - I do not know. This is a black box model. We will have to retrain the model.

Now guess, how many managers like hearing ‘I do not know’. No one.

Of course this is a hypothetical scenario and stretched a bit but you will be surprised to know how many times the Tech team falls prey to this syndrome.

Whenever you are leading or interacting with a tech team and need to make a decision, remind them that simplicity is often the better choice.

This will benefit you in the long run.

As a photographer, it’s important to get the visuals right while establishing your online presence. Having a unique and professional portfolio will make you stand out to potential clients. The only problem? Most website builders out there offer cookie-cutter options — making lots of portfolios look the same.

That’s where a platform like Webflow comes to play. With Webflow you can either design and build a website from the ground up (without writing code) or start with a template that you can customize every aspect of. From unique animations and interactions to web app-like features, you have the opportunity to make your photography portfolio site stand out from the rest.

So, we put together a few photography portfolio websites that you can use yourself — whether you want to keep them the way they are or completely customize them to your liking.

12 photography portfolio websites to showcase your work

Here are 12 photography portfolio templates you can use with Webflow to create your own personal platform for showing off your work.

1. Jasmine

Stay Updated with Neuto AI Newsletter

Subscribe to our newsletter to receive our latest blogs, recommended digital courses, and more to unlock growth Mindset

Thank you for subscribing to our newsletter!
Oops! Something went wrong while submitting the form.
By clicking Subscribe, you agree to our Terms and Conditions
Data Science
WDIS AI-ML Series: Module 1 Lesson 3: When to apply Rule Based Vs ML vs DL
Vinay Roy
09th Mar 2024
Introduction
Artificial intelligence is all about giving machines an ability to think (and act) like a human
Table of Contents
Key Takeaways A Framework for Framing ML Problems Clarify the Business Objective Frame the ML Problem Design the ML Pipeline Define Success Metrics Plan for Deployment & Beyond Continually Measure Business Impact Conclusion

Since this series is about Machine learning, I am sure when you complete the series, you will start looking at every problem through the lens of Machine Learning. This is what many companies or tech teams are doing. They are applying Machine learning for the sake of it. Some wise person rightly said, “When you have a hammer in your hand everything around you will appear as a nail”.

It is worth reminding us of the golden rule of Machine Learning.

Remember, the purpose of Machine learning, or Deep Learning, or any other tool is to solve a user problem. The tool is not the end but a means to get there.

Now, let us try to understand when do we apply Rule Based vs Machine Learning vs Deep Learning.

There are four important components in the Artificial Intelligence Problem statement - Input, Output, Features, and Possible Values of the Feature.The purpose of Artificial intelligence in simple terms is finding a function F(x) that allows the Machine to map input to Output. Let us take an example. Suppose, given the address of the house, I want to find at what price the house will sell.

Fig: In predicting House Prices, the purpose is to Map Input (The House Identifier, Say the Address of the House, for which we are predicting the price) to the Sales Price. The f(x) in this case is the mapping that what we are generating, either through the Rule-Based Model or through the Machine Learning Model, between Input and Output.

In this case, Input is the house identifier say the address of the house. The output is the price at which the house will sell. The Features are #BR, #BA, Sq Ft, etc. and the values of the features are say for #BR - 2 BR, 3 BR, 4 BR, etc.

Now imagine a scenario where there are only four configurations of houses

This is where the Rule-Based Model shines. One can easily convert this into a series of If-Else conditions to create a rule such that if #BR is 2 and # BA is 2 then the price is $0.8M. In this case, based on Features and Values of the Features from historical data, it is Human (A programmer) who creates the rule to map Input to Output.

However, we all know, that in the real world, there are many more features than just these two, and possible values that some of the features, such as Sq ft, can take are also not finite. In that case, for a programmer to create a rule or set of rules will be impossible or even if written will require millions of ‘If Else’ conditions, which is not feasible to manage. This renders the Rule-Based Model ineffective for many situations.

In comes Machine Learning. Machine Learning resolves this by shifting the burden of rule creation from humans to machines. A data scientist still plays a key role in selecting, transforming, and validating features, but the model itself learns the complex patterns in the data that map inputs (features) to outputs (target values).

Machine Learning: Feature Extraction is done by Humans while Relationship between Features and Output is created by Machine

This allows ML models—like decision trees, random forests, and support vector machines—to handle:

  • Multivariate relationships
  • Nonlinear patterns
  • Probabilistic decisions

Deep Learning (DL) takes things further by using neural networks with many layers to model extremely complex relationships. Unlike traditional ML:

  • It requires less or no manual feature engineering (especially in text, images, and time series)
  • It excels at tasks with unstructured data (e.g., language, vision)
  • It models hierarchical features through its layered structure
Deep Learning: Feature Extraction and Relationship between features and Output is discocered by Machine

This brings us to a question: If in Deep Learning, Machines can do Feature Extraction then why do need Machine learning at all where humans have to do this task, after all, isn't the whole purpose of AI is to reduce burdens on Humans? Phrased differently

Why do we need Machine Learning when Deep Learning Exists?

1. Data Requirements and Efficiency - Deep Learning needs a lot of data.

  • DL models are data-hungry. They require hundreds of thousands to millions of labeled examples to generalize well.
  • ML models (like decision trees, logistic regression, or gradient boosting) can perform extremely well on small-to-medium-sized datasets (hundreds to thousands of rows). ML is more efficient when: Data is tabular, We have limited data,Interpretability and fast iteration matter.

2. Computation Cost and Infrastructure - Deep Learning is resource-intensive.

  • DL needs GPUs, large memory, longer training cycles
  • ML can run well on a laptop or small server. ML is faster and cheaper to deploy and retrain in many real-world business applications (e.g., customer churn, fraud detection)

3. Interpretability and Regulatory Needs - ML is easier to explain.

  • ML models offer feature importance, decision paths, partial dependence plots. ML is better when transparency is essential, like: Healthcare diagnostics, Financial decisions (e.g., credit scoring), Legal or compliance-based decisions
  • DL models are often black boxes unless XAI methods (e.g., SHAP, LIME, attention maps) are applied. Deep learning models are essetnially black boxes. Their internal weights, activations, and node connections make them:
    • Hard to interpret
    • Difficult to trust without additional tools (e.g., SHAP, LIME, attention visualization)
    Hence, while deep learning provides unmatched accuracy in many domains, it often lacks transparency, making it less suited for domains requiring explainability (like legal or healthcare) without post hoc interpretation methods.

4. Structured (Tabular) Data vs. Unstructured Data - In most business settings, structured data still dominates, making ML more relevant than it seems.

  • DL excels at unstructured data: images, text, speech, video.
  • ML excels at structured/tabular data: spreadsheets, customer records, transactions, surveys.

5. Simplicity and Maintainability - ML is often a practical first step before justifying the complexity of DL.

  • ML pipelines are easier to debug, explain, and maintain.
  • DL pipelines require expertise in model architecture, tuning, and deployment frameworks (e.g., TensorFlow, PyTorch).

Final Thought - AI’s purpose isn’t to eliminate humans—it’s to augment them intelligently.

Deep Learning automates feature discovery—but at a cost. Machine Learning remains more agile, efficient, and interpretable for many use cases where manual oversight is still valuable or required.

This is the time to introduce the concept of White Box, Gray Box, and Black Box

As we’ve seen, while Deep Learning offers powerful automation through self-learned feature extraction, it also comes with significant trade-offs—particularly in interpretability. This trade-off brings us to a crucial framework in AI and machine learning: the classification of models into White-box, Gray-box, and Black-box systems.

These terms describe how transparent a model's internal decision-making process is to humans, and they help us understand where and when certain models should or shouldn’t be used.

White-Box Models: Transparent and Interpretable - White-box models are those where we can fully inspect and understand the internal logic behind every decision.

  • Examples: Rule-based systems, linear regression, decision trees
  • Pros:
    • High explainability and trust
    • Easy to debug, audit, and comply with regulations
  • Cons:
    • Often less accurate in complex scenarios
  • Best for: High-stakes applications where explanation and accountability matter more than raw performance (e.g., healthcare, compliance)

Black-Box Models: Opaque but Powerful - Black-box models are highly complex, and their internal workings are not directly understandable by humans.

  • Examples: Deep neural networks, ensemble methods (like random forests or boosted trees)
  • Pros:
    • Very high accuracy and scalability
    • Effective with unstructured data (text, images, audio)
  • Cons:
    • Difficult to interpret or explain why a prediction was made
    • Risky in domains requiring explainability
  • Best for: Applications where performance trumps transparency (e.g., speech recognition, object detection, large-scale recommendations)

Gray-Box Models: A Balance Between the Two - Gray-box models offer a middle ground. You can inspect some parts of the decision-making process, but not all.

  • Examples: Ensemble models with feature importance metrics, simplified neural networks, explainable AI (XAI) wrappers around black-boxes
  • Pros:
    • Good performance with partial explainability
    • Suitable for critical applications with moderate risk
  • Cons:
    • Still not fully transparent
  • Best for: Enterprise use cases where moderate transparency and trust are essential (e.g., fraud detection, credit scoring)

🧭 Why This Matters

When choosing a model, it's not just about accuracy—it's also about:

  • Can we trust it?
  • Can we explain it to a regulator, stakeholder, or user?
  • Will we understand its failures when something goes wrong?

Understanding the white/gray/black box distinction helps us make informed, responsible AI decisions, especially in domains where trust and ethics matter.

In summary:

In Rule-Based Models, based on Features and Values of the Features from historical data, it is the Human (The programmer) who creates the rule to map Input to Output.
In Machine Learning Models, while the data scientists will identify which features are important, it is the Machine that will learn based on data the Rules that map Input to Output.
In Deep Learning Models, Machines will extract what features are important, and also create a rule that maps Input to Output.

Now suppose, we have a scenario where we have three Models that generate three functions as shown below

Case A).     F1: Ax + K                                      ⇒ A rule-based Model

Case B)       F2: Ax + By + cZ^2 + … + K  ⇒ A Machine Learning Model

Case C)       F3: ?                                                 ⇒ A black box model that maps input to output but we do not know what that model looks like. This is the problem of interpretability that we will discuss later in Module 3.

If we assume everything else is constant i.e. the models take the same compute, training time, and have the same accuracy of prediction. Which one shall we choose?

I hope you answered Case A) F1. Why? Because if a model is simple and achieves the same result so why introduce more complexity? But in case you chose B or C. Let me explain why that would not be the smartest choice in this scenario.

How Rule-Based, ML, and DL Models Map to White Box, Gray Box, and Black Box

Many tech people, fall prey to choosing a model that is more advanced or complex. Why? Because it looks great on slide decks. Also, many times company culture rewards complexity. You are talked of as a genius who has implemented the most advanced model. You become a folklore. you get promoted. This is great as long as the model works.

But then there is a time when the business context changes. The model is not performing well. Revenue is dropping. Your manager is breathing down your neck, asking why the model is not working. You respond - I do not know. This is a black box model. We will have to retrain the model.

Now guess, how many managers like hearing ‘I do not know’. No one.

Of course this is a hypothetical scenario and stretched a bit but you will be surprised to know how many times the Tech team falls prey to this syndrome.

Whenever you are leading or interacting with a tech team and need to make a decision, remind them that simplicity is often the better choice.

This will benefit you in the long run.

About the author:
Vinay Roy
Fractional AI / ML Strategist | ex-CPO | ex-Nvidia | ex-Apple | UC Berkeley
further readings
Related
Articles
Data Science
6 mins read
WDIS AI-ML Series: Module 2 Lesson 6: Model Selection and Evaluation Metrics
How do we use this data that exists in the Data warehouse and/or Data Lake to build Machine Learning (ML) models? However, before we build models, we need to gain a deeper understanding of our data.
Data Science
6 mins read
NeutoAI CoMarketer - Marketing Meets AI with Adaptive Content Optimization (ACO) System
NeutoAI CoMarketer introduces Adaptive Content Optimization (ACO), seamlessly merging AI and marketing for dynamic, personalized campaigns.
Data Science
6 mins read
Protecting Sensitive Data in the Age of Large Language Models (LLMs)
How to safeguard against leaking sensitive PII data while allowing their employees to use LLM models and other 3rd party AI tools.