随笔分类 - numpy
摘要:b_idx = np.random.randint(0, 9, 90) >>> b_idx array([0, 1, 5, 4, 7, 2, 7, 0, 0, 4, 2, 2, 3, 5, 6, 4, 7, 0, 3, 2, 7, 3, 8, 5, 4, 3, 1, 8, 6, 6, 5, 5, 3, 2, 2, 2, 0, 4, 8, 1, 5, 3, 2, 6, ...
阅读全文
摘要:repeat:复制元素 axis = 0 复制每行 axis = 1 复制每列 2 表示复制一遍 不设置axis,复制每个,按行展开成一行。
阅读全文
摘要:求和: axis = 0 按列求和 axis = 1 按行求和
阅读全文
摘要:字符串.join(字符串序列) 一目了然: 参考: http://www.runoob.com/python/att-string-join.html
阅读全文
摘要:shape 是返回 np.mat 的形状的。 1. 作为 mat 的成员变量,a.shape 2. 作为 np 的成员函数,np.shape
阅读全文
摘要:"""An example of how to use your own dataset to train a classifier that recognizes people. """ # MIT License # # Copyright (c) 2016 David Sandberg # # Permission is hereby granted, free of charge, ...
阅读全文
摘要:翻转矩阵的左右。 至少需要是2维矩阵。 例子: 参考: https://docs.scipy.org/doc/numpy/reference/generated/numpy.fliplr.html
阅读全文
摘要:借鉴代码https://blog.csdn.net/xiongchengluo1129/article/details/79017142 吐槽一下CSDN的垃圾广告。。 这是转置,所以1维(向量)和2维(矩阵)的转置的意义很直观,就是数学上学的。 难的就是超过三维的张量,怎么转置。 先看结果:
阅读全文
摘要:1. 分3部分来看。 2. expand_dims直观来说就是将某一维度展成1维,看shape的形式便可知。 3. 哪一维要设置成1,就将原始DATA重新组合,细心看输出的数据的重排形式。 4. 维度从0开始,超过都表示最后一维,-1也是最后一维。
阅读全文
摘要:区别于min: min 求一个list中的最小 amin 可以求 array 之间,按照,某维度的最小,输出该最小所在的另一维度向量。
阅读全文
摘要:生成指定shape的“零”矩阵。 注意“零”是很接近零的数 可以先空着。
阅读全文