Introduction to Machine Learning
by Albert Major
- What is Machine Learning?
- Computers learn patterns from data and improve with experience.
- The goal is to make predictions or decisions based on data.
- Example: Spam filter learns to classify emails as spam or not spam.
- Key Idea
- Machine learning is about optimization.
- We try to minimize error between predictions and actual outcomes.
Example: Dogs (Labrador vs Greyhound)
- Suppose we want to classify dogs by height.
- If height > 25 cm, predict Greyhound, otherwise Labrador.

- This works, but not perfectly (some Labradors are tall, some Greyhounds are short).
- To improve: add more features (e.g., color, weight).
- More features = more accuracy, but also more computation and risk of overfitting.


This plot shows how a machine learning model separates two classes using two features (e.g., height and color). The red curve is the decision boundary: points on one side are predicted as one class (white), and points on the other side as the other class (black). The dashed lines show uncertainty around the boundary. It illustrates that models can learn complex, non-straight boundaries to better classify data.
Three Main Types of Machine Learning
Supervised Learning
- Data includes both input features and labels.
- Example: Images of dogs labeled as “Labrador” or “Greyhound.”
- Task: Learn a mapping from input → label.
- Used for classification (categorical labels) and regression (numeric labels).


This slide shows how supervised learning is used in medicine with images. In classification, the model decides if there is a fracture or not. In detection, it highlights where a structure (like the scaphoid bone) is. In segmentation, it marks the exact pixels of a lesion. In semantic segmentation, it labels different parts of the scan by type (e.g., spine sections). It shows how machine learning can move from simple yes/no answers to detailed image analysis.
Unsupervised Learning
- Data has no labels.
- The algorithm finds patterns or groups.
- Example: Grouping cats by size without knowing labels.
- Includes clustering, outlier detection, topic discovery.
Reinforcement Learning
- An agent interacts with an environment.
- Learns by trial and error, guided by rewards.
- Example: A robot vacuum bumps into walls, then learns a better path.
- Famous example: AlphaGo playing the game Go.
Why Machine Learning is Growing
- Explosion of data, especially unstructured (images, text, social media).
- Improved computational power (stronger computers, GPUs).
- Better algorithms and more research.
Workflow of Supervised Learning
-
Collect and explore data.
-
Pre-process data (cleaning, scaling, handling missing values).
-
Split data into training set and test set.
- Train model on training data.
- Test model on unseen data to check generalization.
-
If model only works on training data but fails on test data → overfitting.

This diagram shows the workflow of building and using a machine learning model. Data from users is collected (data ingestion) and cleaned or transformed to be usable. The cleaned data is split into training data for building the model and test data for evaluation. The model is trained, then tested on unseen test data to check performance. If the results are good, the model is deployed for real use. If not, feedback loops send results back to improve the process, either by retraining or refining data and transformations.
Terminology
- Instance / Data point: One example (e.g., one dog image).
- Label: The correct answer (e.g., “Greyhound”).
- Features: Properties of the instance (height, color, weight).
- Feature vector: All features listed together in numeric form.
- Model: The trained mapping from input to output.
- Feature selection: Choose a subset of features.
- Feature extraction: Transform features into a smaller set (e.g., PCA).
Classification vs Regression
Classification → Predict categories.
- Example: Cat is “sleepy” or “active.”
Regression → Predict numbers.
- Example: Number of hours a cat sleeps.
Dummy Models (Baselines)
Dummy classifier / regressor makes random or simple predictions.
- Used as a baseline: your model should perform better than this.
Data Representations
-
Images
-
Text
-
Famous Datasets in scikit-learn
Feature Importance
- Some features are better at separating classes.
- Example: In breast cancer dataset:
- Good models combine features to improve predictions.
Scaling Data
- Features often have very different scales.
- Without scaling, large features dominate calculations.
- Scaling makes features comparable.
Types of Scaling:
- Robust Scaler
- Min-Max Scaler
- Normalizer