File:Coordinate descent.svg

页面内容不支持其他语言。
这个文件来自维基共享资源
维基百科,自由的百科全书

原始文件(SVG文件,尺寸为900 × 900像素,文件大小:56 KB)


摘要

描述
English: Coordinate descent with cyclic iteration of the coordinates. In each iteration a line search is done to find the step.
日期
来源 自己的作品
作者 Nicoguaro
SVG开发
InfoField
 
SVG的源代码为有效代码
 
矢量图使用Matplotlib创作。
 
The file size of this SVG plot may be irrationally large because its text has been converted to paths inhibiting translations.
原始码
InfoField

Python code

from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import line_search
from matplotlib import rcParams

rcParams['font.family'] = 'serif'
rcParams['font.size'] = 16


def fun(x, y):
    return 5*x**2 - 6*x*y + 5*y**2


def f(x):
    x1 = x[0]
    x2 = x[1]
    return fun(x1, x2)


def g(x):
    x1 = x[0]
    x2 = x[1]
    g1 = 10*x1 - 6*x2
    g2 = -6*x1 + 10*x2
    return [g1, g2]


X, Y = np.mgrid[-1.5:1.5:101j, -1.5:1.5:101j]
Z = fun(X, Y)
levels = np.linspace(0.5, 5, 6)
plt.figure(figsize=(10, 10))
CS = plt.contour(X, Y, Z, levels=levels, colors='k')
plt.clabel(CS)
xk = np.array([-0.5, -1])
pk = np.array([0., 1.])
for k in range(10):
    res = line_search(f, g, xk, pk)
    alpha = res[0]
    xnew = xk + 0.6*alpha*pk
    pk = pk[::-1]
    plt.arrow(xk[0], xk[1], xnew[0] - xk[0], xnew[1] - xk[1],
              fc='r', ec='r',
              length_includes_head=True)
    xk = xnew

plt.axis('image')
plt.xlabel(r'$x$', size=18)
plt.ylabel(r'$y$', size=18)
plt.title(r'$f(x,y) = 5x^2 - 6xy + 5y^2$')
plt.savefig('coordinate descent.svg')
plt.show()

许可协议

我,本作品著作权人,特此采用以下许可协议发表本作品:
w:zh:知识共享
署名
本文件采用知识共享署名 4.0 国际许可协议授权。
您可以自由地:
  • 共享 – 复制、发行并传播本作品
  • 修改 – 改编作品
惟须遵守下列条件:
  • 署名 – 您必须对作品进行署名,提供授权条款的链接,并说明是否对原始内容进行了更改。您可以用任何合理的方式来署名,但不得以任何方式表明许可人认可您或您的使用。

说明

添加一行文字以描述该文件所表现的内容

此文件中描述的项目

描绘内容

创作作者 简体中文(已转写)

某些值没有维基数据项目

作者姓名字符串 简体中文(已转写):​Nicoguaro
维基媒体用户名 简体中文(已转写):​Nicoguaro

版权状态 简体中文(已转写)

版权所有 简体中文(已转写)

知识共享署名4.0国际 简体中文(已转写)

文件来源 简体中文(已转写)

上传者的原创作品 简体中文(已转写)

媒体类型 简体中文(已转写)

image/svg+xml

校验和 简体中文(已转写)

8aa4708e79cc2d206b2113e4eb039473c69399c9

断定方法:​SHA-1 简体中文(已转写)

数据大小 简体中文(已转写)

56,909 字节

900 像素

900 像素

文件历史

点击某个日期/时间查看对应时刻的文件。

日期/时间缩⁠略⁠图大小用户备注
当前2016年1月10日 (日) 00:102016年1月10日 (日) 00:10版本的缩略图900 × 900(56 KB)NicoguaroAdd labels to the contours.
2016年1月9日 (六) 23:192016年1月9日 (六) 23:19版本的缩略图900 × 900(50 KB)NicoguaroUser created page with UploadWizard

以下页面使用本文件:

全域文件用途

以下其他wiki使用此文件:

元数据