![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数学
deardao
昵称为同名微信号,有合作交流的可与我联系
展开
-
einsum和matmul的结果对比实验
程序:import torchimport torch.nn as nnt=torch.randn((2,3,2))w=torch.randn((3,2))einsum = torch.einsum('ijk,js->isk',t,w)print(einsum.shape,'einsum shape')print(einsum)t_T=t.transpose(2,1)result = torch.matmul(t_T,w).transpose(2,1)print(result.原创 2021-03-17 08:54:23 · 975 阅读 · 0 评论 -
几种MAPE的实现方式
目录方法一 (label 中有NaN值)方法二(label 中有零值)方法三 (限制过大过小值)方法一 (label 中有NaN值)这种方式是为了防止label里面有NaN值,但没考虑是否为零值。def masked_mape(preds, labels, null_val=np.nan): if np.isnan(null_val): mask = ~torch.i...原创 2020-04-05 17:39:54 · 9761 阅读 · 2 评论 -
向量范数
从度量上讲:内积、积分、投影讲是一个意思。都是: ϕ:Rn→R\phi : R^n \rightarrow R \quadϕ:Rn→R的映射。我们将这样的 ϕ\phiϕ 在广义上称为某种度量。首先,矩阵是无法比较大小的,例如 a=[3,5] 和 b=[4,4] ,问a和b这两个向量那个大?所以,任何需要度量的东西都需要投影到 RRR 空间。这里,我们取 a 和 b 的范数(满足非负性、齐次性和...原创 2019-09-06 20:45:16 · 2461 阅读 · 0 评论 -
Simpson’s Rule (辛普森法则)
In Simpson’s Rule, we will use parabolas to approximate each part of the curve. This proves to be very efficient since it’s generally more accurate than the other numerical methods such as straight ...原创 2019-09-13 22:00:41 · 26850 阅读 · 0 评论