Some Tips/Tricks in Machine Learning

这篇不算是基础系列,只是在网上看见别人写的,感觉很不错,翻译的别人的英文
原文链接: 原文


数据集扩充

对于深度的NN来说,数据集过小会很容易造成Overfitting,扩充数据集的方法通常有以下几种:

horizontally flipping
random crops
color jittering

预处理(normalization)

常见的有一下三种:

减去均值
zscore
白化(whittening)

效果逐步增强

减去均值

 >> x -= np..mean(X, axis = 0) # zero-center

zscore

就是减去均值,除以标准差

>> X -= np.mean(X, axis = 0) # zero-center
>> X /= np.std(X, axis = 0) # normalize

白化(whitening)

两种白化的操作:

  1. PCA白化
  2. ZCA白化

首先,需要求出协方差矩阵和方向向量(u1,u2),将原始的数据点使用u1u2来表示,得到新的坐标(投影)

PCA whitening

pca白化是指对上面的pca的新坐标X’,每一维的特征做一个标准差归一化处理

PCA whitening form 1

或者是:

PCA whitening form 2

ZCA whitening

ZCA白化是在PCA白化的基础上,又进行处理的一个操作。具体的实现是把上面PCA白化的结果,又变换到原来坐标系下的坐标:

zca whitening

权重的初始化

初始化为全0,是错误的做法

一般采用两种方法:

Small Random Numbers

初始化为随机的接近0的小数

>> 0.01 * N(0,1)    #N(0,1)表示均值为0的标准高斯分布

Calibrating the Variances

方差(variance)为2/n

>> w = np.random.randn(n) * sqrt(2.0/n) # current recommendation

Training

Filter size

训练图片的大小是2的倍数的时候,比如32,64,224,512等

it is important to employ a small filter (e.g., 3*3) and small strides (e.g., 1) with zeros-padding, which not only reduces the number of parameters, but improves the accuracy rates of the whole deep network. Meanwhile, a special case mentioned above, i.e., 3*3 filters with stride 1, could preserve the spatial size of images/feature maps. For the pooling layers, the common used pooling size is of 2*2.

Learning rate

推荐使用mini-batch的方式进行训练,初始的lr典型为0.1
对于validation set来说,没什么作用的话,可以将lr/2或者lr/5来试试

Fine-tune on pre-trained models

推荐使用VGG的网络

table 1

Activation Functions

  • sigmoid很少用,不推荐(kill gradients, not zero-centered)
  • tanhsigmoid要好(is zero-centered)
  • ReLU系列: ReLU,PReLU,Leaky ReLU,RReLU,中推荐使用PReLU and RReLU

Regularizations

L1正则

l1正则

L2正则

l2正则

l2正则一般情况下优于l1正则

Dropout

0.5的概率值是典型的做法

数据倾斜

常用的解决方法:

sampling techniques

1. duplicating instances(maybe special crops processing) from the minority classes until a balanced distribution is reached (oversampling)
2. removing instances from over-represented classes (undersampling)
3. it is suggested that a combination is the best solution for extremely imbalanced distributions
4. generating new data in minority classes based on the current data

cost sensitive techniques

a higher penalty can be given to the network when it misclassifies the minority classes during training

One-class learning

  1. only provides training data from a single class(每一类去训练,不停的fine-tuning)
  2. firstly fine-tune on the classes which have a large number of training samples (images/crops), and secondly, continue to fine-tune but on the classes with limited number samples
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
深度学习tricks是指在深度学习模型训练过程中使用的一些技巧和策略,旨在提高模型的性能和训练效果。以下是一些常用的深度学习tricks: 1. 数据增强(Data Augmentation):通过对原始数据进行随机变换和扩充,生成更多的训练样本,以增加模型的泛化能力。 2. 批归一化(Batch Normalization):在每个小批量数据上进行归一化操作,有助于加速模型的收敛速度,提高模型的稳定性和泛化能力。 3. 学习率调整(Learning Rate Schedule):根据训练的进程动态地调整学习率,例如使用学习率衰减或者学习率预热等策略,以提高模型的收敛性能。 4. 正则化(Regularization):通过添加正则化项,如L1正则化或L2正则化,限制模型的复杂度,防止过拟合。 5. 提前停止(Early Stopping):在训练过程中监控验证集上的性能指标,当性能不再提升时停止训练,以避免过拟合。 6. 参数初始化(Parameter Initialization):合适的参数初始化可以帮助模型更快地收敛和更好地泛化,常用的初始化方法包括Xavier初始化和He初始化等。 7. 梯度裁剪(Gradient Clipping):限制梯度的范围,防止梯度爆炸或梯度消失问题,提高模型的稳定性。 8. 集成学习(Ensemble Learning):通过结合多个模型的预测结果,可以提高模型的泛化能力和鲁棒性。 9. 迁移学习(Transfer Learning):利用已经训练好的模型在新任务上进行微调,可以加快模型的训练速度和提高模型的性能。 10. 深度网络结构设计:合理设计网络结构,包括层数、宽度、卷积核大小等,可以提高模型的表达能力和学习能力。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值