Machine Learning Introduction
Arthur Samuel (1959)
“Machine Learning is the field of study that gives computers the ability to learn without being explicitly programmed.”
What is Machine Learning?
Machine Learning is a subset of artificial intelligence that enables systems to learn and improve from experience. Instead of explicit programming, ML algorithms build mathematical models based on training data.
Types of Machine Learning
graph TD A[Machine Learning] --> B[Supervised Learning] A --> C[Unsupervised Learning] A --> D[Reinforcement Learning] B --> E[Classification] B --> F[Regression] C --> G[Clustering] C --> H[Dimensionality Reduction] D --> I[Policy Learning] D --> J[Q-Learning]
Supervised Learning
In supervised learning, we have labeled data:
Where:
- is the target variable
- represents features
- is noise
Linear Regression
The simplest model:
from sklearn.linear_model import LinearRegression
import numpy as np
# Sample data
X = np.array([[1], [2], [3], [4], [5]])
y = np.array([2, 4, 5, 4, 5])
# Train model
model = LinearRegression()
model.fit(X, y)
# Predict
print(f"Coefficient: {model.coef_[0]:.2f}")
print(f"Intercept: {model.intercept_:.2f}")Unsupervised Learning
No labels provided — the algorithm finds patterns:
from sklearn.cluster import KMeans
kmeans = KMeans(n_clusters=3, random_state=42)
clusters = kmeans.fit_predict(data)K-Means Algorithm
- Initialize centroids randomly
- Assign each point to nearest centroid
- Recalculate centroids as mean of assigned points
- Repeat until convergence
Neural Networks
Deep Learning
Neural networks with multiple hidden layers are called “deep” neural networks. They form the basis of modern AI applications.
The forward pass of a neural network:
Where is an activation function like ReLU:
Evaluation Metrics
| Metric | Use Case | Formula |
|---|---|---|
| Accuracy | Classification | |
| Precision | When FP is costly | |
| Recall | When FN is costly | |
| F1 Score | Balanced measure |
Common Mistake
Don’t confuse correlation with causation! A model might find spurious patterns in training data that don’t generalize. See Book Notes - Thinking Fast and Slow for cognitive biases that affect data interpretation.
Learning Path
My ML Journey
- Python basics — see Web Development Basics
- Linear regression
- Classification algorithms
- Deep learning with PyTorch
- Natural Language Processing
- Computer Vision
Related Notes
- How I Take Notes — Organizing ML study materials
- Git Version Control — Version controlling ML experiments
- Docker Containerization — Reproducible ML environments
*Tags: machine-learning ai python data-science