本文整理汇总了Python中rbm.RBM.transform方法的典型用法代码示例。如果您正苦于以下问题:Python RBM.transform方法的具体用法?Python RBM.transform怎么用?Python RBM.transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rbm.RBM
的用法示例。
在下文中一共展示了RBM.transform方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from rbm import RBM [as 别名]
# 或者: from rbm.RBM import transform [as 别名]
for g in range(epoch):
for it in range(len(inputData)):
trX = inputData[it][np.newaxis]
rbm1.partial_fit(trX)
print(rbm1.compute_cost(trX))
print(rbm1.compute_cost(trX))
rbm1.save_weights('./rbmw1.chp')
# Train Second RBM2
print('second rbm')
for g in range(epoch):
for it in range(len(inputData)):
trX = inputData[it][np.newaxis]
# Transform features with first rbm for second rbm
trX = rbm1.transform(trX)
rbm2.partial_fit(trX)
print(rbm2.compute_cost(trX))
print(rbm2.compute_cost(trX))
rbm2.save_weights('./rbmw2.chp')
print("Training Complete")
示例2: range
# 需要导入模块: from rbm import RBM [as 别名]
# 或者: from rbm.RBM import transform [as 别名]
for it in range(len(inputData)):
trX = inputData[it][np.newaxis]
rbm1.partial_fit(trX)
print(rbm1.compute_cost(trX))
print(rbm1.compute_cost(trX))
#show_image("1rbm.jpg", rbm1.n_w, (28, 28), (30, 30))
rbm1.save_weights('./rbmw1.chp')
# Train Second RBM2
print('second rbm')
for g in range(epoch):
for it in range(len(inputData)):
trX = inputData[it][np.newaxis]
# Transform features with first rbm for second rbm
trX = rbm1.transform(trX)
rbm2.partial_fit(trX)
print(rbm2.compute_cost(trX))
print(rbm2.compute_cost(trX))
#show_image("2rbm.jpg", rbmobject2.n_w, (30, 30), (25, 20))
rbm2.save_weights('./rbmw2.chp')
# Train Third RBM
print('third rbm')
for i in range(epoch):
for it in range(len(inputData)):
trX = inputData[it][np.newaxis]
# Transform features
trX = rbm1.transform(trX)
trX = rbm2.transform(trX)
rbm3.partial_fit(trX)
示例3: print
# 需要导入模块: from rbm import RBM [as 别名]
# 或者: from rbm.RBM import transform [as 别名]
print('first rbm')
for i in range(FLAGS.epochs):
for j in range(iterations):
batch_xs, batch_ys = mnist.train.next_batch(FLAGS.batchsize)
rbmobject1.partial_fit(batch_xs)
print(rbmobject1.compute_cost(trX))
show_image("out/1rbm.jpg", rbmobject1.n_w, (28, 28), (30, 30))
rbmobject1.save_weights('./out/rbmw1.chp')
# Train Second RBM2
print('second rbm')
for i in range(FLAGS.epochs):
for j in range(iterations):
batch_xs, batch_ys = mnist.train.next_batch(FLAGS.batchsize)
# Transform features with first rbm for second rbm
batch_xs = rbmobject1.transform(batch_xs)
rbmobject2.partial_fit(batch_xs)
print(rbmobject2.compute_cost(rbmobject1.transform(trX)))
show_image("out/2rbm.jpg", rbmobject2.n_w, (30, 30), (25, 20))
rbmobject2.save_weights('./out/rbmw2.chp')
# Train Third RBM
print('third rbm')
for i in range(FLAGS.epochs):
for j in range(iterations):
# Transform features
batch_xs, batch_ys = mnist.train.next_batch(FLAGS.batchsize)
batch_xs = rbmobject1.transform(batch_xs)
batch_xs = rbmobject2.transform(batch_xs)
rbmobject3.partial_fit(batch_xs)
print(rbmobject3.compute_cost(rbmobject2.transform(rbmobject1.transform(trX))))