Machine Learning Fundamentals: Start Here¶
← Back to the PMLE Learning Path
This guide is for learners who are completely new to machine learning. You do not need a data science degree, advanced mathematics, or previous ML experience to begin.
The goal is to build enough understanding to follow the six PMLE domains and their Google Cloud examples. Learn the ideas here first; then use the short, domain-specific prerequisite notes in each chapter.
You do not need to master everything before starting
Focus on the beginner essentials and complete the Iris example. Advanced calculus, deep learning research, and complex statistics are not prerequisites for the introductory BigQuery ML lab. You can learn deeper mathematics when a later topic requires it.
Learning roadmap¶
The path below shows how the foundations connect to the PMLE course.
flowchart TD
A["Start: No ML experience"] --> B["Programming basics: Python"]
B --> C["Data basics: rows, columns, features, labels"]
C --> D["Math intuition: averages, percentages, vectors"]
D --> E["ML concepts: supervised and unsupervised learning"]
E --> F["Model workflow: split, train, evaluate, predict"]
F --> G["Hands-on: Iris classification with scikit-learn"]
G --> H["Domain 1: BigQuery ML and low-code AI"]
H --> I["Domains 2–6: data, training, serving, pipelines, monitoring"]
1. What is machine learning?¶
Traditional programming uses rules written by a person. Machine learning uses examples (data) to learn a pattern that can make predictions about new examples.
Example:
- Traditional programming: write a rule such as "if the email contains these words, mark it as spam."
- Machine learning: show a model thousands of emails labelled "spam" or "not spam." The model learns patterns from those examples and predicts the label for a new email.
A model does not understand the world like a human. It learns statistical patterns from the data it is given. Poor, biased, or incomplete data can lead to poor predictions.
AI, machine learning, deep learning, and generative AI¶
flowchart TD
AI["Artificial Intelligence (AI)"]
ML["Machine Learning (ML)"]
DL["Deep Learning"]
GenAI["Generative AI"]
AI --> ML
ML --> DL
DL --> GenAI
- Artificial intelligence (AI): the broad field of building systems that perform tasks associated with human intelligence.
- Machine learning (ML): a part of AI where systems learn patterns from data.
- Deep learning: a part of ML that uses multi-layer neural networks.
- Generative AI: models that generate content such as text, images, audio, video, or code. Many modern generative models use deep learning.
These terms are related, but they are not interchangeable.
2. Basic programming and tools¶
You should be comfortable with the following Python basics:
| Python concept | Why it matters in ML |
|---|---|
| Variables and data types | Store values, labels, and settings |
| Lists and dictionaries | Represent collections and records |
| Conditions and loops | Process and inspect data |
| Functions | Reuse preprocessing and prediction logic |
| Importing packages | Use NumPy, pandas, and ML libraries |
| Reading CSV files | Load a dataset for exploration |
You do not need advanced object-oriented programming to begin this course.
A tiny Python warm-up¶
Run this in a Python interpreter or notebook:
# A small dataset: study hours and exam results
study_hours = [1, 2, 3, 4, 5]
exam_scores = [45, 50, 61, 68, 82]
for hours, score in zip(study_hours, exam_scores):
print(f"Study hours: {hours}, exam score: {score}")
Expected output:
Study hours: 1, exam score: 45
Study hours: 2, exam score: 50
Study hours: 3, exam score: 61
Study hours: 4, exam score: 68
Study hours: 5, exam score: 82
This is data represented as two lists. Later, an ML model can learn whether study hours help predict an exam score. The small example is illustrative; five observations are not enough to build a reliable real-world model.
Set up a local learning environment¶
For the Python example later in this guide, use Python 3.10 or newer.
python3 --version
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install numpy pandas matplotlib scikit-learn
On Windows PowerShell, activate the environment with:
.venv\Scripts\Activate.ps1
Check the packages:
python -c "import numpy, pandas, sklearn; print('ML environment ready')"
You can use Jupyter Notebook or Google Colab instead of a local editor if you prefer a browser-based environment. The later Google Cloud labs have their own cloud prerequisites.
3. Understand data before learning models¶
A dataset is a collection of examples. In a table, each row usually represents one example and each column represents an attribute.
Consider a simplified house-price dataset:
| Size (sq ft) | Bedrooms | Location | Price |
|---|---|---|---|
| 800 | 2 | Suburb | 250000 |
| 1200 | 3 | City | 420000 |
| 1500 | 3 | City | 510000 |
| 950 | 2 | Suburb | 290000 |
- Row / record / example: one house.
- Column: one property of a house.
- Feature: an input used by the model, such as size or bedrooms.
- Label / target: the value we want the model to predict, such as price.
- Training data: examples used to teach the model.
- Inference data: new examples supplied after training to get predictions.
In this example, size, bedrooms, and location are features. Price is the label.
Common data types¶
- Numerical: age, price, temperature, quantity.
- Categorical: country, product type, colour.
- Text: reviews, support tickets, documents.
- Image / audio / video: media that may need specialized preprocessing or models.
- Date and time: timestamps, order dates, sensor readings.
A feature is not automatically useful just because it exists. It should be relevant, available at prediction time, and handled consistently.
4. Essential mathematics — intuition first¶
You only need a practical understanding of a few concepts to start.
Mean (average)¶
The mean is the sum of values divided by the number of values.
For scores 60, 70, and 80:
(60 + 70 + 80) / 3 = 70
The average is 70. A model may use averages as a simple baseline for numeric predictions.
Percentage¶
If 8 out of 10 predictions are correct:
(8 / 10) × 100 = 80%
That is 80% accuracy. Accuracy alone can be misleading when one class is much more common than another.
Range and standard deviation¶
- Range: maximum minus minimum.
- Standard deviation: a measure of how spread out values are around their mean.
These help you understand whether values are tightly grouped or widely spread. You will see these ideas when exploring data and scaling numerical features.
Vectors and matrices¶
- A vector is an ordered list of numbers, such as a house represented by
[1200, 3]for size and bedrooms. - A matrix is a table of numbers, such as many houses represented as rows and features as columns.
ML libraries represent datasets using these structures. You do not need to perform matrix calculations by hand for the beginner labs.
Probability¶
A probability is a value from 0 to 1 that represents how likely an event is under a model or assumption. For example, 0.9 means 90%. A classification model may return a probability for each possible class.
What about calculus and linear algebra?
Derivatives, gradients, matrix multiplication, and optimization become important for understanding neural networks and training in depth. They are useful later, but you can begin with BigQuery ML and basic scikit-learn without deriving these equations yourself.
5. Main types of machine learning¶
flowchart TD
ML["Machine Learning"]
ML --> SUP["Supervised learning"]
ML --> UNSUP["Unsupervised learning"]
ML --> RL["Reinforcement learning"]
SUP --> CL["Classification: predict a category"]
SUP --> REG["Regression: predict a number"]
UNSUP --> CLUS["Clustering: discover groups"]
UNSUP --> DIM["Dimensionality reduction: simplify features"]
RL --> AGENT["Agent learns through actions and rewards"]
| Type | What it learns | Example |
|---|---|---|
| Classification | Predict a category | Spam or not spam; flower species |
| Regression | Predict a number | House price; delivery time |
| Forecasting | Predict future values over time | Next month's demand |
| Clustering | Group similar examples without supplied labels | Customer segments |
| Reinforcement learning | Learn actions from rewards and penalties | A game-playing agent |
Forecasting is often treated as a time-series prediction problem. The exact model and approach depend on the data and business requirement.
6. The machine learning workflow¶
A typical supervised ML workflow looks like this:
flowchart TD
A["Define the problem"] --> B["Collect and understand data"]
B --> C["Clean and prepare data"]
C --> D["Choose features and label"]
D --> E["Split data"]
E --> F["Train a baseline model"]
F --> G["Evaluate on unseen data"]
G --> H{"Good enough for the use case?"}
H -->|No| I["Improve data, features, or model"]
I --> F
H -->|Yes| J["Save and deploy model"]
J --> K["Predict on new data"]
K --> L["Monitor quality and data changes"]
Important terms in this workflow¶
- Training: the model learns patterns from training examples.
- Validation: data used to compare approaches or tune settings during development.
- Testing: a final, held-out dataset used to estimate how well the chosen model generalizes.
- Prediction / inference: using a trained model to produce an output for new input.
- Baseline: a simple reference model or rule that more complex approaches should beat.
- Hyperparameter: a setting chosen before or around training, such as model complexity or learning rate.
- Overfitting: the model memorizes training examples and performs poorly on new data.
- Underfitting: the model is too simple or insufficiently trained to capture useful patterns.
- Data leakage: information unavailable at real prediction time accidentally enters training or evaluation, making results look better than they should.
Why split the data?¶
If you train and evaluate on the same examples, the model may appear to perform well simply because it has already seen them. A held-out test set gives a more honest estimate of performance on unseen examples.
For a small introductory dataset, a common split is 80% training and 20% testing. Real projects may need separate training, validation, and test sets, time-based splits, or group-aware splits.
7. Metrics: how do we know whether a model is good?¶
The right metric depends on the problem and the cost of different mistakes.
Classification¶
- Accuracy: fraction of all predictions that are correct.
- Precision: among items predicted positive, how many are truly positive?
- Recall: among all truly positive items, how many did the model find?
- F1 score: a combined measure of precision and recall.
- Confusion matrix: counts correct and incorrect predictions by class.
For a disease-screening example, missing a true positive may be more serious than raising an extra alert. Recall may therefore matter more than accuracy alone.
Regression¶
- MAE (Mean Absolute Error): average absolute difference between predictions and actual values.
- MSE (Mean Squared Error): average squared difference; large errors are penalized more heavily.
- RMSE (Root Mean Squared Error): square root of MSE, expressed in the target's units.
- R²: compares the model with a simple mean-based baseline; interpret it in the context of the dataset and problem.
Model quality is not just a metric¶
Also consider data quality, fairness, explainability, latency, throughput, availability, security, and cost. A model with a high score may still be unsuitable for production.
8. Hands-on beginner example: classify Iris flowers¶
Now combine the concepts in one small project. The Iris dataset contains measurements of flowers and a species label. We will train a model to predict the species from the measurements.
This is a local learning exercise using scikit-learn. It builds intuition before the Google Cloud BigQuery ML lab; it does not create any Google Cloud resources.
Step 1 — Load and inspect the dataset¶
from sklearn.datasets import load_iris
iris = load_iris()
print("Features:", iris.feature_names)
print("Species:", iris.target_names)
print("Number of rows:", len(iris.data))
print("First row:", iris.data[0])
print("First label:", iris.target_names[iris.target[0]])
What to notice:
- Each row represents one flower.
- The four measurements are the features.
- The species is the label.
- There are three possible species classes.
Step 2 — Separate features and labels¶
X = iris.data
y = iris.target
print("Feature matrix shape:", X.shape)
print("Label array shape:", y.shape)
X contains the input measurements. y contains the answer the model should learn to predict.
Step 3 — Split training and test data¶
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(
X,
y,
test_size=0.2,
random_state=42,
stratify=y,
)
print("Training rows:", len(X_train))
print("Test rows:", len(X_test))
The model trains on the training rows. The test rows are held back until evaluation. stratify=y keeps the class proportions similar in both sets.
Step 4 — Train a simple classification model¶
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
model = make_pipeline(
StandardScaler(),
LogisticRegression(max_iter=500),
)
model.fit(X_train, y_train)
print("Training complete")
The pipeline scales the measurements and then trains logistic regression. Logistic regression is a classification algorithm despite the word "regression" in its name.
Step 5 — Evaluate the model on test data¶
from sklearn.metrics import (
accuracy_score,
classification_report,
confusion_matrix,
)
predictions = model.predict(X_test)
print("Accuracy:", accuracy_score(y_test, predictions))
print("\nConfusion matrix:")
print(confusion_matrix(y_test, predictions))
print("\nClassification report:")
print(classification_report(y_test, predictions, target_names=iris.target_names))
Your output reports how the model performed on the held-out test examples. Exact results can vary if you change the split or model settings. Do not treat one small dataset's score as proof that the model will work equally well in production.
Step 6 — Predict a new flower¶
new_flower = [[5.1, 3.5, 1.4, 0.2]]
predicted_class = model.predict(new_flower)[0]
probabilities = model.predict_proba(new_flower)[0]
print("Predicted species:", iris.target_names[predicted_class])
print("Class probabilities:")
for species, probability in zip(iris.target_names, probabilities):
print(f"{species}: {probability:.3f}")
The model returns a predicted species and a probability estimate for each class. These probabilities are model outputs, not guarantees.
What did you just do?¶
| ML concept | Where you used it |
|---|---|
| Dataset | load_iris() |
| Features | X |
| Label | y |
| Train/test split | train_test_split() |
| Preprocessing | StandardScaler() |
| Model | LogisticRegression() |
| Training | model.fit() |
| Evaluation | model.predict() and metrics |
| Inference | Predicting new_flower |
9. How these basics map to Google Cloud¶
The concepts do not change when you move from a laptop to Google Cloud. The tools and scale change.
| ML concept | Local example | Google Cloud learning path |
|---|---|---|
| Store and query data | CSV, pandas | BigQuery, Cloud Storage |
| Prepare data | pandas, scikit-learn | BigQuery SQL, Dataflow, Spark |
| Train a model | scikit-learn | BigQuery ML, Agent Platform training |
| Track experiments | Local scripts | Agent Platform Experiments and metadata |
| Deploy predictions | Python process | Agent Platform, Cloud Run, GKE |
| Automate steps | Python script | Agent Platform Pipelines, Cloud Build |
| Monitor quality | Metrics and reports | Model Monitoring and application telemetry |
The PMLE course introduces these services domain by domain. You do not need to learn every Google Cloud product before starting.
10. What to learn before each PMLE domain¶
After completing this common guide, use the focused prerequisite notes at the beginning of each domain:
- Domain 1 — Low-code AI: understand classification, regression, forecasting, clustering, and basic SQL. The BigQuery ML lab assumes your Google Cloud CLI and project are already configured.
- Domain 2 — Data and models: understand CSV/table structures, data types, basic Python data handling, missing values, and training/test splits.
- Domain 3 — Scaling model development: be comfortable with Python scripts and functions, model training, evaluation, and the idea of hyperparameters. Learn tensors and accelerator concepts when you reach those topics.
- Domain 4 — Serving and scaling: understand training versus inference, batch versus online requests, basic HTTP/API concepts, and what a container is.
- Domain 5 — ML pipelines: understand repeatable steps, dependencies, Python scripts, YAML/JSON configuration, and basic CI/CD concepts.
- Domain 6 — Monitoring AI: understand classification/regression metrics, data distributions, bias, drift, skew, and basic security concepts.
11. Beginner readiness checklist¶
You are ready to start Domain 1 when you can explain these in your own words:
- What machine learning is and how it differs from traditional rule-based programming.
- What a dataset, row, feature, and label are.
- The difference between classification and regression.
- Why data is split into training and test sets.
- What training, prediction, and evaluation mean.
- Why accuracy alone may not be enough.
- Run the Iris example and identify its features, label, model, and predictions.
If some items are unfamiliar, revisit the matching section and run the example again. You do not need to memorize every formula.
12. Glossary for beginners¶
| Term | Simple meaning |
|---|---|
| Algorithm | The method used to learn patterns |
| Model | The result of training an algorithm on data |
| Feature | An input column used to make a prediction |
| Label / target | The answer the model learns to predict |
| Training | Learning patterns from examples |
| Inference | Using a trained model to predict |
| Classification | Predicting a category |
| Regression | Predicting a number |
| Overfitting | Learning training examples too specifically |
| Data leakage | Accidentally using information that should not be available |
| Hyperparameter | A training/model setting selected outside the learned model parameters |
| Drift | A change in data or relationships that can reduce model quality |
Next step¶
Continue to the PMLE exam guide and objective map, then start Domain 1: Architecting Low-Code AI Solutions and its BigQuery ML classification lab.
📬 DevopsPilot Weekly — Learn DevOps, Cloud & Gen AI the simple way.
👉 Subscribe here