1. Statistical Classification

Problem Type Memo with Demo

Binary Classification

  • 目标(target)是两种选项(option)之一;

  • 如根据ECG判断某人是否患有心脏病;

Multi Class Classification

  • 目标(target)是多种选项(多于两种)之一;

  • 如根据核酸检测判断是真阴,真阳,假阴还是假阳;
    判断图片是猫,狗,还是鸡等;

Multi Label Classification

  • 目标可分配(assign)为多种选项,

  • 预测文章的类别,如数学,科学,哲学;

2. Classification Problem

  • 分类Classification和回归Regression(预测数字)是常见ML问题类型;

Topic Content

0:NN Classification Architecture

  • NN可以有几乎任何形状shape或大小size;

  • 但它们通常遵循类似follow similar的floor plan;

1:Getting Binary Classification Data Ready

  • 数据可为任何事物,但先创建简单的二进制分类数据集;

  • simple binary classification dataset;

2:Building PyTorch Classification Model

  • 创建模型以学习数据中的模式(pattern);

  • 并选择一个损失函数,优化器;

  • 并构建一个特定于分类的训练循环;

  • create model to learn pattern in data;

  • choose loss functionoptimizer and build
    training loop specific to classification;

3:Fitting Model to Data(Training)

  • 我们有数据和模型,
    现让模型(尝试)在(训练)数据中找模式;

  • we have data and model,let model (try to)
    find pattern in (training) data;

4:Prediction and Evaluating(Inference)

  • 模型在数据中已发现模式,
    将其发现与实际(测试)数据比较;

  • model found pattern in data,compare its
    finding to actual (testing) data;

5:Improving Model
(from Model Perspective)

  • 已训练一个评估过的模型,但它不起作用,尝试改进;

  • trained evaluated model,
    but not working,try to improve;

6:Non Linearity

  • 目前模型只能对直线建模,那非线性(非直线)呢?

  • model only ability to model straight line,
    what about non-linear(non-straight) line?

7:Replicating Non Linearity Function

  • 用非线性函数来帮助对非线性数据建模,
    non-linear function

8:Together MultiClass Classification

  • 将二进制分类与多类分类问题放在一起;

  • puting binary classification together
    with multi-class classification problem;

3. Abbreviation

  • SGD:stochastic gradient descent;

  • ReLU:rectified linear unit

5. NNC Architecture

Hyperparameter Binary Classification Multiclass Classification

Input Layer Shape
(in_features)

与特征数量相同,如心脏病预测:
年龄、性别、身高、体重、吸烟状况为5

同binary classification

Hidden Layer(s)

特定问题,最小(minimum)=1,
最大(maximum)=无限制(unlimited),

同binary classification

Neuron Per Hidden Layer

generally(通常)10 to 512

同binary classification

Output Layer Shape
(out_features)

1(one class or the other)

1 per class,
如3 for food,person or dog photo)

Hidden Layer Activation

通常ReLU(整流线性单元);

同binary classification

Output Activation

Sigmoid:torch.sigmoid

Softmax:torch.softmax

Loss Function

Binary Crossentropy:torch.nn.BCELoss

Cross Entropy:torch.nn.CrossEntropyLoss

Optimizer

SGD,Adam:torch.optim

同binary classification