当前位置:网站首页>机器学习笔记 - 迹算子(跟踪运算符)
机器学习笔记 - 迹算子(跟踪运算符)
2022-04-21 19:01:00 【bashendixie5】
1、什么是矩阵的迹?
迹是方阵对角线上所有值的总和。主成分分析(PCA)会用到它。
下面这样一个矩阵A。则它的迹为2+7+5=14。

Numpy 提供了函数 trace() 来计算它:
A = np.array([[2, 9, 8], [4, 7, 1], [8, 2, 5]])
A_tr = np.trace(A)
求得14。
2、L2范数和迹的性质
指定矩阵的 Frobenius 范数。 Frobenius 范数相当于矩阵的L2范数(之前的章节讲过)。
它定义为:![]()
也可以通过这个公式计算:
使用python进行测试
np.linalg.norm(A)
得到17.549928774784245,就是说A的L2范数为17.549928774784245。
使用迹来计算
np.sqrt(np.trace(A.dot(A.T)))
结果17.549928774784245。
性质1:由于矩阵的转置不会改变对角线,因此矩阵的迹等于其转置的迹:![]()
性质2:
3、示例
有如下三个矩阵



计算三个矩阵的点积
A = np.array([[4, 12], [7, 6]])
B = np.array([[1, -3], [4, 3]])
C = np.array([[6, 6], [2, 5]])
np.trace(A.dot(B).dot(C))
np.trace(C.dot(A).dot(B))
np.trace(B.dot(C).dot(A))



迹均为531。
![]()
版权声明
本文为[bashendixie5]所创,转载请带上原文链接,感谢
https://blog.csdn.net/bashendixie5/article/details/124302293
边栏推荐
- 数据库进阶学习:索引分类和创建语法
- The interviewer asked me about my understanding of the transaction isolation mechanism? That's my answer
- Major event review Carnival link construction
- 排序会了递归,不学非递归太可惜了
- 帧率、码率、分辨率、清晰度概念
- Daily question series: shuffle
- 毕业三年,一事无成,被迫回老家,一个决定改变一生。
- 面试官问我谈谈对事务隔离机制的理解?我是这样回答的
- leetcode:423. Reconstructing numbers from English
- 解读自主形机器人的责任感
猜你喜欢

MySQL的吞吐量

Finally, wechat scanning code login is completed. It's really fragrant..

How much can I get a month with a PMP certificate

The difference between null and undefined

Work summary! 15 suggestions for log printing

Niu Ke - alternative addition

MySQL去重查询

cpu和内存占用过高,但是任务管理器中的进程占用的内存和cpu看不出来

mysql不能使用 mysql -u root -p 启动报错解决
![[ES6] let, const, deconstruction assignment, template string](/img/42/1e57b501799cc019cf652b8aaf5999.gif)
[ES6] let, const, deconstruction assignment, template string
随机推荐
[ES6] let, const, deconstruction assignment, template string
直面阿里的勇气
"Actual combat" realizes linear regression with tensorflow
Database advanced learning: storage engine
Cvpr2022 unified upgrade of oral | cosface and arcface, and adaface solves face recognition of low-quality images
JS——new Date()实例
深度学习多机多卡batchsize和学习率的关系
APM 行业认知系列 - 七 - 定义DevOps的17种方式
108. 将有序数组转换为二叉搜索树(图文并解)
The difference between null and undefined
Excel表格快速生成LaTeX
EdgeBoard记录
Feign源码分析
牛客 - 另类加法
Seata(一) 服务配置以及启动
[untitled]
SPFA determines whether there is a negative ring
数据库进阶学习:索引介绍及Btree,B+tree,hash
Work summary! 15 suggestions for log printing
Abbexa MPO (FITC) / CD3 (PE) 组合抗体