np.histogramdd()

numpy.histogramdd函数用于计算多维数据的直方图,支持自定义bin边界、范围、是否归一化等参数。它接受(N,D)或(D,N)格式的样本数据,可以处理权重,并能输出样本数或概率密度。该函数在数据分析和科学计算中非常实用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

numpy.histogramdd(sample, bins=10, range=None, normed=None, weights=None, density=None)

计算一些数据的多维直方图

sample :(N, D) 数组, 或 (D, N) 数组

要进行直方图分析的数据。 注意当array_like时样本的不寻常解释: 

1) 如果是数组,则每一行都是D维空间中的坐标, 

2) 如果为array_like,则每个元素都是单个坐标的值列表。

 第一种形式应该是首选。

bins :sequence 或 int, 可选

bin规格: 

1) 描述沿每个维度单调递增的bin边缘的数组序列。

2) 每个维度的bins数量(nx,ny,…=bins)。 

3) 所有维度的bins数(nx = ny =…=bins)。

range :sequence, 可选。在序列中输入None,将导致最小值和最大值用于相应的尺寸。默认值None。

density :bool,可选。

如果默认值为False,则返回每个bin中的样本数。

如果为True,则在bin处返回概率密度函数。

normed :bool, 可选。密度参数的别名,其行为相同。通常首选密度。

weights :可选。权重每个样本(x_i,y_i,z_i,...)的值w_i的数组。 如果标准为True,则将权重标准化为1。 如果normed为False,则返回的直方图的值等于属于每个bin的样本的权重之和。

def spatially_regular_gen(): # Generator loop for i in range(num_per_epoch): # Choose the cloud with the lowest probability cloud_idx = int(np.argmin(self.min_possibility[split])) # choose the point with the minimum of possibility in the cloud as query point point_ind = np.argmin(self.possibility[split][cloud_idx]) # Get all points within the cloud from tree structure points = np.array(self.input_trees[split][cloud_idx].data, copy=False) # Center point of input region center_point = points[point_ind, :].reshape(1, -1) # Add noise to the center point noise = np.random.normal(scale=cfg.noise_init / 10, size=center_point.shape) pick_point = center_point + noise.astype(center_point.dtype) # Check if the number of points in the selected cloud is less than the predefined num_points if len(points) < cfg.num_points: # Query all points within the cloud queried_idx = self.input_trees[split][cloud_idx].query(pick_point, k=len(points))[1][0] else: # Query the predefined number of points queried_idx = self.input_trees[split][cloud_idx].query(pick_point, k=cfg.num_points)[1][0] # Shuffle index queried_idx = DP.shuffle_idx(queried_idx) # Get corresponding points and colors based on the index queried_pc_xyz = points[queried_idx] queried_pc_xyz = queried_pc_xyz - pick_point queried_pc_colors = self.input_colors[split][cloud_idx][queried_idx] queried_pc_labels = self.input_labels[split][cloud_idx][queried_idx] # Update the possibility of the selected points dists = np.sum(np.square((points[queried_idx] - pick_po
最新发布
04-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值