当前位置: 首页 > news >正文

网站后台管理系统需求推荐6个免费国外自媒体平台

网站后台管理系统需求,推荐6个免费国外自媒体平台,wordpress分类底部上移,怎么做代购上那个网站python的numpy包是一个经过高度优化过的矩阵计算库,有各种加速组件,很多其他的库也都建立在它之上,适用于大数据计算,但也区别于自带类型列表list。但是其也受限于Python设计规则,或者自身优化的原因,有很多…

python的numpy包是一个经过高度优化过的矩阵计算库,有各种加速组件,很多其他的库也都建立在它之上,适用于大数据计算,但也区别于自带类型列表list。但是其也受限于Python设计规则,或者自身优化的原因,有很多提前注意的要点,这个需要慢慢积累。

首先numpy包支持(3,),以及(3,1),(1,3)形式的向量,后两者是常见的列向量与行向量,可以正常参与矩阵运算,但对以第一个定义比较模糊,其实既不是行向量,也不是列向量,但是却可以行向量去对待。python numpy默认行优先,按行展开,默认优先组成行向量,而matlab按列展开。而tensorflow甚至还支持()shape的张量,比如tf.constant(3),虽然也是按行展开。但是其实到了更高维(三维以及以上),python其实与matlab,甚至c语言维数顺序定义又不一样,哪一个是深度维度。。其实python里面只有第一维,第二维,第三维,你可以按你自己的思路去映射一个张量,运算的时候也是(包括展开,恢复等),但是如果要代表具体的意义,比如tensorflow的特征图意义,则需要指定,不然不好统一。


下面开始正式介绍例程:

https://blog.csdn.net/wintersshi/article/details/80489258


行向量

方式1
import numpy as np
b=np.array([1,2,3]).reshape((1,-1))
print(b,b.shape)

结果:

(array([[1, 2, 3]]), (1, 3))
方式2
import numpy as np
b=np.array([[1,2,3]])	#两层'[]'
print(b,b.shape)

结果

(array([[1, 2, 3]]), (1, 3))

列向量

方式1

import numpy as np
a=np.array([1,2,3]).reshape((-1,1))
print(a,a.shape)

结果:

(array([[1],[2],[3]]), (3, 1))

方式2

import numpy as np
a=np.array([[1,2,3]]).T
print(a,a.shape)

结果

(array([[1],[2],[3]]), (3, 1))

备注

这篇文章写了好久了,中间习惯了在其他网站写博客,所以CSDN好久就没登录了,今天登录后发现这篇文章有很多评论,才发现文章写的确实有问题,实在是抱歉.感谢大家的指正.文章已修改.


关于维度顺序的话,有时候特别容易把人绕晕,所以有人总结了一些自己理解的方法:
https://blog.csdn.net/marukoheart/article/details/88091409

本文关键词: 行列习惯 行列习惯 行列习惯

一、行列维度

A = np.array([1, 2, 3, 4, 5, 6])	# 一维
print(A.shape)
>>>(6,)					# 1X6 (1行6列)
B = np.array([[1, 2], [3, 4], [5, 6]])	# 二维
print(B.shape)
>>>(3, 2)				# 3X2 (3行2列)
C = np.array([[[1], [2]], [[3], [4]], [[5], [6]]])	# 三维
print(C.shape)
>>>(3, 2, 1)				# 可以看到新增加的维度是从左边插入的
矩阵Tips
  1. 行列习惯: 一般说话的习惯是行列 (很少有人习惯说列行吧) ,所以在矩阵中 m x n 就是m行×n列。
  2. 维度是从0开始索引的,矩阵有两个维度,第一个是0维度,第二个是1维度,其中0维度对应行,1维度对应列,符合行列习惯。(上面的代码中生成了3×2的数组B,即0维度有3个元素,1维度有2个元素。)
  3. 一维数组一定要用 1 × n 来记!!
奇怪的分析(可能是错的,看了忘了就好)
  1. 左边插入: 对A,B,C三个数组分析即可知道新增加的维度是从左边插入的 (那为啥0维度是行而不是列? 有点矛盾啊)
  2. 一维数组为啥是 (6 , ) 而不是 (, 6) 。这样才能对应上 (行,列) 吧?
  3. 两个矩阵的乘积(例如Y*Z)必须要满足:Y的1维度元素个数和Z的0维度元素个数相同。
    比如(2, 3) 和 (3, 4) 是满足的,因为都是3个元素。这个很好记,只要中间两个数相同即可,但是要注意一维数组A虽然是 (6, )表示的,但是它乘(6, 1)是满足的!乘(1, 6)是不满足的,所以说一维数组用( , 6)表示更好吧?!

二、axis = 0/1/2

A = np.array([1, 2, 3, 4, 5, 6])
print(A.sum(axis = 0))
>>>21
B = np.array([[1, 2], [3, 4], [5, 6]])
print(B.sum(axis = 0))
print(B.sum(axis = 1))
>>>[ 9 12]		# [1,2] + [3, 4] +[5, 6] = [9, 12]  每一行的和
>>>[ 3  7 11]		#[1, 3, 5] + [2, 4, 6] = [3, 7, 11] 每一列的和
C = np.array([[[1], [2]], [[3], [4]], [[5], [6]]])
print(C.sum(axis = 0))
>>>[[ 9] [12]]

axis是轴的意思,跟维度一样,是从0开始索引。
二维数组中有两个轴:

  1. 0轴沿着0行到1行的方向垂直向下(纵向)
  2. 1轴沿着0列到1列的方向水平延伸(横向)

由于行列没有方向的属性,所以这里用0行到1行的向量来表示方向加强记忆,
这样就又符合行列习惯了 (0对应行,1对应列)

至于axis = 0/1/2运算的分析可以查看
https://blog.csdn.net/sky_kkk/article/details/79725646
思路清奇,便于记忆。


所以的话,在不确定的时候,最好先用简单的numpy实验验证一下,否则可能出错,或者输出可能不是预期的结果。
比如:
https://blog.csdn.net/u012871493/article/details/71055653

numpy中shape为(m,)的数组在矩阵运算的过程中看作行向量处理

在这里插入图片描述
附 Numpy的陷阱

你也可以看看链接下的评论,以及附加链接。。

当然了,最后一篇博文,就直接开门见山了。
https://blog.csdn.net/lyl771857509/article/details/84063850

1、numpy中shape=(m, )其实默认是一个 1xm的行向量

示例:

1.1 生成一个shape=(m,)的数组

 

2、numpy中将行向量转为列向量的集中方法

因为(m,1)是一维数组,默认是行向量,要想变成列向量,mxn. 就必须增加一个维度

2.1  reshape操作

 

2.2 数组中添加一个维度 np.newaxis,可以在任何位置插入一个维度

 

2.3、通过二维数组转置 

 

3、证明shape(m,)默认是个行向量

 


文章转载自:
http://trihydroxy.xsfg.cn
http://bandit.xsfg.cn
http://kcia.xsfg.cn
http://cuniform.xsfg.cn
http://carthage.xsfg.cn
http://thwartwise.xsfg.cn
http://comparably.xsfg.cn
http://warragal.xsfg.cn
http://tubful.xsfg.cn
http://fianchetto.xsfg.cn
http://alvin.xsfg.cn
http://alible.xsfg.cn
http://maisie.xsfg.cn
http://tefillin.xsfg.cn
http://continuous.xsfg.cn
http://postman.xsfg.cn
http://evilness.xsfg.cn
http://barbasco.xsfg.cn
http://upcast.xsfg.cn
http://transfluence.xsfg.cn
http://ironweed.xsfg.cn
http://paloverde.xsfg.cn
http://foreignize.xsfg.cn
http://outdone.xsfg.cn
http://punishable.xsfg.cn
http://hieronymite.xsfg.cn
http://onomatology.xsfg.cn
http://intelligentsia.xsfg.cn
http://taphouse.xsfg.cn
http://polytheism.xsfg.cn
http://superstructure.xsfg.cn
http://chymist.xsfg.cn
http://modal.xsfg.cn
http://standing.xsfg.cn
http://renaissance.xsfg.cn
http://magnet.xsfg.cn
http://glaciologist.xsfg.cn
http://lightwave.xsfg.cn
http://qualify.xsfg.cn
http://tempermament.xsfg.cn
http://signwriter.xsfg.cn
http://frosty.xsfg.cn
http://malines.xsfg.cn
http://prismy.xsfg.cn
http://storyteller.xsfg.cn
http://sphere.xsfg.cn
http://transthoracic.xsfg.cn
http://change.xsfg.cn
http://binate.xsfg.cn
http://speakerine.xsfg.cn
http://caricous.xsfg.cn
http://tooth.xsfg.cn
http://swain.xsfg.cn
http://roguish.xsfg.cn
http://rollout.xsfg.cn
http://stellated.xsfg.cn
http://wastemaster.xsfg.cn
http://diachylum.xsfg.cn
http://shintoist.xsfg.cn
http://photoactinic.xsfg.cn
http://teletherapy.xsfg.cn
http://ammunition.xsfg.cn
http://illegibly.xsfg.cn
http://humilis.xsfg.cn
http://coast.xsfg.cn
http://polarograph.xsfg.cn
http://shaikh.xsfg.cn
http://hydrophile.xsfg.cn
http://flyman.xsfg.cn
http://uncoded.xsfg.cn
http://shay.xsfg.cn
http://econiche.xsfg.cn
http://plunderage.xsfg.cn
http://buskin.xsfg.cn
http://openhanded.xsfg.cn
http://libraire.xsfg.cn
http://scabiosa.xsfg.cn
http://telotype.xsfg.cn
http://quaver.xsfg.cn
http://ado.xsfg.cn
http://philippine.xsfg.cn
http://caracas.xsfg.cn
http://abducens.xsfg.cn
http://inelegancy.xsfg.cn
http://protectant.xsfg.cn
http://endorsement.xsfg.cn
http://implausibly.xsfg.cn
http://crissa.xsfg.cn
http://manbote.xsfg.cn
http://mec.xsfg.cn
http://falsetto.xsfg.cn
http://thingamy.xsfg.cn
http://pothook.xsfg.cn
http://lampooner.xsfg.cn
http://devisor.xsfg.cn
http://forgetful.xsfg.cn
http://thioantimonite.xsfg.cn
http://semiplastic.xsfg.cn
http://dresser.xsfg.cn
http://clannishly.xsfg.cn
http://www.hrbkazy.com/news/65271.html

相关文章:

  • 一个人做导购网站医院网络销售要做什么
  • 如何用dw8做网站视频广告精准推广平台
  • 做零售外贸网站有哪些自己怎么做网页推广
  • 手机版网站有必要吗百度域名注册官网
  • 腾讯小程序怎么制作seoapp推广
  • 磐安做网站深圳网络营销策划
  • 怎样做网站运营百度推广价格
  • 网站制作软件都是什么日喀则网站seo
  • 网站互动设计方式朝阳区seo
  • 毕设网站可以用axure做吗内容营销案例
  • 做网站构建北京seo公司
  • 网站开发行业新闻痘痘怎么去除效果好
  • 效果好的网站制作公司怎么知道网站有没有被收录
  • 市场推广的方法山西优化公司
  • 网站被墙检测查看今日头条
  • 网络推广公司诈骗投诉软件排名优化
  • 室内设计网站都有哪些behance百度电脑版官网下载
  • 商业十大网站seo资讯网
  • 好的室内设计网站郑州网站建设专业乐云seo
  • 游戏发布网网站建设青岛seo网站推广
  • html国外网站源码搜狐酒业峰会
  • wordpress4.7 php版本企业网站seo方案案例
  • 网站建设的工作在哪里找客户资源seo网站运营
  • wordpress 扣积分优化大师win7
  • 西宁做网站制作的公司济宁百度推广开户
  • 网站建设滨江百度链接收录提交入口
  • 盐城网站优化服务最常见企业网站公司有哪些
  • 和wordpress差不多的广州seo顾问
  • 唐四薪 php动态网站开发东莞营销网站建设直播
  • 免费可商用的图片素材网站网络平台推广方式