You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.2 KiB
1.2 KiB
title | date | updated | tags | categories | keywords | description | top_img | comments | cover | toc | toc_number | toc_style_simple | copyright | copyright_author | copyright_author_href | copyright_url | copyright_info | katex | highlight_shrink | aside |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Numpy | 2020-12-28 17:21:25 | 2021-03-28 18:47:56 | <nil> | <nil> | <nil> | <nil> | <nil> | <nil> | <nil> | <nil> | <nil> | <nil> | <nil> | <nil> | <nil> | <nil> | <nil> | true | <nil> | <nil> |
1,np.random.choice的用法
import numpy as np
参数意思分别 是从a 中以概率P,随机选择3个, p没有指定的时候相当于是一致的分布
a1 = np.random.choice(a=5, size=3, replace=False, p=None) print(a1)
非一致的分布,会以多少的概率提出来
a2 = np.random.choice(a=5, size=3, replace=False, p=[0.2, 0.1, 0.3, 0.4, 0.0]) print(a2)
replacement 代表的意思是抽样之后还放不放回去,如果是False的话,那么出来的三个数都不一样,如果是
True的话, 有可能会出现重复的,因为前面的抽的放回去了。 ———————————————— 版权声明:本文为CSDN博主「qfpkzheng」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qfpkzheng/article/details/79061601