> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# What Machine Learning Actually Is

> Overview of machine learning including definitions, contrast with rule based programming, model types, core components, training and evaluation, and guidance on when to use ML versus hand written rules

Machine learning (ML) is a way of building software in which systems discover patterns from data instead of relying on rules explicitly written by a developer. Put simply: ML uses historical examples to train models that make predictions on new inputs.

## How ML differs from traditional programming

In traditional programming you write explicit instructions: an input goes in, the program follows defined rules, and an output comes out. For many simple tasks this is ideal — for example, an age-check for website access can be written as a single rule:

* If the user is 18 or older, allow access.
* If the user is younger than 18, block access.

That logic is deterministic and easy to implement using a conditional such as `if age >= 18`.

But many real-world problems are messy, noisy, and constantly changing. Consider spam detection:

* Heuristics like “contains ‘free money’” or “has many links” can catch some spam.
* Spammers change tactics, legitimate messages sometimes match those heuristics, and complete coverage by hand-written rules becomes infeasible.

This is where machine learning shines: instead of manually encoding every possible rule, you gather examples labeled as “spam” or “not spam” and let a learning algorithm discover patterns from the data.

Historical examples of learning systems include Arthur Samuel’s checkers program from the 1950s, which improved via experience, and the Netflix Prize (2006), which used historical ratings to predict users’ future movie preferences rather than handcrafted rules. See Arthur Samuel and the Netflix Prize for background:

* [https://en.wikipedia.org/wiki/Arthur\_Samuel\_(computer\_scientist)](https://en.wikipedia.org/wiki/Arthur_Samuel_\(computer_scientist\))
* [https://en.wikipedia.org/wiki/Netflix\_Prize](https://en.wikipedia.org/wiki/Netflix_Prize)

## What a model is

A model is the component that maps inputs to predictions. For the Netflix example, the input could include user IDs, movie IDs, and past ratings; the output is a predicted rating for an unseen movie.

A simple mental model for ML:

* Input (features) goes in,
* the model performs mathematical computations using internal values (parameters/weights),
* a prediction comes out.

During training, the model adjusts its parameters so predictions improve on labeled examples. Think of parameters as knobs inside the model that are tuned by training data; “learning” means these knobs are changed to reduce error on the task — it does not imply human-like understanding.

<Callout icon="lightbulb" color="#1CB2FE">
  “Learning” in machine learning generally means adjusting model parameters to improve performance on a task; it is not equivalent to human understanding.
</Callout>

## Types of models

Machine learning is an umbrella term for many algorithms and architectures:

* Simple models: linear regression, logistic regression, decision trees.
* More complex models: random forests, gradient-boosted machines.
* Deep learning: neural networks and large language models (LLMs) such as ChatGPT ([https://openai.com/chatgpt](https://openai.com/chatgpt)).

Each model type has trade-offs in expressiveness, training data requirements, interpretability, and computational cost.

In one sentence: machine learning uses data to train models that make useful predictions on new inputs.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/qBe6x55gupKpUs7F/images/Machine-Learning-Fundamentals/Getting-Started/What-Machine-Learning-Actually-Is/machine-learning-training-diagram.jpg?fit=max&auto=format&n=qBe6x55gupKpUs7F&q=85&s=2558380b75f4a4e76d486c2f512b2d14" alt="A colorful hand-drawn diagram illustrating how machine learning works, showing inputs and training examples feeding a computer model that learns/adjusts to produce outputs. Notes list model types like linear models, decision trees, neural networks and LLMs (e.g., ChatGPT)." width="1920" height="1080" data-path="images/Machine-Learning-Fundamentals/Getting-Started/What-Machine-Learning-Actually-Is/machine-learning-training-diagram.jpg" />
</Frame>

## Core ingredients of a machine learning system

Because ML learns from examples, a typical system includes several essential pieces:

| Component | What it is | Example |
| - | - | - |
| Training data | Historical examples used to learn patterns | A dataset of emails labeled `spam` or `not spam` |
| Features | The measurable properties used as input | Email text, number of links, sender domain |
| Labels | Ground-truth outputs used during supervised training | `spam`, `not spam` |
| Model | The mathematical function that maps features to predictions | Logistic regression, decision tree, neural network |
| Training process | How the model’s parameters are adjusted | Gradient descent optimizing a loss function |
| Evaluation metrics | How performance is measured | Accuracy, precision, recall, F1-score, ROC-AUC |

## When to use ML vs. rule-based systems

| Problem characteristics | Prefer rule-based if... | Prefer ML if... |
| - | - | - |
| Clear, deterministic logic | The logic is simple and unchanging (e.g., `if age >= 18`) | — |
| High variability and fuzziness | — | The problem shows many exceptions and evolving patterns (spam, recommendations) |
| Large labeled datasets available | — | You have enough labeled examples to learn meaningful patterns |
| Need for interpretability | Rule-based or simple models are preferred | Complex models can be used if predictive performance is prioritized over interpretability |

## Final takeaway and further reading

Machine learning is not a single algorithm but a set of methods for turning data into predictive systems by tuning model parameters on examples. Use rule-based solutions for simple deterministic logic; choose machine learning when the problem is fuzzy, variable, or too complex for hand-written rules.

Further reading:

* [Introduction to Machine Learning — Wikipedia](https://en.wikipedia.org/wiki/Machine_learning)
* [Scikit-learn documentation](https://scikit-learn.org/)
* [Deep Learning overview (Goodfellow, Bengio, Courville)](https://www.deeplearningbook.org/)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/machine-learning-fundamentals/module/b91a5ccb-d947-449c-ad06-7825b11ed189/lesson/e325c74e-63c2-400c-8e4c-71b360148474" />
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.