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
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值