3d 随机抽样 [英] 3d Random sampling

查看:56
本文介绍了3d 随机抽样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组点xyz8,

我想随机获得 10% 的分数.

I want to randomly get 10% of points.

那我想随机得到剩下的90%的10%

Then I want to randomly get 10% of the remaining 90%

那我想随机得到剩下的70%的10%

Then I want to randomly get 10% of the remaining 70%

等直到所有点都完成

我该怎么做?

非常感谢任何建议

推荐答案

我将其解释为您想将这些点分成 10 个大小相等的段.你可以简单地通过改变它们并重新调整列表来做到这一点:

I interpret this as you want to split the points into 10 equal-sized segments. You can simply do this by shuffling them and reshaping the list:

np.random.shuffle(points)
points.shape = (10,-1) + points.shape[1:]

然后您可以访问前 10% 为 points[0],第二个为 points[1]

Then you can access the first 10% as points[0], the second as points[1], etc.

这仍然适用于多维数组,因为 shuffle 只会沿第一个轴进行 shuffle.

This still works for a multidimensional array since shuffle will only shuffle along the first axis.

这篇关于3d 随机抽样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆