- 博客(9)
- 收藏
- 关注
转载 卡特兰数
令h(0)=1,h(1)=1,catalan数满足递推式 [2] :h(n)= h(0)*h(n-1)+h(1)h(n-2) + … + h(n-1)h(0) (n>=2)例如:h(2)=h(0)h(1)+h(1)h(0)=11+11=2h(3)=h(0)h(2)+h(1)h(1)+h(2)h(0)=12+11+21=5另类递推式 [3] :h(n)=h(n-1)(4n-2)/...
2019-02-20 09:23:30
211
原创 树的遍历
前、中、后序遍历(递归版本) def preOrder(self, root): if root is None: return [] else: return [root.val] + self.preOrder(root.left) + self.preOrder(root.right) def ...
2019-01-09 18:50:49
167
原创 515. 在每个树行中找最大值
您需要在二叉树的每一行中找到最大的值。示例:输入: 1 / \ 3 2 / \ \ 5 3 9 输出: [1, 3, 9]# Definition for a binary tree node.# class TreeNode:# def __init__(self, x):# self.val =...
2018-12-07 10:47:36
158
原创 python实现RNN/LSTM
用LSTM实现手写图片的数字识别import tensorflow as tffrom tensorflow.examples.tutorials.mnist import input_datamnist = input_data.read_data_sets('MNIST_data', one_hot=True)lr = 0.001training_iters = 100000b...
2018-12-06 14:58:10
860
转载 CNN
CNN将彩色图片(2562561(RGB))进行采集,使得长和宽压缩变小,而高度变大2562561 - > 12812816 - > 646464 - > 3232256 …宗旨是长和宽越来越小
2018-12-05 15:35:50
175
原创 Tensorboard学习笔记
dropoutkeep_prob = tf.placeholder(tf.float32)train_step = tf.train.GradientDescentOptimizer(0.6).minimize(cross_entropy)merged = tf.summary.merge_all()train_writer = tf.summary.FileWriter('logs/...
2018-12-05 11:11:00
214
转载 Tensorflow学习笔记
tf.argmax()tf.argmax(vector, 1):返回的是vector中的最大值的索引号,如果vector是一个向量,那就返回一个值,如果是一个矩阵,那就返回一个向量,这个向量的每一个维度都是相对应矩阵行的最大值元素的索引号。...
2018-12-04 17:09:20
140
转载 Adam 优化算法
Adam 优化算法Adam源于适应性矩估计(adaptive moment estimation)Adam 算法和传统的随机梯度下降不同。随机梯度下降保持单一的学习率(即 alpha)更新所有的权重,学习率在训练过程中并不会改变。而 Adam 通过计算梯度的一阶矩估计和二阶矩估计而为不同的参数设计独立的自适应性学习率。Adam 算法的提出者描述其为两种随机梯度下降扩展式的优点集合,即:1....
2018-12-04 14:27:02
4073
原创 python学习笔记
np.reshapenp.reshape(a, 维度)将数组a变为新维度下的数组import numpy as npa = np.zeros([1, 10])print(a)print(np.reshape(a, [-1, 5, 1])结果如下:[[0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]][[[0.] [0.] [0.] [0.] [0.]...
2018-12-04 10:54:18
148
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅