当前位置:网站首页>Numpy generates row vectors and column vectors (1024 water medal text)
Numpy generates row vectors and column vectors (1024 water medal text)
2022-06-12 07:52:00 【Wait for Godot.】
List of articles
Preface
Just pay attention , The following sentence
np.array([1,2,3])
print(np.array([1,2,3]).shape)
Not a row vector , Nor is it a column vector , You output its shape:(3,). It's something like this , You can understand that achievement is a dimension of three array.
One 、 Row vector and column vector generation
1. Row vector
# 1. The method of generating row vectors
row_vector1 = np.array([1, 2, 3]).reshape(1, -1) # The most commonly used
row_vector2 = np.array([[1, 2, 3]]) # Also often used
row_vector3 = np.expand_dims(np.array([1, 2, 3]), axis=0)# Rarely used
2. Column vector
# 1. How to generate column vectors
col_vector1 = np.array([1, 2, 3]).reshape(-1, 1)# The most commonly used
col_vector2 = np.array([[1], [2], [3]])# The most commonly used
col_vector3 = row_vector1.T # Vector transpose Commonly used
col_vector4 = np.expand_dims(np.array([1, 2, 3]), axis=1)# Rarely used
summary
1024 Happy holidays .2021.10.24 21:13 Mode job code process record
边栏推荐
- Chapter 6 - identity authentication, Chapter 7 - access control
- Voice assistant - Multi round conversation (process implementation)
- Voice assistant - Multi round conversation (theory and concept)
- Voice assistant - those classification models used in the assistant
- 数值计算方法 Chapter6. 解线性方程组的迭代法
- Voice assistant - Qu - single entity recall
- Process terminated
- Exposure compensation, white increase and black decrease theory
- Topic 1 Single_Cell_analysis(2)
- Ecmascript6 interview questions
猜你喜欢

Summary of machine learning + pattern recognition learning (IV) -- decision tree

Voice assistant - Qu - single entity recall

Seeking for a new situation and promoting development, the head goose effect of Guilin's green digital economy

Question bank and answers of special operation certificate examination for safety management personnel of hazardous chemical business units in 2022

电脑连接上WiFi但是上不了网

Bi skills - beginning of the month

2022 electrician (elementary) examination question bank and simulation examination

BI技巧丨当月期初

Some summaries of mathematical modeling competition in 2022

Rich dad, poor dad Abstract
随机推荐
Compiling principle on computer -- functional drawing language (IV): semantic analyzer
经典论文回顾:Palette-based Photo Recoloring
R language uses neuralnet package to build neural network regression model (feedforward neural network regression model) and calculate MSE value (mean square error) of the model on the test set
Classic paper review: palette based photo retrieval
10 lessons from the recommended system
Exposure compensation, white increase and black decrease theory
LeetCode笔记:Weekly Contest 296
Compiling principle on computer -- function drawing language (III): parser
Leetcode34. find the first and last positions of elements in a sorted array
20220524 backbone深度学习网络骨架
Search and rescue strategy of underwater robot (FISH)
VS2019 MFC IP Address Control 控件繼承CIPAddressCtrl類重繪
Connect to the database but cannot modify the data
Utilize user behavior data
Chapter 8 - firewall, Chapter 9 - Intrusion Detection
解决上传SFTPorg.apache.commons.net.MalformedServerReplyException: Could not parse respon
数值计算方法 Chapter5. 解线性方程组的直接法
Meter Reading Instrument(MRI) Remote Terminal Unit electric gas water
Vs2019 MFC IP address control control inherits cipaddressctrl class redrawing
Question bank and answers of special operation certificate examination for safety management personnel of hazardous chemical business units in 2022