# Machine Learning Overview and Core Concepts

> Chapter 1 of the Courseiva AWS-MACHINE-LEARNING-SPECIALTY curriculum — https://courseiva.com/learn/aws-machine-learning-specialty/ml-overview-and-core-concepts

**Official objective:** 1.1 — Define machine learning and deep learning concepts and their applications

## Introduction

Machine learning (ML) lets computers learn from data without being explicitly programmed for every single task. Deep learning (DL) is a more advanced subset of ML that uses layered algorithms to understand complex patterns. For the MLS-C01 exam, understanding this core difference and knowing when to apply each is the foundation upon which all other topics rest.

## The Coffee Shop Ordering Analogy

A coffee shop menu is a collection of rules for making drinks. A barista uses these rules to prepare any order perfectly every time. This menu is like a traditional computer program: a set of explicit instructions for a specific outcome. The barista follows the recipe exactly, never improvising.

Now imagine a new barista who learns by watching thousands of previous orders. They see that when customers say 'something warm and sweet', the shop often sold hot chocolate or a latte with vanilla. Over time, this barista can predict what a new customer might want based on patterns, without a written recipe. This barista is using machine learning: they learn patterns from examples (data) to make predictions or decisions without being explicitly programmed for each case.

A deep learning version would be a barista who not only watches orders but also studies the subtle expressions, the time of day, the weather, and the customer's tone of voice to recommend a drink. This barista has many layers of understanding, from basic ingredients to complex social cues. Machine learning is the barista learning from past orders; deep learning is the ultra-observant barista who uses many layers of insight to master the craft.

## Core explanation

Machine learning (ML) is a branch of artificial intelligence (AI) that gives computers the ability to learn and improve from experience (data) without being explicitly programmed for every possible situation. Traditional programming involves a human writing fixed rules: 'if this input, then do that output'. ML flips this: you provide the computer with many examples of inputs and their correct outputs, and the algorithm figures out the rules itself. This is useful for tasks too complex or variable to code manually, such as recognising faces in photos or predicting customer churn.

ML is broadly divided into three types based on the kind of data and feedback available. Supervised learning uses labelled data, where each example has a known correct answer (like emails marked 'spam' or 'not spam'). The model learns to map inputs to outputs and then predicts on new, unlabelled data. Unsupervised learning uses unlabelled data, where the model finds hidden patterns or groups on its own (like segmenting customers by purchasing behaviour without knowing the segments in advance). Reinforcement learning involves an agent that learns by taking actions in an environment to maximise a reward signal, like a robot learning to walk by receiving positive feedback for each successful step.

Deep learning is a specialised subset of machine learning that uses artificial neural networks with many layers (hence 'deep'). A neural network is inspired by the brain's structure: it consists of interconnected nodes (neurons) organised in layers. Each layer transforms the input data in some way. The 'deep' in deep learning refers to the presence of multiple hidden layers between the input and output layers. These layers allow the model to learn hierarchical features: the first layer might detect edges in an image, the next layer detects shapes, and deeper layers recognise objects like faces or cars. This is why deep learning excels at complex tasks like image recognition, natural language processing (NLP), and speech recognition.

Why does deep learning exist? Traditional ML algorithms often require manual feature engineering, where a human expert identifies which characteristics of the data are important. Deep learning automates this feature extraction, learning the most relevant features directly from the raw data. However, deep learning typically requires much larger amounts of data and more computational power to train effectively.

In practice, an ML project involves several steps. First, you collect and prepare data (cleaning, handling missing values). Then you choose an appropriate algorithm (like linear regression for predicting a number, or a decision tree for classification). You train the model on a portion of the data, which means the algorithm adjusts its internal parameters to minimise error on the training examples. Next, you evaluate the model on a separate test set of data it has never seen to check if it generalises well. Finally, you deploy the model to make predictions on real-world data.

Key terminology you will encounter includes:
- Model: the trained mathematical representation that makes predictions
- Features: the input variables used by the model (e.g., square footage of a house, number of bedrooms)
- Labels: the output variable you want to predict (e.g., house price)
- Training: the process of showing the model data so it learns patterns
- Inference: using a trained model to make predictions on new data
- Overfitting: when a model learns training data too well, including noise, and fails on new data

For the MLS-C01 exam, you must be able to distinguish between ML and deep learning, know the three main learning types, and understand how a basic ML workflow operates. The exam often tests whether you can identify the correct approach for a given business problem.

## Real-world context

An IT professional working with machine learning often starts by framing a business problem as a machine learning task. Suppose you work for an e-commerce company that wants to predict which customers are likely to stop shopping (churn) in the next month. Your job is to build a model that can identify these at-risk customers so the marketing team can run a special retention offer.

Your first step is data collection. You gather historical data from the company's database: customer demographics, past purchase amounts, frequency of visits, support tickets logged, and whether each customer actually churned in that month. This history must span at least several months to provide enough examples. The target variable (label) is 'churned: yes or no'.

Next, you prepare the data. This involves cleaning missing values (e.g., customers without a recorded age), converting categorical variables like location into a numerical format (one-hot encoding), and scaling numerical features like purchase amount so they have a similar range. You also split the dataset into a training set (typically 80%) and a test set (20%). The training set is what the model will learn from; the test set is held back to evaluate performance later.

You then choose an algorithm. For binary classification (yes/no churn), common choices include logistic regression, decision trees, random forests, or gradient boosting machines (like XGBoost). You train the model on the training data. Training means the algorithm adjusts its internal parameters to minimise the difference between its predictions and the actual labels (the 'error'). You might also perform hyperparameter tuning, where you adjust settings like the depth of a tree or the learning rate to optimise performance.

Once trained, you evaluate the model using the test set. You calculate metrics like accuracy, precision, recall, and F1-score. For churn prediction, recall might be more important: you want to catch as many true churners as possible, even if you mistakenly contact some customers who were not going to churn. If the model's accuracy is too low, you may iterate: try different features, collect more data, or try a different algorithm.

Finally, you deploy the model into production. This could mean integrating it into the company's CRM system so that every night, the model scores all active customers and generates a list of high-risk ones to be targeted. You also set up monitoring to detect if the model's performance drifts over time as customer behaviour changes. This entire pipeline is what an IT professional actually does day to day: data wrangling, model training, evaluation, deployment, and monitoring.

In larger organisations, the IT professional might work with a team, using tools like Amazon SageMaker (a managed ML service on AWS) to automate many steps. For the MLS-C01 exam, you need to understand this workflow conceptually, as questions will test your ability to decide which AWS service fits which stage, and what steps are necessary to avoid common pitfalls like data leakage (using future data in training).

## Exam focus

The MLS-C01 exam tests your understanding of machine learning and deep learning concepts in a practical, scenario-based way. You will not be asked to write code, but you must interpret diagrams, choose algorithms, and identify appropriate AWS services for each stage. Here is exactly what you need to know for exam objective 1.1.

Exam question types:
- Given a business problem, choose whether supervised, unsupervised, or reinforcement learning is appropriate. Traps: a problem might seem like clustering (unsupervised) but actually has labelled historical data (supervised). For example, predicting customer churn: if you have past data with churn labels, it is supervised, even though you are grouping customers by risk level later.
- Given a task (e.g., recognising objects in images), decide if deep learning or traditional ML is better. Trap: the question might describe a small dataset with high-dimensional data, where deep learning would overfit. The correct answer is often a traditional ML algorithm with careful feature engineering.
- Identify which type of model (regression, classification, clustering) maps to a given output variable. E.g., predicting house price = regression (continuous number), predicting whether an email is spam = classification (binary category), grouping news articles by topic = clustering.
- Define key terms: model, feature, label, training, inference, overfitting, underfitting. Traps: they might mix up feature and label, or training and inference.

Key concepts that appear repeatedly:
- The difference between supervised and unsupervised learning (this comes up in nearly every domain question)
- When to use deep learning versus simpler models (deep learning needs large data and compute; simpler models are easier to interpret and train faster)
- The ML workflow: data collection, cleaning, splitting, training, evaluation, deployment. You may be asked to identify the correct order or spot a missing step.
- Overfitting and underfitting: what causes them, and how to fix them (more data, simpler model, regularisation for overfitting; more complex model, more features for underfitting).

Common traps in exam questions:
- 'You have a small dataset (100 rows) with many features (500 columns). Which approach is best?' The exam expects you to recognise that deep learning is inappropriate because it requires large data. Feature selection or a linear model is better.
- 'You have unlabelled customer data and want to segment them into groups.' The trap is suggesting regression. The correct answer is clustering (unsupervised) or k-means.
- 'You want to predict sales next month.' The trap is picking classification. Regression is correct because sales is a continuous value, unless the question explicitly asks for a category like 'high/medium/low'.

Definitions to memorise verbatim:
- Machine learning: a subset of AI that enables systems to learn and improve from experience without being explicitly programmed.
- Deep learning: a subset of ML that uses neural networks with multiple hidden layers to model complex patterns.
- Supervised learning: learning from labelled data to predict outcomes.
- Unsupervised learning: finding hidden patterns in unlabelled data.
- Reinforcement learning: learning through trial and error using rewards and punishments.

In the exam, you may also see questions about bias and variance, but those are covered more in later objectives. For 1.1, focus on definitions, the three learning paradigms, and the ML pipeline. Use elimination: if a question describes a labelled dataset, supervised is almost always the answer. If the data is unlabelled, think unsupervised. If it involves an agent navigating an environment, think reinforcement learning.

## Step by step

1. **1. Define the business problem as an ML task** — Start by clarifying what you want to predict and what data you have. For example, 'predict if a customer will churn' is a classification problem. If you have historical data with churn labels, it is supervised. This step sets the direction for all subsequent choices.
2. **2. Collect and prepare the data** — Gather relevant historical data from databases, logs, or APIs. Clean the data by handling missing values (e.g., filling them with the mean), removing duplicates, and correcting errors. Convert categorical data (like country) into numerical form using one-hot encoding. Split the data into a training set (usually 80%) and a test set (20%). This step is critical because poor data quality leads to bad models.
3. **3. Choose and train a model** — Select an algorithm that matches your problem type: regression for continuous values, classification for categories, clustering for grouping. Train the model by feeding it the training data so it adjusts its internal parameters to minimise prediction error. For a simple example, linear regression finds the best-fit line through the data points.
4. **4. Evaluate the model** — Use the test set (data the model has never seen) to measure performance. Common metrics include accuracy (for classification), mean squared error (for regression), and precision/recall (for imbalanced classes). If the model performs well on training data but poorly on test data, it is overfitting and needs adjustment (e.g., simplifying the model or using regularisation).
5. **5. Deploy and monitor the model** — Integrate the trained model into a production environment where it can make predictions on live data. Set up monitoring to track performance metrics over time. If data drift occurs (e.g., customer behaviour changes), the model may need retraining with new data. This step ensures the model continues to provide value after its initial release.
6. **6. Iterate and improve** — Machine learning is rarely a one-shot process. Based on monitoring and business feedback, you may add new features, collect more data, try different algorithms, or tune hyperparameters. Each iteration refines the model to better meet the business need. This step embodies the experimental nature of ML.

## Comparisons

### Supervised Learning vs Unsupervised Learning

**Supervised Learning:**
- Uses labelled data (inputs paired with correct outputs)
- Goal is to predict a target variable (classification or regression)
- Common algorithms: linear regression, decision trees, support vector machines

**Unsupervised Learning:**
- Uses unlabelled data (no correct answers provided)
- Goal is to find hidden patterns or groupings
- Common algorithms: k-means clustering, hierarchical clustering, principal component analysis

### Machine Learning vs Deep Learning

**Machine Learning:**
- Includes simpler algorithms like linear regression and decision trees
- Often requires manual feature engineering
- Works well with smaller datasets

**Deep Learning:**
- Uses multi-layered neural networks
- Automatically learns hierarchical features from raw data
- Requires large datasets and significant computational resources

### Regression vs Classification

**Regression:**
- Predicts a continuous numeric value (e.g., house price, temperature)
- Output is a real number
- Evaluated using metrics like mean squared error (MSE)

**Classification:**
- Predicts a discrete category or class (e.g., spam/not spam, cat/dog)
- Output is a label from a finite set
- Evaluated using metrics like accuracy, precision, recall

### Overfitting vs Underfitting

**Overfitting:**
- Model memorises training data too well, including noise
- High accuracy on training set, low accuracy on test set
- Caused by overly complex model or too many features

**Underfitting:**
- Model fails to learn even the training data patterns
- Low accuracy on both training set and test set
- Caused by overly simple model or insufficient features

## Diagram

_The standard machine learning workflow: from data collection to deployment and monitoring, with an iterative feedback loop for improvement._

```mermaid
flowchart TD
    A[Data Collection] --> B[Data Preparation & Cleaning]
    B --> C[Train/Test Split]
    C --> D[Choose Algorithm]
    D --> E[Train Model]
    E --> F[Evaluate on Test Set]
    F --> G{Performance Good?}
    G -- Yes --> H[Deploy Model]
    G -- No --> I[Adjust Features or Algorithm]
    I --> C
    H --> J[Monitor & Retrain]
```

## Common misconceptions

- **Misconception:** Machine learning and deep learning are the same thing. **Reality:** Deep learning is a subset of machine learning. All deep learning is ML, but not all ML is deep learning. Deep learning uses deep neural networks with many layers, whereas ML includes simpler algorithms like linear regression or decision trees. (The term 'artificial intelligence' is often used as an umbrella, and people conflate all three. Marketing also overuses 'deep learning' to sound advanced, despite simpler ML often being the right tool.)
- **Misconception:** You need a massive dataset for any machine learning project. **Reality:** Many traditional ML algorithms (like logistic regression, decision trees) work well with moderately sized datasets (thousands of rows). Deep learning typically requires larger datasets (millions of rows) to avoid overfitting, but not all ML does. (High-profile deep learning successes (like image recognition with ImageNet) constantly mention 'big data', making beginners think their own small projects are impossible. In reality, many business problems can be solved with a few hundred labelled examples and a simple model.)
- **Misconception:** Machine learning is completely autonomous and requires no human involvement after training. **Reality:** ML models require ongoing monitoring, retraining, and human oversight. Data drift (when real-world data changes over time), concept drift (when the relationship between features and labels changes), and unexpected edge cases all require human intervention. The ML pipeline is a human-in-the-loop process. (Science fiction films and exaggerated vendor claims paint ML as 'set and forget'. Beginners often underestimate the operational complexity of maintaining production ML systems, especially when they have never deployed one.)
- **Misconception:** If a model achieves 99% accuracy on training data, it is a great model. **Reality:** High training accuracy can indicate overfitting, where the model memorises the training data instead of learning general patterns. A good model is evaluated on unseen test data. Overfitted models often perform poorly in production because they fail to generalise to new examples. (Accuracy is intuitive and satisfying, so beginners fixate on it. They may not understand the concept of a train/test split or the danger of overfitting until they experience it themselves. The exam deliberately tests this trap.)
- **Misconception:** You must always use the most complex algorithm available to get the best results. **Reality:** The best model is the simplest one that meets the business requirement. Simpler models are easier to interpret, faster to train and deploy, and less prone to overfitting. Start with a baseline (e.g., linear regression or decision tree) before trying complex deep learning networks. (There is a cultural bias towards sophistication. Beginners often assume 'harder = better', especially after hearing about advanced techniques like transformers or convolutional neural networks. The exam values cost-effectiveness and practicality.)

## Key takeaways

- Machine learning is a subset of AI that learns patterns from data without explicit programming for each outcome.
- Deep learning is a subset of machine learning that uses multi-layered neural networks to learn hierarchical features from raw data.
- Supervised learning requires labelled training data; unsupervised learning finds hidden patterns in unlabelled data; reinforcement learning uses rewards to train an agent via trial and error.
- The ML workflow includes data collection, cleaning, splitting into train/test sets, model training, evaluation, and deployment.
- Overfitting occurs when a model memorises training data and fails on new data; it is detected by poor test set performance despite high training accuracy.
- Simpler models are often preferable to deep learning when data is limited, interpretability is needed, or computational resources are constrained.
- The exam frequently tests your ability to choose the correct learning paradigm based on the presence or absence of labels in the scenario.
- Deep learning requires large datasets and significant compute power; it is not a 'magic bullet' for every problem.

## FAQ

**What is the difference between AI, machine learning, and deep learning?**

AI is the broadest concept, meaning machines that can perform tasks that normally require human intelligence. Machine learning is a subset of AI where systems learn from data without explicit programming. Deep learning is a subset of ML that uses multi-layered neural networks to learn complex patterns.

**Do I need to know how to code to understand machine learning for MLS-C01?**

No, the MLS-C01 exam does not require you to write code. It tests your understanding of concepts, algorithms, and how to apply AWS services. However, familiarity with basic programming logic helps with understanding how algorithms work.

**What does 'training a model' actually mean in plain English?**

Training a model means showing it many examples (data) and letting it adjust its internal rules so that its predictions become more accurate. Think of it like studying for a test: the more practice questions you do, the better you get at answering new ones.

**How do I know if I should use supervised or unsupervised learning?**

If your historical data includes known answers (labels), use supervised learning. If you have no labels and want to find hidden patterns, use unsupervised learning. For example, predicting house prices (labels: actual prices) is supervised; grouping customers by buying habits without pre-defined groups is unsupervised.

**What is overfitting and why is it bad?**

Overfitting happens when a model learns the training data too perfectly, including its noise and outliers, so it fails to generalise to new data. It is bad because the model looks accurate in training but performs poorly in real-world use.

**Do I always need a huge dataset for deep learning?**

Typically, yes. Deep learning models have many parameters and require large amounts of data (often millions of examples) to avoid overfitting. For smaller datasets, simpler machine learning algorithms like decision trees or linear regression are usually better choices.

**What is a neural network?**

A neural network is a computational model inspired by the human brain. It consists of layers of interconnected nodes (neurons) that process input data. Each connection has a weight that is adjusted during training. A 'deep' neural network has many hidden layers between input and output.

**What is the difference between a feature and a label?**

A feature is an input variable you use to make a prediction (e.g., number of bedrooms in a house). A label is the output you want to predict (e.g., the house's price). In supervised learning, the model learns the relationship between features and labels.

## Check your understanding

1. **A company has a dataset of 10,000 customer records with purchase history and a label indicating whether each customer left the service within the last year. They want to predict which current customers are likely to leave. What type of machine learning is this?**

   Answer: This is supervised learning because the dataset includes labelled outcomes (churn/not churn), and the goal is to predict a categorical label from historical data.

2. **What is the key difference between machine learning and deep learning?**

   Answer: Deep learning is a subset of machine learning that uses multi-layered neural networks to automatically learn hierarchical features, while machine learning includes simpler algorithms that often require manual feature engineering.

3. **You are given a dataset of images of handwritten digits with no labels. You want to group similar-looking digits together without knowing what digit each image represents. Which learning paradigm should you use?**

   Answer: Unsupervised learning, specifically clustering, because there are no labels and the goal is to discover natural groupings in the data.

4. **Your model achieves 100% accuracy on the training data but only 60% on the test data. What is happening, and how would you fix it?**

   Answer: The model is overfitting: it memorised the training data and fails to generalise. You can fix it by using a simpler model, adding regularisation, or increasing the size of the training dataset.

5. **What is the term for the process of using a trained model to make predictions on new, unseen data?**

   Answer: Inference. Training is the process of building the model; inference is using the trained model to generate predictions on new inputs.

---

Interactive version with quiz and diagrams: https://courseiva.com/learn/aws-machine-learning-specialty/ml-overview-and-core-concepts
