Plik:Gradient descent.png

Z testwiki
Przejdź do nawigacji Przejdź do wyszukiwania
    Rozmiar pierwotny (482 × 529 pikseli, rozmiar pliku: 25 KB, typ MIME: image/png)

    Ten plik znajduje się w Wikimedia Commons i może być używany w innych projektach. Poniżej znajdują się informacje ze strony opisu tego pliku.

    Opis

    Opis An illustration of the gradient descent method. I graphed this with Matlab
    Data 19 listopada 2004 (data pierwszego przesłania pliku)
    Źródło Na Commons przeniesiono z en.wikipedia.
    Autor Olegalexandrov z angielskiej Wikipedii
    Inne wersje
    Ta ilustracja ma także wersję wektorową („SVG”).
    Zaleca się wykorzystywanie w galeriach dostępnej wersji wektorowej zamiast obecnej.

    File:Gradient descent.png → File:Gradient descent.svg

    Więcej o grafice wektorowej przeczytasz w artykule Przenoszenie grafik Commons do formatu SVG.
    Dostępna jest także informacja o obsłudze grafik SVG przez MediaWiki.

    W innych językach
    Alemannisch ∙ العربية ∙ беларуская (тарашкевіца) ∙ български ∙ বাংলা ∙ català ∙ нохчийн ∙ čeština ∙ dansk ∙ Deutsch ∙ Ελληνικά ∙ English ∙ British English ∙ Esperanto ∙ español ∙ eesti ∙ euskara ∙ فارسی ∙ suomi ∙ français ∙ Frysk ∙ galego ∙ Alemannisch ∙ עברית ∙ हिन्दी ∙ hrvatski ∙ magyar ∙ հայերեն ∙ Bahasa Indonesia ∙ Ido ∙ italiano ∙ 日本語 ∙ ქართული ∙ 한국어 ∙ lietuvių ∙ македонски ∙ മലയാളം ∙ Bahasa Melayu ∙ မြန်မာဘာသာ ∙ norsk bokmål ∙ Plattdüütsch ∙ Nederlands ∙ norsk nynorsk ∙ norsk ∙ occitan ∙ polski ∙ prūsiskan ∙ português ∙ português do Brasil ∙ română ∙ русский ∙ sicilianu ∙ Scots ∙ slovenčina ∙ slovenščina ∙ српски / srpski ∙ svenska ∙ தமிழ் ∙ ไทย ∙ Türkçe ∙ татарча / tatarça ∙ українська ∙ vèneto ∙ Tiếng Việt ∙ 中文 ∙ 中文(中国大陆) ∙ 中文(简体) ∙ 中文(繁體) ∙ 中文(马来西亚) ∙ 中文(新加坡) ∙ 中文(臺灣) ∙ +/−
    Nowa grafika

    PNG rozwój
    InfoField
     Ten diagram został stworzony za pomocą MATLAB


    Licencja

    Public domain Ja, właściciel praw autorskich do tej pracy, udostępniam ją jako własność publiczną. Dotyczy to całego świata.
    W niektórych krajach może nie być to prawnie możliwe, jeśli tak, to:
    Zapewniam każdemu prawo do użycia tej pracy w dowolnym celu, bez żadnych ograniczeń, chyba że te ograniczenia są wymagane przez prawo.

    Source code (MATLAB)

     
    
    % Illustration of gradient descent
    function main()
    
    % the ploting window
       figure(1);
       clf; hold on;
       set(gcf, 'color', 'white');
       set(gcf, 'InvertHardCopy', 'off');
       axis equal; axis off;
    
    % the box 
       Lx1=-2; Lx2=2; Ly1=-2; Ly2=2;
    
    % the function whose contours will be plotted
       N=60; h=1/N;
       XX=Lx1:h:Lx2;
       YY=Ly1:h:Ly2;
       [X, Y]=meshgrid(XX, YY);
       f=inline('-((y+1).^4/25+(x-1).^4/10+x.^2+y.^2-1)');
       Z=f(X, Y);
    
    % the contours
       h=0.3; l0=-1; l1=20;
       l0=h*floor(l0/h);
       l1=h*floor(l1/h);
       v=[l0:1.5*h:0 0:h:l1 0.8 0.888];
       [c,h] = contour(X, Y, Z, v, 'b'); 
    
    % graphing settings
       small=0.08;
       small_rad = 0.01;
       thickness=1; arrowsize=0.06; arrow_type=2;
       fontsize=13;
       red = [1, 0, 0];
       white = 0.99*[1, 1, 1];
    
    % initial guess for gradient descent
       x=-0.6498; y=-1.0212;
    
       % run several iterations of gradient descent
       for i=0:4
          H=text(x-1.5*small, y+small/2, sprintf('x_%d', i));
          set(H, 'fontsize', fontsize, 'color', 0*[1 1 1]);
    
         % the derivatives in x and in y, the step size
          u=-2/5*(x-1)^3-2*x;
          v=-4/25*(y+1)^3-2*y;
          alpha=0.11;
          
          if i< 4
    	 plot([x, x+alpha*u], [y, y+alpha*v]);
    	 arrow([x, y], [x, y]+alpha*[u, v], thickness, arrowsize, pi/8, ...
    	       arrow_type, [1, 0, 0])
    	 x=x+alpha*u; y=y+alpha*v;
          end
          
       end
       
    % some dummy text, to expand the saving window a bit
       text(-0.9721, -1.5101, '*', 'color', white);
       text(1.5235,   1.1824, '*', 'color', white);
       
    % save to eps
       saveas(gcf, 'Gradient_descent.eps', 'psc2')
    
    function arrow(start, stop, thickness, arrow_size, sharpness, arrow_type, color)
    
    % Function arguments:
    % start, stop:  start and end coordinates of arrow, vectors of size 2
    % thickness:    thickness of arrow stick
    % arrow_size:   the size of the two sides of the angle in this picture ->
    % sharpness:    angle between the arrow stick and arrow side, in radians
    % arrow_type:   1 for filled arrow, otherwise the arrow will be just two segments
    % color:        arrow color, a vector of length three with values in [0, 1]
    
    % convert to complex numbers
       i=sqrt(-1);
       start=start(1)+i*start(2); stop=stop(1)+i*stop(2);
       rotate_angle=exp(i*sharpness);
    
    % points making up the arrow tip (besides the "stop" point)
       point1 = stop - (arrow_size*rotate_angle)*(stop-start)/abs(stop-start);
       point2 = stop - (arrow_size/rotate_angle)*(stop-start)/abs(stop-start);
    
       if arrow_type==1 % filled arrow
    
    % plot the stick, but not till the end, looks bad
          t=0.5*arrow_size*cos(sharpness)/abs(stop-start); stop1=t*start+(1-t)*stop;
          plot(real([start, stop1]), imag([start, stop1]), 'LineWidth', thickness, 'Color', color);
    
    % fill the arrow
          H=fill(real([stop, point1, point2]), imag([stop, point1, point2]), color);
          set(H, 'EdgeColor', 'none')
    
       else % two-segment arrow
          plot(real([start, stop]), imag([start, stop]),   'LineWidth', thickness, 'Color', color);
          plot(real([stop, point1]), imag([stop, point1]), 'LineWidth', thickness, 'Color', color);
          plot(real([stop, point2]), imag([stop, point2]), 'LineWidth', thickness, 'Color', color);
       end
    
    function ball(x, y, r, color)
       Theta=0:0.1:2*pi;
       X=r*cos(Theta)+x;
       Y=r*sin(Theta)+y;
       H=fill(X, Y, color);
       set(H, 'EdgeColor', 'none');
    

    Oryginalny rejestr przesyłania

    Oryginalna strona opisu była tutaj. Wszystkie poniższe nazwy użytkowników odwołują się do en.wikipedia.
    • 2004-11-19 02:41 Olegalexandrov 471×492×8 (27067 bytes) An illustration of the gradient descent method. I graphed this with Matlab {{PD}}

    Podpisy

    Dodaj jednolinijkowe objaśnienie tego, co ten plik pokazuje

    Obiekty przedstawione na tym zdjęciu

    przedstawia

    25 564 bajt

    529 piksel

    482 piksel

    image/png

    6a71a27aa257ad0c4ecd0749084fba286d81cdd1

    Historia pliku

    Kliknij datę lub czas, aby zobaczyć, jak plik wyglądał w tamtej chwili.

    Data i czasMiniaturaWymiaryUżytkownikOpis
    aktualny04:33, 23 cze 2007Miniatura wersji z 23 cze 2007, 04:33482 × 529 (25 KB)wikimediacommons>Oleg Alexandrov{{Information |Description=An illustration of the gradient descent method. I graphed this with Matlab |Source=Originally from [http://en.wikipedia.org en.wikipedia]; description page is/was [http://en.wikipedia.org/w/index.php?title=Image%3AGradient_desce

    Żadna strona nie korzysta z tego pliku.