一些np库里面奇怪的函数

np.tile

就像贴地砖一样,将一块相同的地砖(数组)在地上平铺多少次(横向、纵向)

np.https://blog.csdn.net/qq_28618765/article/details/78082438

stack():沿着新的轴加入一系列数组。
vstack():堆栈数组垂直顺序(行)
hstack():堆栈数组水平顺序(列)。
dstack():堆栈数组按顺序深入(沿第三维)。
concatenate():连接沿现有轴的数组序列。
vsplit():将数组分解成垂直的多个子数组的列表。

 np.hypot(两个矩阵之间)计算欧氏距离

np.dot(a,b)

Dot product of two arrays. Specifically,

    - If both `a` and `b` are 1-D arrays, it is inner product of vectors
      (without complex conjugation). 都是一维,相当于向量内积

    - If both `a` and `b` are 2-D arrays, it is matrix multiplication,
      but using :func:`matmul` or ``a @ b`` is preferred.二维相当于矩阵相乘

np.random

rand(d0, d1, ..., dn)    Random values in a given shape.
randn(d0, d1, ..., dn)    Return a sample (or samples) from the “standard normal” distribution.
randint(low[, high, size, dtype])    Return random integers from low (inclusive) to high (exclusive).
random_integers(low[, high, size])    Random integers of type np.int between low and high, inclusive.
random_sample([size])    Return random floats in the half-open interval [0.0, 1.0).
random([size])    Return random floats in the half-open interval [0.0, 1.0).产生随机矩阵,如random.random([2,3])产生一个2x3维的随机数
ranf([size])    Return random floats in the half-open interval [0.0, 1.0).
sample([size])    Return random floats in the half-open interval [0.0, 1.0).
choice(a[, size, replace, p])    Generates a random sample from a given 1-D array
bytes(length)    Return random bytes.
————————————————
版权声明:本文为CSDN博主「-柚子皮-」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/pipisorry/article/details/39508417

np.where(h>=0.5,1,0)#h>=0.5的地方为1,其他为0

https://www.cnblogs.com/massquantity/p/8908859.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值