def load_features(thetapath=None): global visibleSize, hiddenSize, outputSize levels = [visibleSize, hiddenSize, outputSize] X = load_data() X, zca_white, avg = zca_whitening(X) print X.shape, zca_white.shape, avg.shape init_theta = initialization(levels) theta = train(init_theta, X, X, levels, thetapath) WB = vec2mat(theta, levels) print 'W shape:', WB[0][0].shape return WB, zca_white, avg
return theta def load_features(thetapath=None): global visibleSize, hiddenSize, outputSize levels = [visibleSize, hiddenSize, outputSize] X = load_data() X, zca_white, avg = zca_whitening(X) print X.shape, zca_white.shape, avg.shape init_theta = initialization(levels) theta = train(init_theta, X, X, levels, thetapath) WB = vec2mat(theta, levels) print 'W shape:', WB[0][0].shape return WB, zca_white, avg if __name__ == '__main__': levels = [visibleSize, hiddenSize, outputSize] X = load_data() print X.shape X, zca_white, _ = zca_whitening(X) print X.shape init_theta = initialization(levels) theta = train(init_theta, X, X, levels) if theta is not None: WB = vec2mat(theta, levels) print 'W shape:', WB[0][0].shape v = WB[0][0].dot(zca_white) print v.shape sio.savemat('W', {'W': v})