Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Just fixed the problem. I commented out the matplotlib because I'm us…
…ing a virtual environment and it has problems with that. Otherwise, the more concerning problem of the dimension was resolved by defining the correct definitino of the input and out of the generative model and the input of the discriminator model. I use defining the input as 2-D matrix instead of 1-D vector by accident. It turns out (R, 1) and (R,) mean different things! Where the former is a 2-D matrix, and later is a 1-D vector. Super thanks to this help of understanding the shape system in Numpy (https://stackoverflow.com/questions/22053050/difference-between-numpy-array-shape-r-1-and-r)
  • Loading branch information
rjm11010 committed Dec 15, 2017
1 parent ec3967e commit 1a09133
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gan/gan.py
Expand Up @@ -4,7 +4,7 @@ import os
import numpy as np
import pandas as pd
from sklearn.cross_validation import train_test_split
import matplotlib.pyplot as plt
# import matplotlib.pyplot as plt
# Nuerual Net Building
from keras import layers
from keras.layers import Input, Dense, Dropout, InputLayer, Reshape
Expand Down Expand Up @@ -45,8 +45,8 @@ x_train = all_data.iloc[:, np.arange(20)]
# Data Variables
input_dimension = x_train.shape[1] # Number of features (e.g. genes)

gen_input_shape = (1, input_dimension)
discr_input_shape = (1, input_dimension)
gen_input_shape = (input_dimension,)
discr_input_shape = (input_dimension,)

epochs = 10
batch_size = x_train.shape[0]
Expand Down Expand Up @@ -95,7 +95,7 @@ training_record = model.fit(x=x_train, y=gan_targets(x_train.shape[0]), epochs=e

# Predict (i.e. produce new samples)
zsamples = np.random.normal(size=(1, input_dimension))
pred = generator.predict(zsamples)
pred = generative_model.predict(zsamples)
print(pred)

# Save new samples to file
Expand Down

0 comments on commit 1a09133

Please sign in to comment.