You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Supervised learning is the most common and widely used type of machine learning. In supervised learning, the algorithm is trained on labelled data — a dataset where each example has both input features and a known correct output (the label). The goal is to learn a mapping function that can predict the output for new, unseen inputs.
The supervised learning process follows these steps:
from sklearn.model_selection import train_test_split
# X = features, y = labels
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42
)
model.fit(X_train, y_train) # Train
predictions = model.predict(X_test) # Predict
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.