当前位置:网站首页>How to standardize multidimensional matrix (based on numpy)
How to standardize multidimensional matrix (based on numpy)
2022-04-23 07:17:00 【Breeze_】
step1. Load or generate a matrix
import numpy as np
# Load from a file
matrix = np.load("xx.npy")
# Randomly generate one 2x3x4 Dimensional 1 To 100 The random matrix of
X = np.random.randint(1,100,(2,3,4))
step2. Calculation mean and std
means = np.mean(X,axis=(0,2)) # Calculate the mean , First calculate the number 0 Dimensional , Post calculation section 2 Dimensional , Get one shape by 3, Matrix
stds = np.std(X,axis = (0,2)) # Calculate variance , Get one shape by 3, Matrix
means = means.reshape(1,-1,1) # Convert to and X A matrix of the same dimension , here reshape The matrix dimension after is (1,3,1)
stds = stds.reshape(1,-1,1) # ditto
X = (X-means)/stds
版权声明
本文为[Breeze_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230610323183.html
边栏推荐
- BottomSheetDialogFragment + ViewPager+Fragment+RecyclerView 滑动问题
- Tiny4412 HDMI display
- Binder机制原理
- Using queue to realize stack
- org. xml. sax. SAXParseException; lineNumber: 141; columnNumber: 252; cvc-complex-type. 2.4. a: Found element 'B
- 谷歌AdMob广告学习
- 【2021年新书推荐】Artificial Intelligence for IoT Cookbook
- ArcGIS License Server Administrator 无法启动解决方法
- 实习做了啥
- this. getOptions is not a function
猜你喜欢
随机推荐
“Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated
机器学习笔记 一:学习思路
[Exynos4412][iTOP4412][Android-K]添加产品选项
【2021年新书推荐】Practical IoT Hacking
C#新大陆物联网云平台的连接(简易理解版)
Recyclerview 批量更新View:notifyItemRangeInserted、notifyItemRangeRemoved、notifyItemRangeChanged
Android清除应用缓存
launcher隐藏不需要显示的app icon
BottomSheetDialogFragment + ViewPager+Fragment+RecyclerView 滑动问题
ViewPager2实现画廊效果执行notifyDataSetChanged后PageTransformer显示异常 界面变形问题
Android exposed components - ignored component security
[2021 book recommendation] kubernetes in production best practices
1.1 PyTorch和神经网络
利用官方torch版GCN训练并测试cora数据集
org. xml. sax. SAXParseException; lineNumber: 141; columnNumber: 252; cvc-complex-type. 2.4. a: Found element 'B
[recommendation of new books in 2021] enterprise application development with C 9 and NET 5
红外传感器控制开关
torch.mm() torch.sparse.mm() torch.bmm() torch.mul() torch.matmul()的区别
记录webView显示空白的又一坑
Miscellaneous learning