鍏充簬姊害鐨勪竴浜涚煡璇嗙偣
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了鍏充簬姊害鐨勪竴浜涚煡璇嗙偣相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/%e6%b3%95%e5%88%99' title='娉曞垯'>娉曞垯 oid sig 閾捐矾 閫掑綊 com 閾惧紡 姹傚
(
abla f = [frac{partial f}{partial x} , frac{partial f}{partial y}]) ?鍥犳鍙煡锛屾搴︽槸涓€涓悜閲忚€屼笉鏄竴涓爣閲?br>
??2.鍒╃敤閾惧紡娉曞垯瑙i噴浣曚负鍙嶅悜浼犳挱锛?br />
????????f(x,y,z)=(x+y)z锛?q = x+y銆傚鏋滄垜浠f姹倄鐨勫亸瀵笺€傚疄闄呬负(frac{partial f}{partial x} = frac{partial f}{partial q} frac{partial q}{partial x})銆傛鏃讹紝鎴戜滑浣跨敤浠g爜鏉ュ鐜拌繖涓€杩囩▼锛屽€熸鏉ヨ鍙嶅悜浼犳挱锛?/p>
# 璁剧疆杈撳叆鍊?x = -2; y = 5; z = -4
# 杩涜鍓嶅悜浼犳挱
q = x + y # q becomes 3
f = q * z # f becomes -12
# 杩涜鍙嶅悜浼犳挱:
# 棣栧厛鍥炰紶鍒?f = q * z
dfdz = q # df/dz = q, 鎵€浠ュ叧浜巣鐨勬搴︽槸3
dfdq = z # df/dq = z, 鎵€浠ュ叧浜巕鐨勬搴︽槸-4
# 鐜板湪鍥炰紶鍒皅 = x + y
dfdx = 1.0 * dfdq # dq/dx = 1. 杩欓噷鐨勪箻娉曟槸鍥犱负閾惧紡娉曞垯
dfdy = 1.0 * dfdq # dq/dy = 1
# 璁剧疆杈撳叆鍊?x = -2; y = 5; z = -4
# 杩涜鍓嶅悜浼犳挱
q = x + y # q becomes 3
f = q * z # f becomes -12
# 杩涜鍙嶅悜浼犳挱:
# 棣栧厛鍥炰紶鍒?f = q * z
dfdz = q # df/dz = q, 鎵€浠ュ叧浜巣鐨勬搴︽槸3
dfdq = z # df/dq = z, 鎵€浠ュ叧浜巕鐨勬搴︽槸-4
# 鐜板湪鍥炰紶鍒皅 = x + y
dfdx = 1.0 * dfdq # dq/dx = 1. 杩欓噷鐨勪箻娉曟槸鍥犱负閾惧紡娉曞垯
dfdy = 1.0 * dfdq # dq/dy = 1
鎴戜滑閫氳繃涓婅堪浠g爜寰楀埌浜嗘搴?span class="math inline">([frac{partial f}{partial x} , frac{partial f}{partial y}, frac{partial f}{partial z}])鎴戜滑鐨勮绠楄繃绋嬪涓嬪浘鎵€绀猴細
鍓嶅悜浼犳挱浠庤緭鍏ヨ绠楀埌杈撳嚭锛堢豢鑹诧級锛屽弽鍚戜紶鎾粠灏鹃儴寮€濮嬶紝鏍规嵁閾惧紡娉曞垯閫掑綊鍦板悜鍓嶈绠楁搴︼紙鏄剧ず涓虹孩鑹层€傛瘮濡傝鎴戞兂寰楀埌f鍏充簬z鐨勫弽鍚戜紶鎾紝灏卞z姹傛搴︼級锛屼竴鐩村埌缃戠粶鐨勮緭鍏ョ銆傚彲浠ヨ涓猴紝姊害鏄粠璁$畻閾捐矾涓洖娴併€?br>
涓嬮潰涓句竴涓浣曞埄鐢ㄨ繖绉嶆€濇兂姹備竴涓鏉傚嚱鏁版搴︾殑渚嬪瓙锛?br />
(f = frac{1}{1 + exp(-(w_{0}x_{0} + w_{1}x_{1} + w{2}))})
鍦ㄨ繖閲屾垜浠娇鐢╯igmod鍑芥暟姹傚鐨勬€濇兂
(sigma(x) = frac{1}{1 + exp(-x)})
鎴戜滑閫氳繃浠ヤ笅鐨勪唬鐮佹眰鍑哄x鍜寃鐨勬搴︼細
w = [2,-3,-3] # 鍋囪涓€浜涢殢鏈烘暟鎹拰鏉冮噸
x = [-1, -2]
# 鍓嶅悜浼犳挱
dot = w[0]*x[0] + w[1]*x[1] + w[2]
f = 1.0 / (1 + math.exp(-dot)) # sigmoid鍑芥暟
# 瀵圭缁忓厓鍙嶅悜浼犳挱
ddot = (1 - f) * f # 鐐圭Н鍙橀噺鐨勬搴? 浣跨敤sigmoid鍑芥暟姹傚
dx = [w[0] * ddot, w[1] * ddot] # 鍥炰紶鍒皒
dw = [x[0] * ddot, x[1] * ddot, 1.0 * ddot] # 鍥炰紶鍒皐
# 瀹屾垚锛佸緱鍒拌緭鍏ョ殑姊害
涓婅堪浠g爜鍏堝畬鎴愪簡瀵筪ot=(w_{0}x_{0} + w_{1}x_{1} + w{2})鐨勬眰瀵硷紝鐒跺悗鍐嶄护dot瀵箈鍜寃鐨勫垎閲忔眰瀵?/p>
以上是关于鍏充簬姊害鐨勪竴浜涚煡璇嗙偣的主要内容,如果未能解决你的问题,请参考以下文章