Loading…
Glossary term
Learning from examples that come with correct answers, so the model learns to map inputs to labels.
In supervised learning every training example comes with the right answer. The model makes a guess, compares it with the label, and adjusts so that next time the guess is closer.
It splits into classification (predict a category) and regression (predict a number).
Supervised learning with scikit-learn
from sklearn.neighbors import KNeighborsClassifier
model = KNeighborsClassifier(n_neighbors=3)
model.fit(X_train, y_train) # learn from labelled examples
print(model.score(X_test, y_test)) # accuracy on unseen dataIt is the most widely used form of machine learning in business, behind fraud detection, medical imaging and many forecasting tools.