当前位置:网站首页>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]]
散点图:
边栏推荐
猜你喜欢

MySQL常见面试题汇总(建议收藏!!!)

MySQL数据库必会的增删查改操作(CRUD)

WeChat applet uses cloud functions to update and add cloud database nested array elements

【线性神经网络】softmax回归

Minesweeper game (written in c language)

SQL injection of DVWA

聚变云原生,赋能新里程 | 2022开放原子全球开源峰会云原生分论坛圆满召开

MySQL forgot password
![[Cloud Native] DevOps (5): Integrating Harbor](/img/5a/dd33d7d3cb0124f328d2d38fff0125.png)
[Cloud Native] DevOps (5): Integrating Harbor
![[R language] [3] apply, tapply, lapply, sapply, mapply and par function related parameters](/img/98/282d8d192f701ad33de48aeeb038b4.png)
[R language] [3] apply, tapply, lapply, sapply, mapply and par function related parameters
随机推荐
CentOS7 —— yum安装mysql
论治理与创新 | 2022开放原子全球开源峰会OpenAnolis分论坛圆满召开
MySQL database backup
ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your
关于出现大量close_wait状态的理解
Hand in hand to realize the picture preview plug-in (3)
马斯克对话“虚拟版”马斯克,脑机交互技术离我们有多远
信息系统项目管理师核心考点(五十五)配置管理员(CMO)的工作
12个MySQL慢查询的原因分析
Vue项目通过node连接MySQL数据库并实现增删改查操作
The Vue project connects to the MySQL database through node and implements addition, deletion, modification and query operations
Doris学习笔记之监控
From scratch, a mirror to the end, a pure system builds a grasscutter (Grasscutter)
SQL语句中对时间字段进行区间查询
Unity打灵狐者
Minio上传文件ssl证书不受信任
Interview | Cheng Li, CTO of Alibaba: Cloud + open source together form a credible foundation for the digital world
Three oj questions on leetcode
从零开始,一镜到底,纯净系统搭建除草机(Grasscutter)
MySQL优化:从十几秒优化到三百毫秒