ファイル:Gradient descent.gif

提供: testwiki
ナビゲーションに移動 検索に移動
    元のファイル (360 × 292 ピクセル、ファイルサイズ: 1.51メガバイト、MIME タイプ: image/gif、ループします、50 フレーム)

    このファイルはウィキメディア・コモンズのものであり、他のプロジェクトで使用されている可能性があります。 ウィキメディア・コモンズでのファイル解説ページにある説明を以下に示します。

    概要

    解説
    English: Gradient descent is a simple method to find the minimum of a function, where at each iteration a small step is made in the direction of the steepest descent. It tends to get stuck in a local minimum, so it is often run with several initial conditions.
    日付
    原典 https://twitter.com/j_bertolotti/status/1121054414066810881
    作者 Jacopo Bertolotti
    許可
    (ファイルの再利用)
    https://twitter.com/j_bertolotti/status/1030470604418428929

    Mathematica 11.0 code

    f = Evaluate[x^2 + y^2 + Total@Table[RandomReal[{0,2}] E^(-(((x - RandomReal[{-1, 1}])^2 + (y + RandomReal[{-1, 1}])^2)/(2 RandomReal[{0.1, 0.4}]^2))), {10}]];
    
    step = 0.02;
    nstep = 100;
    coord = {-1, 1};
    pos = {coord[[1]], coord[[2]], f /. {x -> coord[[1]], y -> coord[[2]]}};
    evo = Reap[Do[
          subst = MapThread[Rule, {{x, y, z}, pos}];
          dfx = (D[{x, y, f}, x] /. subst);
          dfy = (D[{x, y, f}, y] /. subst);
          tmp = {D[f, x] /. subst, D[f, y] /. subst};
          pos = pos - step {tmp[[1]], tmp[[2]], 0};
          pos[[3]] = Evaluate[f /. {x -> pos[[1]], y -> pos[[2]]}];
          Sow[pos];
          , nstep];][[2, 1]];
    
    coord = {-1, -1};
    pos = {coord[[1]], coord[[2]], f /. {x -> coord[[1]], y -> coord[[2]]}};
    evo1 = Reap[Do[
          subst = MapThread[Rule, {{x, y, z}, pos}];
          dfx = (D[{x, y, f}, x] /. subst);
          dfy = (D[{x, y, f}, y] /. subst);
          tmp = {D[f, x] /. subst, D[f, y] /. subst};
          pos = pos - step {tmp[[1]], tmp[[2]], 0};
          pos[[3]] = Evaluate[f /. {x -> pos[[1]], y -> pos[[2]]}];
          Sow[pos];
          , nstep];][[2, 1]];
    
    coord = {1, 1};
    pos = {coord[[1]], coord[[2]], f /. {x -> coord[[1]], y -> coord[[2]]}};
    evo2 = Reap[Do[
          subst = MapThread[Rule, {{x, y, z}, pos}];
          dfx = (D[{x, y, f}, x] /. subst);
          dfy = (D[{x, y, f}, y] /. subst);
          tmp = {D[f, x] /. subst, D[f, y] /. subst};
          pos = pos - step {tmp[[1]], tmp[[2]], 0};
          pos[[3]] = Evaluate[f /. {x -> pos[[1]], y -> pos[[2]]}];
          Sow[pos];
          , nstep];][[2, 1]];
    
    p1 = Table[
       Show[
        Plot3D[f, {x, -1.35, 1.35}, {y, -1.35, 1.35}, Boxed -> False, Axes -> False(*,PlotStyle\[Rule]{Opacity[0.3]}*)],
        Graphics3D[{PointSize[0.03], Point[evo[[j]] ], Thick, Line[evo[[1 ;; j]] ], Point[evo1[[j]] ], Line[evo1[[1 ;; j]]] , Point[evo2[[j]] ], Line[evo2[[1 ;; j]]] }]
        ]
       , {j, 1, nstep, 2}];
    ListAnimate[p1]
    

    ライセンス

    この作品の著作権者である私は、この作品を以下のライセンスで提供します。
    Creative Commons CC-Zero このファイルはクリエイティブ・コモンズ CC0 1.0 全世界 パブリック・ドメイン提供のもとで利用可能にされています。
    ある作品に本コモンズ証を関連づけた者は、その作品について世界全地域において著作権法上認められる、その者が持つすべての権利(その作品に関する権利や隣接する権利を含む。)を、法令上認められる最大限の範囲で放棄して、パブリック・ドメインに提供しています。

    この作品は、たとえ営利目的であっても、許可を得ずに複製、改変・翻案、配布、上演・演奏することが出来ます。

    キャプション

    このファイルの内容を1行で記述してください
    Gradient descent with 3 different initial conditions.

    このファイルに描写されている項目

    題材

    24 4 2019

    1,586,553 バイト

    292 ピクセル

    360 ピクセル

    5f21ecb37864995659c598e1bd301e90e17ae8b1

    ファイルの履歴

    過去の版のファイルを表示するには、その版の日時をクリックしてください。

    日時サムネイル寸法利用者コメント
    現在の版2019年4月25日 (木) 09:432019年4月25日 (木) 09:43時点における版のサムネイル360 × 292 (1.51メガバイト)wikimediacommons>BertoUser created page with UploadWizard

    このファイルを使用しているページはありません。