def load_dbn(path='models/oulu_ae.mat'):
"""
load a pretrained dbn from path
:param path: path to the .mat dbn
:return: pretrained deep belief network
"""
# create the network using weights from pretrain_nn.mat
nn = sio.loadmat(path)
w1 = nn['w1']
w2 = nn['w2']
w3 = nn['w3']
w4 = nn['w4']
b1 = nn['b1'][0]
b2 = nn['b2'][0]
b3 = nn['b3'][0]
b4 = nn['b4'][0]
weights = [w1, w2, w3, w4]
biases = [b1, b2, b3, b4]
nonlinearities = [rectify, rectify, rectify, linear]
shapes = [2000, 1000, 500, 50]
return weights, biases, shapes, nonlinearities
评论列表
文章目录