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

Open Source Smart Future | 2022 OpenAtom Global Open Source Summit OpenAtom openEuler sub-forum was successfully held

信息系统项目管理师核心考点(五十五)配置管理员(CMO)的工作

Fusion Cloud Native, Empowering New Milestones | 2022 Open Atom Global Open Source Summit Cloud Native Sub-Forum Successfully Held

【wpf】wpf中的那些模板之深度解析

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

sql语句之多表查询

MySQL forgot password

centos7安装mysql5.7

Go语学习笔记 - 处理超时问题 - Context使用 | 从零开始Go语言

mysql存储过程
随机推荐
MySQL database must add, delete, search and modify operations (CRUD)
30 Years of Open Source Community | 2022 Open Atom Global Open Source Summit 30 Years of Open Source Community Special Event Held Successfully
Unity框架设计系列:Unity 如何设计网络框架
Minesweeper game - C language
Reinforcement learning: from entry to pit to shit
prompt.ml/15中<svg>标签使用解释
DVWA之SQL注入
Unity Fighter
MySQL database addition, deletion, modification and query (detailed explanation of basic operation commands)
sql语句-如何以一个表中的数据为条件据查询另一个表中的数据
ERROR 2003 (HY000) Can't connect to MySQL server on 'localhost3306' (10061)
Unity资源管理系列:Unity 框架如何做好资源管理
三道leetcode上的oj题
Industry landing presents new progress | 2022 OpenAtom Global Open Source Summit OpenAtom OpenHarmony sub-forum was successfully held
CentOS7 install MySQL graphic detailed tutorial
STM32HAL library modifies Hal_Delay to us-level delay
参考代码系列_1.各种语言的Hello World
MySQL数据库安装配置保姆级教程(以8.0.29为例)有手就行
MySQL forgot password
SQL row-column conversion