You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

774 lines
43 KiB
Python

"""
5 years ago
from data.params import SYS_ARGS
self.G_STRUCTURE = [self.Z_DIM,self.Z_DIM]
self.mkdir (os.sep.join([self.log_dir,key,self.CONTEXT,str(args['partition'])]))
if not os.path.exists(os.sep.join(root)) :
x = x + h2
# This seems to be the output layer
#
kernel = self.get.variables(name='W_' + str(i+1), shape=[self.Z_DIM, self.X_SPACE_SIZE])
bias = self.get.variables(name='b_' + str(i+1), shape=[self.X_SPACE_SIZE])
x = tf.nn.sigmoid(tf.add(tf.matmul(x, kernel), bias))
return x
grads = self.average_gradients(tower_grads)
for i in range(self.STEPS_PER_EPOCH):
for _ in range(2):
_, w = sess.run([train_d, w_distance])
w_sum += w
sess.run(train_g)
duration = time.time() - start_time
assert not np.isnan(w_sum), 'Model diverged with loss = NaN'
format_str = 'epoch: %d, w_distance = %f (%.1f)'
print(format_str % (epoch, -w_sum/(self.STEPS_PER_EPOCH*2), duration))
# print (dir (w_distance))
logs.append({"epoch":epoch,"distance":-w_sum/(self.STEPS_PER_EPOCH*2) })
self.logger.write(row)
self.ROW_COUNT = self.oROW_COUNT
def apply(self,**args):
# The code below will insure we have some acceptable cardinal relationships between id and synthetic values
#
# df = pd.DataFrame(np.round(f)).astype(np.int32)
p = 0 not in df.sum(axis=1).values