ML Fundamentals: lesson 1 of 7

ML Fundamentals

PATH 02MODULE 01LESSON 01 OF 07Next: Types of Machine Learning

What Machine Learning Is and How It Differs from Traditional Programming

Understand how machine learning learns useful patterns from examples instead of relying entirely on hand-written rules.

Beginner14 min readmachine-learningmodelspredictionfoundations

Concept

Machine learning is a way to build software that learns a useful relationship from examples. Instead of writing every rule for an outcome, we provide data and known outcomes, then fit a model that can make predictions for new cases.

Why It Matters

Rules work well when the logic is clear: calculate tax, validate a required field, or apply an eligibility policy. They become difficult when a decision depends on many weak signals. Spam language, customer behavior, house characteristics, and recommendation preferences contain patterns that are hard to describe as a long list of rules.

Intuition

Traditional programming is: data + explicit rules -> output. For example, an order is free-shipping eligible when its value exceeds a known threshold. Machine learning is: examples + known outcomes -> learned model, then new data -> prediction. A model is not a person or a rule book; it is a fitted mathematical procedure that maps inputs to an estimate or decision.

Real-World Examples

A spam filter learns from messages previously labeled spam or not spam. A house-price model learns from past sales and their features. A churn model learns from historical customers and whether they later churned. A ranking system learns signals that help order products or content for a user. In each case, the model can predict patterns; it does not automatically explain why a pattern causes an outcome.

When ML Is Not the Answer

Use ordinary programming when rules are stable, understandable, and sufficient. Use analysis or experimentation when the question is what happened or which policy works. ML is not magic, automatic intelligence, or a replacement for problem definition. A model trained on poor data or an unclear target can make confident but unhelpful predictions.

A Detailed Rule-Based Versus ML Comparison

Consider a fraud-review queue. A rule can flag every transaction above a fixed amount or every purchase from a blocked country. Those rules are transparent and valuable, but fraud often depends on combinations: an unfamiliar device, an unusual purchase time, a new location, and a large change from a customer's normal behavior. A long rule list becomes difficult to maintain and can miss new combinations.

A supervised model learns from past transactions whose outcomes were later confirmed. It can produce a fraud-risk score for a new transaction, while a team still decides the action: approve it, request verification, or send it to review. The model is useful because it combines evidence; it does not replace policy, investigation, or human judgment.

Prediction Is Not Explanation

Machine learning can predict an outcome or recognize a pattern, but it does not automatically establish why that outcome happens. If customers on month-to-month contracts churn more often, contract type can be a useful feature. It does not prove that contract flexibility causes churn; tenure, pricing, or service experience may explain some of the relationship. Prediction supports a decision. Causal explanation requires a different kind of analysis and evidence.

Technical Perspective

Before modeling, define the decision, the prediction time, the available data, and how a prediction will be used. A churn prediction only helps if the business can act before churn occurs. A high score is not evidence of causation: the model may exploit correlation, bias, or a data collection artifact.

Failure Signals

Common Mistakes

  1. Starting with an algorithm before defining the decision.
  2. Treating a prediction as a causal explanation.
  3. Using ML where a simple rule or report is clearer.
  4. Assuming more data automatically fixes a poorly defined problem.

Best Practices

State the outcome in plain language, inspect data quality, and compare any model with a simple reference prediction, often called a baseline. For example, a price model should do better than always predicting the historical average price. Keep the human decision and consequences visible throughout the project.

Interview Perspective

Question: When would you use ML instead of rules? Answer: when examples contain a useful pattern that is difficult to express as stable explicit rules, and a prediction would support a real decision. What the interviewer is testing: whether you can connect a technical approach to a decision rather than naming an algorithm. Follow-up: name a case where a rule is better.

Practice Questions

  1. Is free-shipping eligibility better suited to a rule or ML? Why?
  2. A company wants to predict late deliveries. What historical outcomes would it need to train a supervised model?
  3. Explain the difference between a churn prediction and an explanation of churn.
  4. Name two data-quality issues that could weaken a spam model.
  5. A team can predict churn but has no retention action available. What should it clarify before building the model?

Quick Quiz

  1. What does a fitted model do? Answer: maps new inputs to a prediction or decision.
  2. Does ML prove causation? Answer: no.
  3. When are explicit rules often preferable? Answer: when logic is stable and clear.

Key Takeaway

Key Takeaways

Machine learning learns patterns from examples for future predictions. It is useful when rules are difficult to write, but it depends on a well-defined problem, appropriate data, and a useful decision.

Next Lesson

Next, learn the broad learning setups that fit different kinds of problems.

Finish this lesson on your terms

Mark it complete when you have worked through the material and are ready to move on.