将类别标签分配给输入示例的分类预测模型
二分类是指预测两个类别之一,而多分类则涉及预测两个以上类别之一。
多标签分类涉及为每个示例预测一个或多个类别,不平衡分类是指各个类别之间的示例分布不相等的分类任务。
给定一个示例,将其归为垃圾邮件或者非垃圾邮件。
给定一个手写字符,将其分类为一个已知字符。
根据最近的用户行为,将其归为流失用户或者非流失用户。
二分类
多类别分类
多标签分类
不平衡分类
电子邮件垃圾邮件检测(是否为垃圾邮件)。
用户的流失预测(流失与否)。
用户的转化预测(购买或不购买)。
逻辑回归
k最近邻算法
决策树
支持向量机
朴素贝叶斯
# example of binary classification task
from numpy import where
from collections import Counter
from sklearn.datasets import make_blobs
from matplotlib import pyplot
# define dataset
X, y = make_blobs(n_samples=1000, centers=2, random_state=1)
# summarize dataset shape
print(X.shape, y.shape)
# summarize observations by class label
counter = Counter(y)
print(counter)
# summarize first few examples
for i in range(10):
print(X[i], y[i])
# plot the dataset and color the by class label
for label, _ in counter.items():
row_ix = where(y == label)[0]
pyplot.scatter(X[row_ix, 0], X[row_ix, 1], label=str(label))
pyplot.legend()
pyplot.show()

人脸识别。
植物种类识别。
光学字符识别。
k最近邻算法。
决策树。
朴素贝叶斯。
随机森林。
梯度提升。
一对多:针对每个类别与所有其他类别拟合一个二分类模型。
一对一:为每对类别设计一个二分类模型。
逻辑回归。
支持向量机。
# example of multi-class classification task from numpy import where from collections import Counter from sklearn.datasets import make_blobs from matplotlib import pyplot # define dataset X, y = make_blobs(n_samples=1000, centers=3, random_state=1) # summarize dataset shape print(X.shape, y.shape) # summarize observations by class label counter = Counter(y) print(counter) # summarize first few examples for i in range(10): print(X[i], y[i]) # plot the dataset and color the by class label for label, _ in counter.items(): row_ix = where(y == label)[0] pyplot.scatter(X[row_ix, 0], X[row_ix, 1], label=str(label)) pyplot.legend() pyplot.show()

多标签决策树
多标签随机森林
多标签梯度增强
# example of a multi-label classification task from sklearn.datasets import make_multilabel_classification # define dataset X, y = make_multilabel_classification(n_samples=1000, n_features=2, n_classes=3, n_labels=2, random_state=1) # summarize dataset shape print(X.shape, y.shape) # summarize first few examples for i in range(10): print(X[i], y[i])
诈骗识别。
离群值检测。
医学诊断测试。
随机欠采样。
SMOTE过采样。
成本敏感的Logistic回归。
成本敏感的决策树。
成本敏感的支持向量机。
准确率。
召回率。
F值。
# example of an imbalanced binary classification task from numpy import where from collections import Counter from sklearn.datasets import make_classification from matplotlib import pyplot # define dataset X, y = make_classification(n_samples=1000, n_features=2, n_informative=2, n_redundant=0, n_classes=2, n_clusters_per_class=1, weights=[0.99,0.01], random_state=1) # summarize dataset shape print(X.shape, y.shape) # summarize observations by class label counter = Counter(y) print(counter) # summarize first few examples for i in range(10): print(X[i], y[i]) # plot the dataset and color the by class label for label, _ in counter.items(): row_ix = where(y == label)[0] pyplot.scatter(X[row_ix, 0], X[row_ix, 1], label=str(label)) pyplot.legend() pyplot.show()

https://en.wikipedia.org/wiki/Statistical_classification
将类别标签分配给输入示例的分类预测模型
二分类是指预测两个类别之一,而多分类则涉及预测两个以上类别之一。
多标签分类涉及为每个示例预测一个或多个类别,不平衡分类是指各个类别之间的示例分布不相等的分类任务。
原文标题:
4 Types of Classification Tasks in Machine Learning
原文链接:
https://machinelearningmastery.com/types-of-classification-in-machine-learning/