练习次数,批量处理的大年夜小,还有进修率。
- num_epochs = 200 #The number of training epochs that we are going to run. For each epoch we go through the entire data set.
- BAtch_size = 100 #The number of training examples that we are going to send through the RBM at a time.
- lr = tf.constant(0.005, tf.float32) #The learning rate of our model
x 是投入收集的数据
w 用来存储权重矩阵,或者叫做两层之间的关系
此外还须要两种 bias,一个是隐蔽层的 bh,一个是可见层的 bv
- x = tf.placeholder(tf.float32, [None, n_visible], name="x") #The placeholder variable that holds our data
- W = tf.Variable(tf.random_normal([n_visible, n_hidden], 0.01), name="W") #The weightMATrix that stores the edge weights
- bh = tf.Variable(tf.zeros([1, n_hidden], tf.float32, name="bh")) #The bias vector for the hidden layer
- bv = tf.Variable(tf.zeros([1, n_visible], tf.float32, name="bv")) #The bias vector for the visible layer
接着,用帮助办法 gibbs_sample 大年夜输入数据 x 中建立样本,以及隐蔽层的样本:
gibbs_sample 是一种可以大年夜多重概率分布中提取样本的算法。
它可以生成一个统计模型,个中,每一个状况都依附于前一个状况,并且随机地生成相符分布的样本。
- #The sample of x
- x_sample = gibbs_sample(1)
- #The sample of the hidden nodes, starting from the visible state of x
- h = sample(tf.sigmoid(tf.matMUl(x, W) + bh))
- #The sample of the hidden nodes, starting from the visible state of x_sample
- h_sample = sample(tf.sigmoid(tf.matmul(x_sample, W) + bh))
推荐阅读
日前,四川省当局印发《四川省城乡垃圾处理举措措施扶植三年推动筹划》(以下简称《筹划》)。《筹划》提出,到2019岁尾,我省生活垃圾无害化处理才能将达7.05万吨/日,生活垃圾处理举措措施>>>详细阅读
本文标题:如何用 TensorFlow 教机器人作曲?秘诀原来是这样
地址:http://www.17bianji.com/lsqh/35102.html
1/2 1