numpy—np.logspace

文章目录

1.np.logspace

numpy.logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None, axis=0)

描述

返回在对数刻度上平均间隔的数字
在线性空间中,序列开始于base** start,结束于基数base** stop

参数

start : array_like
base ** start是序列的开始值

stop : array_like
base ** stop 是序列的结束值,
除非endpoint为False。
在这种情况下,num + 1个值在log-space的间隔中间隔开,返回除最后一个(长度为num的序列)以外的所有值

num : integer, optional
要生成的样本数。默认是50

endpoint : boolean, optional
如果为true,则stop是最后一个样本。否则,不包括在内。默认为True

base : float, optional
相当于幂指函数的底数

y = np.linspace(start, stop, num=num, endpoint=endpoint)
np.power(base, y).astype(dtype)

dtype : dtype
输出数组的数据类型,如果没有给出dtype,则从其他输入参数推断数据类型。

axis : int, optional

返回

samples : ndarray
num个样本,在对数尺度上等距分布

2.官例

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_46649052/article/details/112742828