11.24学习
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了11.24学习相关的知识,希望对你有一定的参考价值。
1.动态显示图片
可以使用
plt.ion()
for..
plt.cla()
plt.plot()..
plt.ioff()
plt.show()
2.
随机选择n个数
numpy.random.choice(a, size=None, replace=True, p=None)
replace作用未知
3.
numpy中有一些常用的用来产生随机数的函数,randn()和rand()就属于这其中。
numpy.random.randn(d0, d1, …, dn)是从标准正态分布中返回一个或多个样本值。
numpy.random.rand(d0, d1, …, dn)的随机样本位于[0, 1)中。
- 代码:
1 import numpy as np 2 arr1 = np.random.randn(2,4) 3 print(arr1) 4 arr2 = np.random.rand(2,4) 5 print(arr2)
结果
1 [[-1.03021018 0.5197033 0.52117459 -0.70102661] 2 [ 0.98268569 1.21940697 -1.095241 -0.38161758]] 3 ****************************************************************** 4 [[ 0.19947349 0.05282713 0.56704222 0.45479972] 5 [ 0.28827103 0.1643551 0.30486786 0.56386943]]
4.np.random.shuffle 打乱作用
5.numpy.random.
randint
(low, high=None, size=None, dtype=‘l‘)
Ifhigh is None (the default), then results are from [0, low).
6.numpy.argmax(a, axis=None, out=None)
不添加时全部元素的最大值,也可指定axis值
7.关于plt.plot中画图参数解析
================ =============================== character description ================ =============================== ``‘-‘`` solid line style ``‘--‘`` dashed line style ``‘-.‘`` dash-dot line style ``‘:‘`` dotted line style ``‘.‘`` point marker ``‘,‘`` pixel marker ``‘o‘`` circle marker ``‘v‘`` triangle_down marker ``‘^‘`` triangle_up marker ``‘<‘`` triangle_left marker ``‘>‘`` triangle_right marker ``‘1‘`` tri_down marker ``‘2‘`` tri_up marker ``‘3‘`` tri_left marker ``‘4‘`` tri_right marker ``‘s‘`` square marker ``‘p‘`` pentagon marker ``‘*‘`` star marker ``‘h‘`` hexagon1 marker ``‘H‘`` hexagon2 marker ``‘+‘`` plus marker ``‘x‘`` x marker ``‘D‘`` diamond marker ``‘d‘`` thin_diamond marker ``‘|‘`` vline marker ``‘_‘`` hline marker ================ =============================== The following color abbreviations are supported: ========== ======== character color ========== ======== ‘b‘ blue ‘g‘ green ‘r‘ red ‘c‘ cyan ‘m‘ magenta ‘y‘ yellow ‘k‘ black ‘w‘ white ========== ========
以上是关于11.24学习的主要内容,如果未能解决你的问题,请参考以下文章
第十周(11.18-11.24)----个人项目----学习java总结2