Chapter 22 of 30
Keep learning and build your Data Science skills.
Machine Learning Basics
Learn the fundamental concepts of Machine Learning used in Data Science.
Theory
Machine Learning allows computers to learn patterns from data and make predictions or decisions.
Major learning approaches include:
• Supervised Learning
• Unsupervised Learning
• Reinforcement Learning
Important concepts include:
• Features
• Labels
• Training data
• Test data
• Models
• Predictions
• Evaluation
Example
from sklearn.linear_model import LinearRegression
X = [[1], [2], [3]]
y = [2, 4, 6]
model = LinearRegression()
model.fit(X, y)
print(model.predict([[4]]))Output
The model learns from the training examples and predicts a new value.
Practice
Build a simple machine learning model using a small dataset.
Interview Questions
1
What is Machine Learning?
2
What are features?
3
What is training data?
4
What is test data?
Quick Quiz
Which option best describes this chapter?
A.Learning patterns from data
B.Writing only HTML
C.Managing hardware
D.Creating database tables