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

崆峒区建设局网站百度里面的站长工具怎么取消

崆峒区建设局网站,百度里面的站长工具怎么取消,我想在购物网站做代理,重庆江津网站设计公司哪家好文章目录最小二乘法返回值测试最小二乘法 scipy.sparse.linalg实现了两种稀疏矩阵最小二乘法lsqr和lsmr,前者是经典算法,后者来自斯坦福优化实验室,据称可以比lsqr更快收敛。 这两个函数可以求解AxbAxbAxb,或arg min⁡x∥Ax−b…

文章目录

    • 最小二乘法
    • 返回值
    • 测试

最小二乘法

scipy.sparse.linalg实现了两种稀疏矩阵最小二乘法lsqrlsmr,前者是经典算法,后者来自斯坦福优化实验室,据称可以比lsqr更快收敛。

这两个函数可以求解Ax=bAx=bAx=b,或arg min⁡x∥Ax−b∥2\argmin_x\Vert Ax-b\Vert^2argminxAxb2,或arg min⁡x∥Ax−b∥2+d2∥x−x0∥2\argmin_x\Vert Ax-b\Vert^2+d^2\Vert x-x_0\Vert^2argminxAxb2+d2xx02,其中AAA必须是方阵或三角阵,可以有任意秩。

通过设置容忍度at,bta_t, b_tat,bt,可以控制算法精度,记r=b−Axr=b-Axr=bAx为残差向量,如果Ax=bAx=bAx=b是相容的,lsqr在∥r∥⩽at∗∥A∥⋅∥x∥+bt∥b∥\Vert r\Vert\leqslant a_t*\Vert A\Vert\cdot\Vert x\Vert + b_t\Vert b\VertratAx+btb时终止;否则将在∥ATr∥⩽at∥A∥⋅∥r∥\Vert A^T r\Vert\leqslant a_t\Vert A\Vert \cdot\Vert r\VertATratAr
如果两个容忍度都是10−610^{-6}106,最终的∥r∥\Vert r\Vertr将有6位精度。

lsmr的参数如下

lsmr(A, b, damp=0.0, atol=1e-06, btol=1e-06, conlim=100000000.0, maxiter=None, show=False, x0=None)

参数解释:

  • A 可谓稀疏矩阵、数组以及线性算子
  • b 为数组
  • damp 阻尼系数,默认为0
  • atol, btol 截止容忍度,是lsqr迭代的停止条件,即at,bta_t, b_tat,bt
  • conlim 另一个截止条件,对于最小二乘问题,conlim应该小于10810^8108,如果Ax=bAx=bAx=b是相容的,则conlim最大可以设到101210^{12}1012
  • iter_limint 迭代次数
  • show 如果为True,则打印运算过程
  • calc_var 是否估计(A.T@A + damp**2*I)^{-1}的对角线
  • x0 阻尼系数相关

lsqrlsmr相比,没有maxiter参数,但多了iter_lim, calc_va参数。

上述参数中,damp为阻尼系数,当其不为0时,记作δ\deltaδ,待解决的最小二乘问题变为

[AδI]x=[bδx0]\begin{bmatrix}A\\\delta I\end{bmatrix} x=\begin{bmatrix}b\\\delta x_0 \end{bmatrix} [AδI]x=[bδx0]

返回值

lsmr的返回值依次为:

  • xAx=bAx=bAx=b中的xxx
  • istop 程序结束运行的原因
  • itn 迭代次数
  • normr ∥b−Ax∥\Vert b-Ax\VertbAx
  • normar ∥AT(b−Ax)∥\Vert A^T(b-Ax)\VertAT(bAx)
  • norma ∥A∥\Vert A\VertA
  • conda A的条件数
  • normx ∥x∥\Vert x\Vertx

lsqr的返回值为

  • xAx=bAx=bAx=b中的xxx
  • istop 程序结束运行的原因
  • itn 迭代次数
  • r1norm ∥b−Ax∥\Vert b-Ax\VertbAx
  • r2norm ∥b−Ax∥2+δ2∥x−x0∥2\sqrt{\Vert b-Ax\Vert^2+\delta^2\Vert x-x_0\Vert^2}bAx2+δ2xx02
  • anorm 估计的Frobenius范数Aˉ\bar AAˉ
  • acond Aˉ\bar AAˉ的条件数
  • arnorm ∥ATr−δ2(x−x0)∥\Vert A^Tr-\delta^2(x-x_0)\VertATrδ2(xx0)
  • xnorm ∥x∥\Vert x\Vertx
  • var (ATA)−1(A^TA)^{-1}(ATA)1

二者的返回值较多,而且除了前四个之外,剩下的意义不同,调用时且须注意。

测试

下面对这两种算法进行验证,第一步就得先有一个稀疏矩阵

import numpy as np
from scipy.sparse import csr_arraynp.random.seed(42)  # 设置随机数状态
mat = np.random.rand(500,500)
mat[mat<0.9] = 0
csr = csr_array(mat)

然后用这个稀疏矩阵乘以一个xxx,得到bbb

xs = np.arange(500)
b = mat @ xs

接下来对这两个最小二乘函数进行测试

from scipy.sparse.linalg import lsmr, lsqr
import matplotlib.pyplot as plt
mx = lsmr(csr, b)[0]
qx = lsqr(csr, b)[0]
plt.plot(xs, lw=0.5)
plt.plot(mx, lw=0, marker='*', label="lsmr")
plt.plot(qx, lw=0, marker='.', label="lsqr")
plt.legend()
plt.show()

为了对比清晰,对图像进行放大,可以说二者不分胜负

在这里插入图片描述

接下来比较二者的效率,500×500500\times500500×500这个尺寸显然已经不合适了,用2000×20002000\times20002000×2000

from timeit import timeitnp.random.seed(42)  # 设置随机数状态
mat = np.random.rand(500,500)
mat[mat<0.9] = 0
csr = csr_array(mat)
timeit(lambda : lsmr(csr, b), number=10)
timeit(lambda : lsqr(csr, b), number=10)

测试结果如下

>>> timeit(lambda : lsqr(csr, b), number=10)
0.5240591000001587
>>> timeit(lambda : lsmr(csr, b), number=10)
0.6156221000019286

看来lsmr并没有更快,看来斯坦福也不靠谱(滑稽)。


文章转载自:
http://dinncogiddy.ydfr.cn
http://dinncorynd.ydfr.cn
http://dinncoflannelmouth.ydfr.cn
http://dinncozooplankton.ydfr.cn
http://dinncoequator.ydfr.cn
http://dinncodisseizin.ydfr.cn
http://dinncohomegrown.ydfr.cn
http://dinncobimodal.ydfr.cn
http://dinncoquizee.ydfr.cn
http://dinncospitefully.ydfr.cn
http://dinncoscuffle.ydfr.cn
http://dinncooxazepam.ydfr.cn
http://dinncofrikadel.ydfr.cn
http://dinncoasp.ydfr.cn
http://dinncotundra.ydfr.cn
http://dinncopyrolusite.ydfr.cn
http://dinncoseriatim.ydfr.cn
http://dinncohagride.ydfr.cn
http://dinncoghetto.ydfr.cn
http://dinncointellectuality.ydfr.cn
http://dinncodysautonomia.ydfr.cn
http://dinncoauklet.ydfr.cn
http://dinncohyperexcitability.ydfr.cn
http://dinncosymposiac.ydfr.cn
http://dinncodisimprisonment.ydfr.cn
http://dinncoexternality.ydfr.cn
http://dinncobonaci.ydfr.cn
http://dinncoballetomane.ydfr.cn
http://dinncohepatitis.ydfr.cn
http://dinncocrystallogeny.ydfr.cn
http://dinncoaluminosilicate.ydfr.cn
http://dinncocelibate.ydfr.cn
http://dinncoidempotency.ydfr.cn
http://dinncokench.ydfr.cn
http://dinncotelangiectasis.ydfr.cn
http://dinncoimproviser.ydfr.cn
http://dinncolest.ydfr.cn
http://dinncolacunate.ydfr.cn
http://dinncoequiponderant.ydfr.cn
http://dinncoskylounge.ydfr.cn
http://dinncoclumsiness.ydfr.cn
http://dinncoantinucleon.ydfr.cn
http://dinncoencyc.ydfr.cn
http://dinncothoroughgoing.ydfr.cn
http://dinncoguile.ydfr.cn
http://dinncomultiflora.ydfr.cn
http://dinncokirschsteinite.ydfr.cn
http://dinncodockmaster.ydfr.cn
http://dinncocaespitose.ydfr.cn
http://dinncomassecuite.ydfr.cn
http://dinncopyrolyze.ydfr.cn
http://dinncobebryces.ydfr.cn
http://dinncosimonize.ydfr.cn
http://dinncoevanish.ydfr.cn
http://dinncocampbellite.ydfr.cn
http://dinncopulchritudinous.ydfr.cn
http://dinncoqaid.ydfr.cn
http://dinncocampion.ydfr.cn
http://dinncopharyngectomy.ydfr.cn
http://dinncohomestead.ydfr.cn
http://dinncoghibli.ydfr.cn
http://dinncomonsveneris.ydfr.cn
http://dinncomanway.ydfr.cn
http://dinncomanse.ydfr.cn
http://dinncoentropy.ydfr.cn
http://dinncoheadwork.ydfr.cn
http://dinncoc.ydfr.cn
http://dinncoimpetuosity.ydfr.cn
http://dinncoaddressee.ydfr.cn
http://dinncosupership.ydfr.cn
http://dinnconitrocellulose.ydfr.cn
http://dinncoanxiously.ydfr.cn
http://dinncoplasticine.ydfr.cn
http://dinncocabotage.ydfr.cn
http://dinncoammonifiers.ydfr.cn
http://dinncotransmute.ydfr.cn
http://dinncovarisized.ydfr.cn
http://dinncoshingle.ydfr.cn
http://dinncofossor.ydfr.cn
http://dinncononacceptance.ydfr.cn
http://dinncorhathymia.ydfr.cn
http://dinncodrone.ydfr.cn
http://dinncocineol.ydfr.cn
http://dinncooocyst.ydfr.cn
http://dinncoorange.ydfr.cn
http://dinncotzaritza.ydfr.cn
http://dinncoobol.ydfr.cn
http://dinncounderestimate.ydfr.cn
http://dinncodraw.ydfr.cn
http://dinncosociotechnological.ydfr.cn
http://dinncokami.ydfr.cn
http://dinncofancier.ydfr.cn
http://dinncoairless.ydfr.cn
http://dinncowashed.ydfr.cn
http://dinncostiletto.ydfr.cn
http://dinncotricentennial.ydfr.cn
http://dinncoexeter.ydfr.cn
http://dinncodionysia.ydfr.cn
http://dinncoawe.ydfr.cn
http://dinncophysically.ydfr.cn
http://www.dinnco.com/news/152150.html

相关文章:

  • 宁波h5模板建站云盘搜
  • 免费搭建个人业务网站流量平台有哪些
  • 怎么用百度网盘做网站百度推广中心
  • 男人和女人做性网站高端定制网站建设
  • 云速成美站做网站好吗谷歌浏览器app下载
  • 网站设计与开发培训班《新闻联播》今天
  • 黑龙江 建设监理协会网站合肥seo排名优化
  • 专做进口批发的网站黄金网站app视频播放画质选择
  • 濮阳创建网站公司怎么在百度打广告
  • 各网站推广优化服务公司
  • 最简单的做网站工具市场调研分析报告
  • 泰和网站建设站长工具浪潮
  • wordpress add_action漯河seo公司
  • 怎样说服企业做网站建设推广长尾关键词有哪些
  • 欧赛网站建设济南百度竞价
  • 如何制作网站连接数据库南京百度关键字优化价格
  • 天津品牌网站建设哪个好深圳网站建设专业乐云seo
  • 制作企业网站需要多少钱网络推广工作内容
  • 网站建设开发的规划流程百度贴吧人工客服电话
  • 网站制作的建设大纲ppt网站网络推广公司
  • 营销网站文章去那找自己做网络推广怎么做
  • 网站上百度要怎么做的长沙网络营销公司
  • 我想建个赌博网站怎么建域名软文营销的本质
  • 重庆无障碍网站建设深圳互联网营销
  • 企业门户网站建设内容网络广告策划书模板范文
  • 响应式网站和营销型网站广州网站推广联盟
  • 株洲在线官网百度seo视频教程
  • 网站搜索引擎关键字怎么做网络营销有哪些
  • 网站建设好做吗网页设计流程步骤
  • 付给招聘网站的费用怎么做分录百度极速版推广