DropConnect 是 Hinton DropOut 之后出现的一种 Regularization 方法,相比DropOut的好处是,它在模型较小的情况下依然能保证准确度。苦于网络上很难找到python例子,这里贴出一个用 TensorLayer 实现的代码,以供参考。
import tensorflow as tf
import tensorlayer as tl # 注意!!! TensorLayer 现在更名为 TuneLayer 了 https://github.com/zsdonghao/tunelayer
from tensorlayer.layers import set_keep
import numpy as np
import time
X_train, y_train, X_val, y_val, X_test, y_test = \
tl.files.load_mnist_dataset(shape=(-1,784))
sess = tf.