![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
深度学习
jeffery0628
这个作者很懒,什么都没留下…
展开
-
Your CPU supports instructions that this TensorFlow binary was not compiled to
这个不是报错。是提示cpu的使用性能还可以提升。解决方法:忽视警告,并屏蔽警告 开头输入如下:import osos.environ[‘TF_CPP_MIN_LOG_LEVEL’] = ‘2’原创 2018-01-16 15:39:43 · 641 阅读 · 0 评论 -
softmax()定义
def softmax(X): Xexp = X.exp() partition = Xexp.sum(axis=1, keepdims=True) return Xexp / partition # 这里应用了广播机制转载 2018-09-06 18:33:29 · 563 阅读 · 0 评论 -
按batch_size读取数据
def data_iter(batch_size, features, labels): num_examples = len(features) indices = list(range(num_examples)) random.shuffle(indices) # 样本的读取顺序是随机的。 for i in range(0, num_examples, ba...转载 2018-09-06 10:46:54 · 2331 阅读 · 1 评论 -
pandas数据筛选
import pandas as pdimport numpy as npdates = pd.date_range('20130101',periods=6)df = pd.DataFrame(np.arange(24).reshape((6,4)),index=dates,columns=['A','B','C','D'])print(df['A'],df.A)# 切片print...原创 2018-05-20 09:08:19 · 642 阅读 · 0 评论 -
numpy copy & deep copy
import numpy as np# copy & deep copya = np.arange(4)print(a)b = ac = ad = b# 改变a[0] 的值print('******************')a[0] = 11print(a)print(b)print(b is a)print('******************')p...原创 2018-05-19 13:05:37 · 1731 阅读 · 0 评论 -
numpy 分割
import numpy as np# 分割A = np.arange(12).reshape((3,4))print(A)# 纵向分割print(np.split(A, 2, axis=1))print('***************************')# 不等分割print(np.array_split(A, 3, axis=1))print('********...原创 2018-05-19 12:55:45 · 281 阅读 · 0 评论 -
numpy 合并
import numpy as np# 合并A = np.array([1,1,1])B = np.array([2,2,2])C = np.vstack((A,B))# 上下合并print(A.shape)print(C)print(C.shape)print('******************************')# 左右合并D = np.hstack((A...原创 2018-05-19 12:46:17 · 1116 阅读 · 0 评论 -
numpy 索引迭代
import numpy as npA = np.arange(3, 15).reshape((3,4))print(A)print(A[1,1])print(A[1][1])print('*************************')# 打印第一行所有的数print(A[1,:])print('*************************')# 打印第1行第1-...原创 2018-05-19 12:32:24 · 261 阅读 · 0 评论 -
numpy 矩阵操作
import numpy as np# 定义一个矩阵A = np.arange(14,2, -1).reshape((3,4))print(A)# 求矩阵A最小值索引print(np.argmin(A))# 求矩阵A最大值索引print(np.argmax(A))# 求矩阵平均值print(np.mean(A))print(A.mean())print(np.averag...原创 2018-05-19 11:22:39 · 370 阅读 · 0 评论 -
numpy axis
import numpy as np# 随机产生2行4列 0-1的数字a = np.random.randint(0,9, (3,4))print(a)# data =[[a00, a01],[a10,a11]],# 所以axis=0时,沿着第0个下标变化的方向进行操作,# 也就是a00->a10, a01->a11,array_sum = np.sum(a, axi...原创 2018-05-19 10:06:29 · 157 阅读 · 0 评论 -
numpy 矩阵乘法
import numpy as npa = np.array([ [1,1], [0,1]])b = np.arange(4).reshape(2,2)print(a)print(b)print('************************')# 对应元素相乘c = a * b# 矩阵相乘c_dot = np.dot(a, b)c_dot_2 = a....原创 2018-05-19 09:51:55 · 3524 阅读 · 0 评论 -
numpy 矩阵的简单运算
import numpy as npa = np.array([10, 20, 30, 40])b = np.arange(4)c = a - bprint(a)print(b)print(c)print('************************')d = b**2print(b)print(d)print('************************')...原创 2018-05-19 09:47:46 · 224 阅读 · 0 评论 -
numpy 生成数组
import numpy as np# 定义一个数组,设置浮点型a = np.array([[2, 3, 4], [3, 4, 5]], dtype=np.float32)print(a)# 输出数组元素类型print(a.dtype)# 定义一个全零的数组b = np.zeros((3, 4))print(b)# 定义一个全为一的数组c = np...原创 2018-05-19 09:38:48 · 2417 阅读 · 0 评论 -
numpy 数组维度,形状,大小
import numpy as nparray = np.array([ [1, 2, 3], [4, 5, 6]])print(array)print('number of dim:',array.ndim)print('shape:', array.shape)print('size:', array.size)结果 [[1 2 3] [4 5 6...原创 2018-05-19 09:17:24 · 64039 阅读 · 0 评论 -
基于小批量随机梯度的一些优化算法
design by litzhen原创 2018-09-13 12:57:05 · 296 阅读 · 0 评论