Created
April 14, 2016 23:22
-
-
Save dansbecker/67be6646f2fb8daa4856b61a9cb08366 to your computer and use it in GitHub Desktop.
Non-functioning autoencoder, with an error that surprises me.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from keras.models import Model | |
from keras.layers import Input, Dense | |
input_size = 1000 | |
n_obs = 200 | |
encoding_size = 50 | |
x = Input(shape=(input_size,)) | |
z = Dense(encoding_size, activation='sigmoid', name='z')(x) | |
x_reconstruction = Dense(input_size, activation='sigmoid', name='x_reconstruction')(z) | |
model = Model(input=x, output=[z, x_reconstruction]) | |
model.compile(loss = 'mse', | |
loss_weight = {'z': 0, 'x_reconstruction': 1}, | |
optimizer='Adam') | |
data=np.random.rand(n_obs * input_size).reshape(n_obs, input_size) | |
#data = np.load('/Users/dan/Downloads/datarobot_text_features/datarobot_home_depot_search_term_features.npy') | |
model.fit(x = data, y = {'x_reconstruciton': data, 'z': np.zeros([n_obs, encoding_size])}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Was a typo in call to fit:
x_reconstruciton