Introduction to Machine Learning
Machine Learning Fundamentals with Python
2 min read
This section is 2 min read, full guide is 29 min read
Published Nov 16 2025
10
Show sections list
0
Log in to enable the "Like" button
0
Guide comments
0
Log in to enable the "Save" button
Respond to this guide
Guide Sections
Guide Comments
ClusteringImagesK-MeansLinear RegressionLogistic RegressionMachine LearningNeural NetworksNLPNumPyPythonRandom Forestsscikit-learnSupervised LearningUnsupervised Learning
What is Machine Learning?
Machine Learning (ML) is a way of teaching computers to find patterns in data and make predictions or decisions without being explicitly programmed for every task.
Instead of hard-coding rules, we give the computer examples (data) and let it learn from them.
Examples of ML applications:
- Predicting house prices based on past sales
- Classifying emails as spam or not spam
- Recommending movies or products
- Recognising objects in images
- Translating text from one language to another
At its core, ML involves training a model using data, and then using that model to make predictions on new, unseen data.
The Basic ML Workflow
- Collect data — gather examples of the problem you’re solving.
- Prepare data — clean, organise, and transform data into a usable form.
- Train a model — fit an algorithm to your training data.
- Evaluate performance — test how well the model performs on new data.
- Deploy and improve — use the model in real applications and retrain as needed.
Example: Teaching a Model to Predict House Prices
Suppose we have data about houses, each example includes:
size_in_sqftnumber_of_bedroomsdistance_to_city_centerprice
Our goal: predict price based on the other features.
Simple Python example:
import numpy as np
from sklearn.linear_model import LinearRegression
# Example data (in real life this comes from a dataset)
# size, bedrooms, distance_from_city_center
X = np.array([
[1000, 2, 5],
[1500, 3, 3],
[800, 2, 7],
[1200, 3, 4],
[2000, 4, 2]
])
# Prices (in thousands)
y = np.array([200, 300, 180, 250, 400])
# Create and train a simple linear regression model
model = LinearRegression()
model.fit(X, y)
# Predict price for a new house
new_house = np.array([[1300, 3, 3]])
predicted_price = model.predict(new_house)
print(f"Predicted price for new house: £{predicted_price[0]*1000:.2f}")
Copy to Clipboard
Toggle show comments
Explanation:
- We created some small example data.
- We used Scikit-learn’s
LinearRegressionmodel. - We trained the model (
fit) and then predicted for a new example (predict).
This simple exercise captures the essence of ML — learn from data, then generalise to new cases.
Key Terms to Remember
Feature- An input variable (e.g., house size, number of rooms)Label / Target- The value we want to predict (e.g., house price)Training Data- Data used to teach the modelTesting Data- Data used to evaluate how well the model generalisesModel- The mathematical representation of what the computer has learned














