Understanding the core ideas behind modern machine learning
Machine learning (ML) is a field of computer science where algorithms learn patterns from data instead of being explicitly programmed. ML powers recommendation systems, image recognition, fraud detection, language models, and more.
Supervised learning uses input–output pairs to train a model.
from sklearn.linear_model import LinearRegression
import numpy as np
X = np.array([[1], [2], [3], [4]])
y = np.array([2, 4, 6, 8])
model = LinearRegression()
model.fit(X, y)
print(model.predict([[5]]))
Unsupervised learning finds structure in data without labels.
from sklearn.cluster import KMeans
import numpy as np
data = np.array([[1,2],[1,4],[1,0],[10,2],[10,4],[10,0]])
kmeans = KMeans(n_clusters=2)
kmeans.fit(data)
print(kmeans.labels_)
Reinforcement learning trains an agent to make decisions by rewarding good actions and penalizing bad ones. It is used in robotics, games, and autonomous systems.
To evaluate a model, data is split into:
Two common problems in ML:
Now that you understand the basics of machine learning, you're ready to explore neural networks in Lesson 31: Introduction to Neural Networks.
← Back to Lesson Index