当前位置:网站首页>Numpy中np.meshgrid的简单用法示例
Numpy中np.meshgrid的简单用法示例
2022-07-31 04:55:00 【bksheng】
机器学习中经常会用到np.meshgrid()
含义:生成网格点坐标
代码示例:
a = [2,3,5]
b = [1,4,7,9]
A,B = np.meshgrid(a,b)
print('A\n',A) # 把a当作一行,再根据b的个数进行扩充。
print('B\n',B) # 把b当作一列,再根据a的个数进行扩充。
plt.scatter(A,B) # 得到的A,B形状一致,可以将A,B对应组合成(x,y)坐标,绘制出网格点。
执行结果:
A
[[2 3 5]
[2 3 5]
[2 3 5]
[2 3 5]]
B
[[1 1 1]
[4 4 4]
[7 7 7]
[9 9 9]]
散点图:
边栏推荐
- 关于出现大量close_wait状态的理解
- 开放原子开源基金会秘书长孙文龙 | 凝心聚力,共拓开源
- MySQL optimization slow log query
- CentOS7 install MySQL graphic detailed tutorial
- ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your
- [C language] Detailed explanation of operators
- Industry-university-research application to build an open source talent ecosystem | 2022 Open Atom Global Open Source Summit Education Sub-Forum was successfully held
- 开源汇智创未来 | 2022开放原子全球开源峰会OpenAtom openEuler分论坛圆满召开
- ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)解决办法
- Unity资源管理系列:Unity 框架如何做好资源管理
猜你喜欢
30 Years of Open Source Community | 2022 Open Atom Global Open Source Summit 30 Years of Open Source Community Special Event Held Successfully
MySQL常见面试题汇总(建议收藏!!!)
MySQL数据库备份
Go language study notes - dealing with timeout problems - Context usage | Go language from scratch
On Governance and Innovation | 2022 OpenAtom Global Open Source Summit OpenAnolis sub-forum was successfully held
ENSP, VLAN division, static routing, comprehensive configuration of Layer 3 switches
【wpf】wpf中的那些模板之深度解析
DVWA installation tutorial (understand what you don't understand · in detail)
mysql使用on duplicate key update批量更新数据
Interview | Cheng Li, CTO of Alibaba: Cloud + open source together form a credible foundation for the digital world
随机推荐
【线性神经网络】softmax回归
ERROR 1819 (HY000) Your password does not satisfy the current policy requirements
打造基于ILRuntime热更新的组件化开发
[R language] [3] apply, tapply, lapply, sapply, mapply and par function related parameters
MySQL optimization: from ten seconds to three hundred milliseconds
【debug锦集】Expected input batch_size (1) to match target batch_size (0)
Minio上传文件ssl证书不受信任
VScode+ESP32 quickly install ESP-IDF plugin
【云原生】DevOps(五):集成Harbor
Summary of MySQL common interview questions (recommended collection!!!)
Unity URP渲染管线摄像机核心机制剖析
Error EPERM operation not permitted, mkdir 'Dsoftwarenodejsnode_cache_cacach Two solutions
参考代码系列_1.各种语言的Hello World
ENSP, VLAN division, static routing, comprehensive configuration of Layer 3 switches
MySQL database addition, deletion, modification and query (detailed explanation of basic operation commands)
【ORACLE Explain 详解】
Lua,ILRuntime, HybridCLR(wolong)/huatuo hot update comparative analysis
MySQL数据库备份
SQL行列转换
MySQL transaction (transaction) (this is enough..)