autoencoder

how to reshape text data to be suitable for LSTM model in keras

点点圈 提交于 2019-11-28 08:12:47
问题 Update1: The code Im referring is exactly the code in the book which you can find it here. The only thing is that I don't want to have embed_size in the decoder part. That's why I think I don't need to have embedding layer at all because If I put embedding layer, I need to have embed_size in the decoder part(please correct me if Im wrong). Overall, Im trying to adopt the same code without using the embedding layer, because I need o have vocab_size in the decoder part. I think the suggestion

Sparse Matrix from a dense one Tensorflow

拜拜、爱过 提交于 2019-11-27 23:57:01
I am creating a convolutional sparse autoencoder and I need to convert a 4D matrix full of values (whose shape is [samples, N, N, D] ) into a sparse matrix. For each sample, I have D NxN feature maps. I want to convert each NxN feature map to a sparse matrix, with the maximum value mapped to 1 and all the others to 0. I do not want to do this at run time but during the Graph declaration (because I need to use the resulting sparse matrix as an input to other graph operations), but I do not understand how to get the indices to build the sparse matrix. You can use tf.where and tf.gather_nd to do

How do you decide the parameters of a Convolutional Neural Network for image classification?

两盒软妹~` 提交于 2019-11-27 09:33:22
问题 I am using Convolutional Neural Networks (Unsupervised Feature learning to detect features + Softmax Regression Classifier) for image classification. I have gone through all the tutorials by Andrew NG in this area. (http://ufldl.stanford.edu/wiki/index.php/UFLDL_Tutorial). The network that I have developed has an : Input layer - size 8x8 (64 neurons) Hidden layer - size 400 neurons Output layer - size 3 I have learnt the weights connecting the input layer to the hidden layer using a sparse

Sparse Matrix from a dense one Tensorflow

非 Y 不嫁゛ 提交于 2019-11-27 04:43:24
问题 I am creating a convolutional sparse autoencoder and I need to convert a 4D matrix full of values (whose shape is [samples, N, N, D] ) into a sparse matrix. For each sample, I have D NxN feature maps. I want to convert each NxN feature map to a sparse matrix, with the maximum value mapped to 1 and all the others to 0. I do not want to do this at run time but during the Graph declaration (because I need to use the resulting sparse matrix as an input to other graph operations), but I do not

用Keras搭建神经网络 简单模版(六)——Autoencoder 自编码

落花浮王杯 提交于 2019-11-27 00:51:52
import numpy as np np.random.seed(1337) from keras.datasets import mnist from keras.models import Model from keras.layers import Dense, Input import matplotlib.pyplot as plt (x_train,y_train),(x_test,y_test) = mnist.load_data() x_train = x_train.astype('float32') / 255.-0.5 #(-0.5,0.5)的区间 x_test = x_test.astype('float32') / 255.-0.5 x_train = x_train.reshape((x_train.shape[0],-1)) x_test = x_test.reshape((x_test.shape[0],-1)) print(x_train.shape) print(x_test.shape) # 最终压缩成2个 encoding_dim = 2 # 输入 input_img = Input(shape=(784,)) # encoder layers encoded = Dense(128, activation='relu')(input