Training chapter completed. Began descrioption of Project I

This commit is contained in:
Clemens Dautermann 2020-01-31 13:02:24 +01:00
parent b061fd5a2f
commit 4b0d92af52
17 changed files with 268 additions and 84 deletions

View file

@ -113,23 +113,30 @@
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}Definieren des Netzes}{23}{subsection.4.2}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}Definieren des Netzes}{23}{subsection.4.2}\protected@file@percent }
\@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\contentsline {figure}{\numberline {28}{\ignorespaces Code um ein einfaches Netz in Pytorch zu definieren\relax }}{24}{figure.caption.26}\protected@file@percent } \@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\contentsline {figure}{\numberline {28}{\ignorespaces Code um ein einfaches Netz in Pytorch zu definieren\relax }}{24}{figure.caption.26}\protected@file@percent }
\newlabel{Net_simple_definition}{{28}{24}{Code um ein einfaches Netz in Pytorch zu definieren\relax }{figure.caption.26}{}} \newlabel{Net_simple_definition}{{28}{24}{Code um ein einfaches Netz in Pytorch zu definieren\relax }{figure.caption.26}{}}
\abx@aux@cite{7}
\abx@aux@segm{0}{0}{7}
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {4.3}Trainieren des Netzes}{25}{subsection.4.3}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {4.3}Trainieren des Netzes}{25}{subsection.4.3}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {5}Fallbeispiel I:\newline Ein Klassifizierungsnetzwerk f\IeC {\"u}r handgeschriebene Ziffern}{25}{section.5}\protected@file@percent } \@writefile{lof}{\defcounter {refsection}{0}\relax }\@writefile{lof}{\contentsline {figure}{\numberline {29}{\ignorespaces Code um das Netz auf einem Datensatz zu trainieren\relax }}{25}{figure.caption.27}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.1}Aufgabe}{25}{subsection.5.1}\protected@file@percent } \newlabel{Code_train_loop}{{29}{25}{Code um das Netz auf einem Datensatz zu trainieren\relax }{figure.caption.27}{}}
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.2}Der MNIST Datensatz}{25}{subsection.5.2}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {4.4}Pytorch und weights and biases}{26}{subsection.4.4}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.3}Ergebnis}{25}{subsection.5.3}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {5}Fallbeispiel I:\newline Ein Klassifizierungsnetzwerk f\IeC {\"u}r handgeschriebene Ziffern}{27}{section.5}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {6}Fallbeispiel II:\newline Eine selbsttrainierende KI f\IeC {\"u}r Tic-Tac-Toe}{25}{section.6}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.1}Aufgabe}{27}{subsection.5.1}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.1}Das Prinzip}{25}{subsection.6.1}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.2}Der MNIST Datensatz}{27}{subsection.5.2}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.2}Chance-Tree Optimierung}{25}{subsection.6.2}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.3}Das Netz}{28}{subsection.5.3}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.3}L\IeC {\"o}sung mittels eines neuronalen Netzes}{25}{subsection.6.3}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {5.4}Ergebnis}{28}{subsection.5.4}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.4}Vergleich}{25}{subsection.6.4}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {6}Fallbeispiel II:\newline Eine selbsttrainierende KI f\IeC {\"u}r Tic-Tac-Toe}{28}{section.6}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {7}Schlusswort}{25}{section.7}\protected@file@percent } \@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.1}Das Prinzip}{28}{subsection.6.1}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.2}Chance-Tree Optimierung}{28}{subsection.6.2}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.3}L\IeC {\"o}sung mittels eines neuronalen Netzes}{28}{subsection.6.3}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {subsection}{\numberline {6.4}Vergleich}{28}{subsection.6.4}\protected@file@percent }
\@writefile{toc}{\defcounter {refsection}{0}\relax }\@writefile{toc}{\contentsline {section}{\numberline {7}Schlusswort}{28}{section.7}\protected@file@percent }
\bibcite{1}{1} \bibcite{1}{1}
\bibcite{2}{2} \bibcite{2}{2}
\bibcite{3}{3} \bibcite{3}{3}
\bibcite{4}{4} \bibcite{4}{4}
\bibcite{5}{5} \bibcite{5}{5}
\bibcite{6}{6} \bibcite{6}{6}
\bibcite{7}{7}
\gdef\minted@oldcachelist{, \gdef\minted@oldcachelist{,
default-pyg-prefix.pygstyle, default-pyg-prefix.pygstyle,
default.pygstyle, default.pygstyle,
@ -159,4 +166,12 @@
689375EA3B9C38D437AA368912E13885F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex, 689375EA3B9C38D437AA368912E13885F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex,
6361598B18370336863B24D1B6FAE96EF6C426F58C5CCC27D3C7BD698FEC22DB.pygtex, 6361598B18370336863B24D1B6FAE96EF6C426F58C5CCC27D3C7BD698FEC22DB.pygtex,
7C08F8DDD5F5D41169EB51C2ADB3E0B1F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex, 7C08F8DDD5F5D41169EB51C2ADB3E0B1F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex,
5A0B7618927FB8AEA4B96F5552228CD8F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex} 5A0B7618927FB8AEA4B96F5552228CD8F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex,
B39808E7C45EEBD5237FE1E82D27387953A0C9FE66949F8EC4BED65B31F6975B.pygtex,
6843D04ED2E2C37F8AF3EB0462FB514BF6C426F58C5CCC27D3C7BD698FEC22DB.pygtex,
00B37D79FD3312AD6F59A2B37BA81087F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex,
684559E268B2B047D1C82BB00E985301F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex,
ECDE410C14A506CF9F77A687B26F5474F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex,
30299FD7E2187F6D53ED8A608F3958F2F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex,
458D5F1AFC81AE7291A7AAAD852DC12AF6C426F58C5CCC27D3C7BD698FEC22DB.pygtex,
B51E2DE1996D35173C012720F7A4FDA4F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex}

View file

@ -2001,6 +2001,7 @@
<bcf:citekey order="5">3</bcf:citekey> <bcf:citekey order="5">3</bcf:citekey>
<bcf:citekey order="6">3</bcf:citekey> <bcf:citekey order="6">3</bcf:citekey>
<bcf:citekey order="7">6</bcf:citekey> <bcf:citekey order="7">6</bcf:citekey>
<bcf:citekey order="8">7</bcf:citekey>
</bcf:section> </bcf:section>
<!-- SORTING TEMPLATES --> <!-- SORTING TEMPLATES -->
<bcf:sortingtemplate name="nty"> <bcf:sortingtemplate name="nty">

View file

@ -56,3 +56,5 @@
\contentsline {figure}{\numberline {27}{\ignorespaces Der Code zum Laden des MNIST Datensatzes\relax }}{22}{figure.caption.25}% \contentsline {figure}{\numberline {27}{\ignorespaces Der Code zum Laden des MNIST Datensatzes\relax }}{22}{figure.caption.25}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {figure}{\numberline {28}{\ignorespaces Code um ein einfaches Netz in Pytorch zu definieren\relax }}{24}{figure.caption.26}% \contentsline {figure}{\numberline {28}{\ignorespaces Code um ein einfaches Netz in Pytorch zu definieren\relax }}{24}{figure.caption.26}%
\defcounter {refsection}{0}\relax
\contentsline {figure}{\numberline {29}{\ignorespaces Code um das Netz auf einem Datensatz zu trainieren\relax }}{25}{figure.caption.27}%

View file

@ -1,4 +1,4 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex 2020.1.22) 30 JAN 2020 16:11 This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex 2020.1.22) 31 JAN 2020 13:00
entering extended mode entering extended mode
\write18 enabled. \write18 enabled.
%&-line parsing enabled. %&-line parsing enabled.
@ -1547,22 +1547,23 @@ ailable
ut line 4. ut line 4.
LaTeX Font Info: Font shape `T1/LinuxBiolinumT-TLF/b/n' will be LaTeX Font Info: Font shape `T1/LinuxBiolinumT-TLF/b/n' will be
(Font) scaled to size 10.0pt on input line 4. (Font) scaled to size 10.0pt on input line 4.
)
[1])
\tf@toc=\write8 \tf@toc=\write8
\openout8 = `Grundlagen_des_maschinellen_lernens.toc'. \openout8 = `Grundlagen_des_maschinellen_lernens.toc'.
[1] [2] [2]
LaTeX Warning: Citation '1' on page 3 undefined on input line 49. LaTeX Warning: Citation '1' on page 3 undefined on input line 49.
<../graphics/Classification.png, id=220, 467.5869pt x 464.6961pt> <../graphics/Classification.png, id=230, 467.5869pt x 464.6961pt>
File: ../graphics/Classification.png Graphic file (type png) File: ../graphics/Classification.png Graphic file (type png)
<use ../graphics/Classification.png> <use ../graphics/Classification.png>
Package pdftex.def Info: ../graphics/Classification.png used on input line 62. Package pdftex.def Info: ../graphics/Classification.png used on input line 62.
(pdftex.def) Requested size: 137.9979pt x 137.14088pt. (pdftex.def) Requested size: 137.9979pt x 137.14088pt.
[3] [3]
<../graphics/Regression.png, id=227, 467.5869pt x 464.6961pt> <../graphics/Regression.png, id=237, 467.5869pt x 464.6961pt>
File: ../graphics/Regression.png Graphic file (type png) File: ../graphics/Regression.png Graphic file (type png)
<use ../graphics/Regression.png> <use ../graphics/Regression.png>
Package pdftex.def Info: ../graphics/Regression.png used on input line 72. Package pdftex.def Info: ../graphics/Regression.png used on input line 72.
@ -1575,7 +1576,7 @@ LaTeX Warning: Citation '4' on page 5 undefined on input line 80.
LaTeX Warning: Citation '5' on page 5 undefined on input line 84. LaTeX Warning: Citation '5' on page 5 undefined on input line 84.
[5] [5]
<../graphics/overfitting.png, id=244, 467.5869pt x 529.0164pt> <../graphics/overfitting.png, id=254, 467.5869pt x 529.0164pt>
File: ../graphics/overfitting.png Graphic file (type png) File: ../graphics/overfitting.png Graphic file (type png)
<use ../graphics/overfitting.png> <use ../graphics/overfitting.png>
Package pdftex.def Info: ../graphics/overfitting.png used on input line 91. Package pdftex.def Info: ../graphics/overfitting.png used on input line 91.
@ -1587,7 +1588,7 @@ lem bei Klas-si-fi-zie-rungs-auf-ga-ben. Die Klas-
[] []
[6 <../graphics/overfitting.png>] [7] [6 <../graphics/overfitting.png>] [7]
<../graphics/Neuron.png, id=262, 299.9205pt x 158.994pt> <../graphics/Neuron.png, id=272, 299.9205pt x 158.994pt>
File: ../graphics/Neuron.png Graphic file (type png) File: ../graphics/Neuron.png Graphic file (type png)
<use ../graphics/Neuron.png> <use ../graphics/Neuron.png>
Package pdftex.def Info: ../graphics/Neuron.png used on input line 115. Package pdftex.def Info: ../graphics/Neuron.png used on input line 115.
@ -1597,7 +1598,7 @@ Package pdftex.def Info: ../graphics/Neuron.png used on input line 115.
LaTeX Warning: Citation '2' on page 8 undefined on input line 121. LaTeX Warning: Citation '2' on page 8 undefined on input line 121.
[8 <../graphics/Neuron.png>] [8 <../graphics/Neuron.png>]
<../graphics/Neural_Net.png, id=270, 548.16795pt x 432.8973pt> <../graphics/Neural_Net.png, id=280, 548.16795pt x 432.8973pt>
File: ../graphics/Neural_Net.png Graphic file (type png) File: ../graphics/Neural_Net.png Graphic file (type png)
<use ../graphics/Neural_Net.png> <use ../graphics/Neural_Net.png>
Package pdftex.def Info: ../graphics/Neural_Net.png used on input line 126. Package pdftex.def Info: ../graphics/Neural_Net.png used on input line 126.
@ -1651,25 +1652,25 @@ nded (in y). (see also unbounded coords=jump).
LaTeX Warning: `h' float specifier changed to `ht'. LaTeX Warning: `h' float specifier changed to `ht'.
[14] [14]
<../graphics/gdf_big_lr.png, id=325, 484.57034pt x 482.0409pt> <../graphics/gdf_big_lr.png, id=335, 484.57034pt x 482.0409pt>
File: ../graphics/gdf_big_lr.png Graphic file (type png) File: ../graphics/gdf_big_lr.png Graphic file (type png)
<use ../graphics/gdf_big_lr.png> <use ../graphics/gdf_big_lr.png>
Package pdftex.def Info: ../graphics/gdf_big_lr.png used on input line 320. Package pdftex.def Info: ../graphics/gdf_big_lr.png used on input line 320.
(pdftex.def) Requested size: 172.5pt x 171.60013pt. (pdftex.def) Requested size: 172.5pt x 171.60013pt.
[15] [16 <../graphics/gdf_big_lr.png>] [15] [16 <../graphics/gdf_big_lr.png>]
<../graphics/conv/conv008.png, id=342, 396.48125pt x 450.68375pt> <../graphics/conv/conv008.png, id=352, 396.48125pt x 450.68375pt>
File: ../graphics/conv/conv008.png Graphic file (type png) File: ../graphics/conv/conv008.png Graphic file (type png)
<use ../graphics/conv/conv008.png> <use ../graphics/conv/conv008.png>
Package pdftex.def Info: ../graphics/conv/conv008.png used on input line 338. Package pdftex.def Info: ../graphics/conv/conv008.png used on input line 338.
(pdftex.def) Requested size: 68.99895pt x 78.43071pt. (pdftex.def) Requested size: 68.99895pt x 78.43071pt.
[17 <../graphics/conv/conv008.png>] [17 <../graphics/conv/conv008.png>]
<../graphics/mnist_5/mnist_5_raw.png, id=352, 462.528pt x 346.896pt> <../graphics/mnist_5/mnist_5_raw.png, id=362, 462.528pt x 346.896pt>
File: ../graphics/mnist_5/mnist_5_raw.png Graphic file (type png) File: ../graphics/mnist_5/mnist_5_raw.png Graphic file (type png)
<use ../graphics/mnist_5/mnist_5_raw.png> <use ../graphics/mnist_5/mnist_5_raw.png>
Package pdftex.def Info: ../graphics/mnist_5/mnist_5_raw.png used on input lin Package pdftex.def Info: ../graphics/mnist_5/mnist_5_raw.png used on input lin
e 401. e 401.
(pdftex.def) Requested size: 172.5pt x 129.37639pt. (pdftex.def) Requested size: 172.5pt x 129.37639pt.
<../graphics/mnist_5/conv_only/mnist_5_upper_edges.png, id=353, 462.528pt x 346 <../graphics/mnist_5/conv_only/mnist_5_upper_edges.png, id=363, 462.528pt x 346
.896pt> .896pt>
File: ../graphics/mnist_5/conv_only/mnist_5_upper_edges.png Graphic file (type File: ../graphics/mnist_5/conv_only/mnist_5_upper_edges.png Graphic file (type
png) png)
@ -1677,7 +1678,7 @@ png)
Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_upper_edges.png Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_upper_edges.png
used on input line 410. used on input line 410.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_only/mnist_5_left_edges.png, id=354, 462.528pt x 346. <../graphics/mnist_5/conv_only/mnist_5_left_edges.png, id=364, 462.528pt x 346.
896pt> 896pt>
File: ../graphics/mnist_5/conv_only/mnist_5_left_edges.png Graphic file (type p File: ../graphics/mnist_5/conv_only/mnist_5_left_edges.png Graphic file (type p
ng) ng)
@ -1685,7 +1686,7 @@ ng)
Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_left_edges.png Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_left_edges.png
used on input line 415. used on input line 415.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_only/mnist_5_lower_edges.png, id=355, 462.528pt x 346 <../graphics/mnist_5/conv_only/mnist_5_lower_edges.png, id=365, 462.528pt x 346
.896pt> .896pt>
File: ../graphics/mnist_5/conv_only/mnist_5_lower_edges.png Graphic file (type File: ../graphics/mnist_5/conv_only/mnist_5_lower_edges.png Graphic file (type
png) png)
@ -1693,7 +1694,7 @@ png)
Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_lower_edges.png Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_lower_edges.png
used on input line 420. used on input line 420.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_only/mnist_5_right_edges.png, id=356, 462.528pt x 346 <../graphics/mnist_5/conv_only/mnist_5_right_edges.png, id=366, 462.528pt x 346
.896pt> .896pt>
File: ../graphics/mnist_5/conv_only/mnist_5_right_edges.png Graphic file (type File: ../graphics/mnist_5/conv_only/mnist_5_right_edges.png Graphic file (type
png) png)
@ -1701,7 +1702,7 @@ png)
Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_right_edges.png Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_right_edges.png
used on input line 425. used on input line 425.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/features.png, id=359, 833.1125pt x 388.45125pt> <../graphics/features.png, id=369, 833.1125pt x 388.45125pt>
File: ../graphics/features.png Graphic file (type png) File: ../graphics/features.png Graphic file (type png)
<use ../graphics/features.png> <use ../graphics/features.png>
Package pdftex.def Info: ../graphics/features.png used on input line 436. Package pdftex.def Info: ../graphics/features.png used on input line 436.
@ -1715,13 +1716,13 @@ Underfull \hbox (badness 10000) in paragraph at lines 347--443
5_upper_edges.png> <../graphics/mnist_5/conv_only/mnist_5_left_edges.png> <../g 5_upper_edges.png> <../graphics/mnist_5/conv_only/mnist_5_left_edges.png> <../g
raphics/mnist_5/conv_only/mnist_5_lower_edges.png> <../graphics/mnist_5/conv_on raphics/mnist_5/conv_only/mnist_5_lower_edges.png> <../graphics/mnist_5/conv_on
ly/mnist_5_right_edges.png>] [19 <../graphics/features.png>] ly/mnist_5_right_edges.png>] [19 <../graphics/features.png>]
<../graphics/MaxpoolSample2.png, id=381, 164.25pt x 68.547pt> <../graphics/MaxpoolSample2.png, id=391, 164.25pt x 68.547pt>
File: ../graphics/MaxpoolSample2.png Graphic file (type png) File: ../graphics/MaxpoolSample2.png Graphic file (type png)
<use ../graphics/MaxpoolSample2.png> <use ../graphics/MaxpoolSample2.png>
Package pdftex.def Info: ../graphics/MaxpoolSample2.png used on input line 454 Package pdftex.def Info: ../graphics/MaxpoolSample2.png used on input line 454
. .
(pdftex.def) Requested size: 241.49895pt x 100.79422pt. (pdftex.def) Requested size: 241.49895pt x 100.79422pt.
<../graphics/Average-Pooling-Example.png, id=382, 746.79pt x 337.26pt> <../graphics/Average-Pooling-Example.png, id=392, 746.79pt x 337.26pt>
File: ../graphics/Average-Pooling-Example.png Graphic file (type png) File: ../graphics/Average-Pooling-Example.png Graphic file (type png)
<use ../graphics/Average-Pooling-Example.png> <use ../graphics/Average-Pooling-Example.png>
Package pdftex.def Info: ../graphics/Average-Pooling-Example.png used on input Package pdftex.def Info: ../graphics/Average-Pooling-Example.png used on input
@ -1751,7 +1752,7 @@ png)
Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_right_edges.png Package pdftex.def Info: ../graphics/mnist_5/conv_only/mnist_5_right_edges.png
used on input line 487. used on input line 487.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/upper_horiz_pooled.png, id=384, 462.528pt x 346. <../graphics/mnist_5/conv_pool/upper_horiz_pooled.png, id=394, 462.528pt x 346.
896pt> 896pt>
File: ../graphics/mnist_5/conv_pool/upper_horiz_pooled.png Graphic file (type p File: ../graphics/mnist_5/conv_pool/upper_horiz_pooled.png Graphic file (type p
ng) ng)
@ -1759,7 +1760,7 @@ ng)
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/upper_horiz_pooled.png Package pdftex.def Info: ../graphics/mnist_5/conv_pool/upper_horiz_pooled.png
used on input line 492. used on input line 492.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/left_vert_pooled.png, id=385, 462.528pt x 346.89 <../graphics/mnist_5/conv_pool/left_vert_pooled.png, id=395, 462.528pt x 346.89
6pt> 6pt>
File: ../graphics/mnist_5/conv_pool/left_vert_pooled.png Graphic file (type png File: ../graphics/mnist_5/conv_pool/left_vert_pooled.png Graphic file (type png
) )
@ -1767,7 +1768,7 @@ File: ../graphics/mnist_5/conv_pool/left_vert_pooled.png Graphic file (type png
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/left_vert_pooled.png us Package pdftex.def Info: ../graphics/mnist_5/conv_pool/left_vert_pooled.png us
ed on input line 497. ed on input line 497.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/lower_horiz_pooled.png, id=386, 462.528pt x 346. <../graphics/mnist_5/conv_pool/lower_horiz_pooled.png, id=396, 462.528pt x 346.
896pt> 896pt>
File: ../graphics/mnist_5/conv_pool/lower_horiz_pooled.png Graphic file (type p File: ../graphics/mnist_5/conv_pool/lower_horiz_pooled.png Graphic file (type p
ng) ng)
@ -1775,7 +1776,7 @@ ng)
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/lower_horiz_pooled.png Package pdftex.def Info: ../graphics/mnist_5/conv_pool/lower_horiz_pooled.png
used on input line 502. used on input line 502.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/right_vert_pooled.png, id=387, 462.528pt x 346.8 <../graphics/mnist_5/conv_pool/right_vert_pooled.png, id=397, 462.528pt x 346.8
96pt> 96pt>
File: ../graphics/mnist_5/conv_pool/right_vert_pooled.png Graphic file (type pn File: ../graphics/mnist_5/conv_pool/right_vert_pooled.png Graphic file (type pn
g) g)
@ -1783,7 +1784,7 @@ g)
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/right_vert_pooled.png u Package pdftex.def Info: ../graphics/mnist_5/conv_pool/right_vert_pooled.png u
sed on input line 507. sed on input line 507.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/upper_horiz_avgpooled.png, id=388, 462.528pt x 3 <../graphics/mnist_5/conv_pool/upper_horiz_avgpooled.png, id=398, 462.528pt x 3
46.896pt> 46.896pt>
File: ../graphics/mnist_5/conv_pool/upper_horiz_avgpooled.png Graphic file (typ File: ../graphics/mnist_5/conv_pool/upper_horiz_avgpooled.png Graphic file (typ
e png) e png)
@ -1791,7 +1792,7 @@ e png)
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/upper_horiz_avgpooled.pn Package pdftex.def Info: ../graphics/mnist_5/conv_pool/upper_horiz_avgpooled.pn
g used on input line 512. g used on input line 512.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/left_vert_avgpooled.png, id=389, 462.528pt x 346 <../graphics/mnist_5/conv_pool/left_vert_avgpooled.png, id=399, 462.528pt x 346
.896pt> .896pt>
File: ../graphics/mnist_5/conv_pool/left_vert_avgpooled.png Graphic file (type File: ../graphics/mnist_5/conv_pool/left_vert_avgpooled.png Graphic file (type
png) png)
@ -1799,7 +1800,7 @@ png)
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/left_vert_avgpooled.png Package pdftex.def Info: ../graphics/mnist_5/conv_pool/left_vert_avgpooled.png
used on input line 517. used on input line 517.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/lower_horiz_avgpooled.png, id=390, 462.528pt x 3 <../graphics/mnist_5/conv_pool/lower_horiz_avgpooled.png, id=400, 462.528pt x 3
46.896pt> 46.896pt>
File: ../graphics/mnist_5/conv_pool/lower_horiz_avgpooled.png Graphic file (typ File: ../graphics/mnist_5/conv_pool/lower_horiz_avgpooled.png Graphic file (typ
e png) e png)
@ -1807,7 +1808,7 @@ e png)
Package pdftex.def Info: ../graphics/mnist_5/conv_pool/lower_horiz_avgpooled.pn Package pdftex.def Info: ../graphics/mnist_5/conv_pool/lower_horiz_avgpooled.pn
g used on input line 522. g used on input line 522.
(pdftex.def) Requested size: 68.99895pt x 51.7463pt. (pdftex.def) Requested size: 68.99895pt x 51.7463pt.
<../graphics/mnist_5/conv_pool/right_vert_avgpooled.png, id=391, 462.528pt x 34 <../graphics/mnist_5/conv_pool/right_vert_avgpooled.png, id=401, 462.528pt x 34
6.896pt> 6.896pt>
File: ../graphics/mnist_5/conv_pool/right_vert_avgpooled.png Graphic file (type File: ../graphics/mnist_5/conv_pool/right_vert_avgpooled.png Graphic file (type
png) png)
@ -1976,33 +1977,92 @@ F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex)
(./_minted-Grundlagen_des_maschinellen_lernens/5A0B7618927FB8AEA4B96F5552228CD8 (./_minted-Grundlagen_des_maschinellen_lernens/5A0B7618927FB8AEA4B96F5552228CD8
F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex) [23] [24] F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex) [23] [24]
\openout5 = `Grundlagen_des_maschinellen_lernens.pyg'.
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `\newline' on input line 616. (./_minted-Grundlagen_des_maschinellen_lernens/B39808E7C45EEBD5237FE1E82D273879
53A0C9FE66949F8EC4BED65B31F6975B.pygtex)
LaTeX Warning: Citation '7' on page 25 undefined on input line 655.
\openout6 = `Grundlagen_des_maschinellen_lernens.pyg'.
(./_minted-Grundlagen_des_maschinellen_lernens/6843D04ED2E2C37F8AF3EB0462FB514B
F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex)
\openout6 = `Grundlagen_des_maschinellen_lernens.pyg'.
(./_minted-Grundlagen_des_maschinellen_lernens/00B37D79FD3312AD6F59A2B37BA81087
F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex)
\openout6 = `Grundlagen_des_maschinellen_lernens.pyg'.
(./_minted-Grundlagen_des_maschinellen_lernens/684559E268B2B047D1C82BB00E985301
F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex) [25]
\openout6 = `Grundlagen_des_maschinellen_lernens.pyg'.
(./_minted-Grundlagen_des_maschinellen_lernens/ECDE410C14A506CF9F77A687B26F5474
F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex)
\openout6 = `Grundlagen_des_maschinellen_lernens.pyg'.
(./_minted-Grundlagen_des_maschinellen_lernens/30299FD7E2187F6D53ED8A608F3958F2
F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex)
\openout6 = `Grundlagen_des_maschinellen_lernens.pyg'.
(./_minted-Grundlagen_des_maschinellen_lernens/458D5F1AFC81AE7291A7AAAD852DC12A
F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex)
\openout6 = `Grundlagen_des_maschinellen_lernens.pyg'.
(./_minted-Grundlagen_des_maschinellen_lernens/B51E2DE1996D35173C012720F7A4FDA4
F6C426F58C5CCC27D3C7BD698FEC22DB.pygtex)
Overfull \hbox (1.4092pt too wide) in paragraph at lines 657--660
[] \T1/LinuxBiolinumT-TLF/m/n/10 das Pro-jekt in-itia-li-siert. Da-nach muss
[]
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding): Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `\newline' on input line 620. (hyperref) removing `\newline' on input line 660.
[25] [26]
Underfull \hbox (badness 10000) in paragraph at lines 637--641 Overfull \hbox (3.56537pt too wide) in paragraph at lines 665--666
\T1/LinuxBiolinumT-TLF/m/n/10 nor-ma-li-siert, was die-sen Da-ten-satz be-son-d
ers ge-eig-net für Ein-stei-ger macht. Die meiÿ-
[]
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `\newline' on input line 668.
Package Fancyhdr Warning: \headheight is too small (12.0pt):
Make it at least 22.45502pt.
We now make it that large for the rest of the document.
This may cause the page layout to be inconsistent, however.
[27] [28]
Underfull \hbox (badness 10000) in paragraph at lines 685--689
\T1/LinuxBiolinumT-TLF/m/n/10 Quelle: https://towardsdatascience.com/common-los \T1/LinuxBiolinumT-TLF/m/n/10 Quelle: https://towardsdatascience.com/common-los
s-functions-in-machine- s-functions-in-machine-
[] []
Underfull \hbox (badness 10000) in paragraph at lines 642--646 Underfull \hbox (badness 10000) in paragraph at lines 690--694
\T1/LinuxBiolinumT-TLF/m/n/10 https://www.bloomberg.com/news/articles/2019-12-1 \T1/LinuxBiolinumT-TLF/m/n/10 https://www.bloomberg.com/news/articles/2019-12-1
1/face-recognition-tech- 1/face-recognition-tech-
[] []
Underfull \hbox (badness 10000) in paragraph at lines 647--651 Underfull \hbox (badness 10000) in paragraph at lines 695--699
\T1/LinuxBiolinumT-TLF/m/n/10 https://www.technologyreview.com/f/614986/ai-face \T1/LinuxBiolinumT-TLF/m/n/10 https://www.technologyreview.com/f/614986/ai-face
-recognition-racist-us- -recognition-racist-us-
[] []
(./Grundlagen_des_maschinellen_lernens.lof [26] (./Grundlagen_des_maschinellen_lernens.lof [29]
Overfull \hbox (21.8196pt too wide) in paragraph at lines 34--34 Overfull \hbox (21.8196pt too wide) in paragraph at lines 34--34
\T1/LinuxBiolinumT-TLF/m/n/10 https://github.com/vdumoulin/conv_arithmetic/blo \T1/LinuxBiolinumT-TLF/m/n/10 https://github.com/vdumoulin/conv_arithmetic/blo
b/master/README.md b/master/README.md
@ -2024,15 +2084,15 @@ p/Max-pooling_/_Pooling
\tf@lof=\write9 \tf@lof=\write9
\openout9 = `Grundlagen_des_maschinellen_lernens.lof'. \openout9 = `Grundlagen_des_maschinellen_lernens.lof'.
[27] [30]
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 657. Package atveryend Info: Empty hook `BeforeClearDocument' on input line 710.
Package atveryend Info: Empty hook `AfterLastShipout' on input line 657. Package atveryend Info: Empty hook `AfterLastShipout' on input line 710.
(./Grundlagen_des_maschinellen_lernens.aux) (./Grundlagen_des_maschinellen_lernens.aux)
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 657. Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 710.
Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 657. Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 710.
Package rerunfilecheck Info: File `Grundlagen_des_maschinellen_lernens.out' has Package rerunfilecheck Info: File `Grundlagen_des_maschinellen_lernens.out' has
not changed. not changed.
(rerunfilecheck) Checksum: 55E78BB917E1CDC45B3A46532A965534;2804. (rerunfilecheck) Checksum: 21CF25714EC87AA39DD08877ED0E5E2E;2942.
LaTeX Warning: There were undefined references. LaTeX Warning: There were undefined references.
@ -2050,13 +2110,13 @@ un.xml'.
) )
Here is how much of TeX's memory you used: Here is how much of TeX's memory you used:
41567 strings out of 492609 41613 strings out of 492609
930705 string characters out of 6131462 933901 string characters out of 6131462
1496572 words of memory out of 5000000 1497267 words of memory out of 5000000
44587 multiletter control sequences out of 15000+600000 44599 multiletter control sequences out of 15000+600000
96852 words of font info for 128 fonts, out of 8000000 for 9000 98228 words of font info for 130 fonts, out of 8000000 for 9000
1143 hyphenation exceptions out of 8191 1143 hyphenation exceptions out of 8191
62i,14n,100p,1509b,3452s stack positions out of 5000i,500n,10000p,200000b,80000s 62i,14n,100p,3352b,3452s stack positions out of 5000i,500n,10000p,200000b,80000s
{/usr/share/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc}{/usr/share/texliv {/usr/share/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc}{/usr/share/texliv
e/texmf-dist/fonts/enc/dvips/libertine/lbtn_25tcsq.enc}</usr/share/texlive/texm e/texmf-dist/fonts/enc/dvips/libertine/lbtn_25tcsq.enc}</usr/share/texlive/texm
f-dist/fonts/type1/public/libertine/LinBiolinumT.pfb></usr/share/texlive/texmf- f-dist/fonts/type1/public/libertine/LinBiolinumT.pfb></usr/share/texlive/texmf-
@ -2071,11 +2131,11 @@ ist/fonts/type1/public/txfonts/txsy.pfb></usr/share/texlive/texmf-dist/fonts/ty
pe1/urw/times/utmb8a.pfb></usr/share/texlive/texmf-dist/fonts/type1/urw/times/u pe1/urw/times/utmb8a.pfb></usr/share/texlive/texmf-dist/fonts/type1/urw/times/u
tmr8a.pfb></usr/share/texlive/texmf-dist/fonts/type1/urw/times/utmr8a.pfb></usr tmr8a.pfb></usr/share/texlive/texmf-dist/fonts/type1/urw/times/utmr8a.pfb></usr
/share/texlive/texmf-dist/fonts/type1/urw/times/utmri8a.pfb> /share/texlive/texmf-dist/fonts/type1/urw/times/utmri8a.pfb>
Output written on Grundlagen_des_maschinellen_lernens.pdf (28 pages, 1450552 by Output written on Grundlagen_des_maschinellen_lernens.pdf (31 pages, 1461523 by
tes). tes).
PDF statistics: PDF statistics:
586 PDF objects out of 1000 (max. 8388607) 617 PDF objects out of 1000 (max. 8388607)
492 compressed objects within 5 object streams 519 compressed objects within 6 object streams
123 named destinations out of 1000 (max. 500000) 131 named destinations out of 1000 (max. 500000)
432 words of extra memory for PDF output out of 10000 (max. 10000000) 448 words of extra memory for PDF output out of 10000 (max. 10000000)

View file

@ -26,13 +26,15 @@
\BOOKMARK [2][-]{subsection.4.1}{Datenvorbereitung}{section.4}% 26 \BOOKMARK [2][-]{subsection.4.1}{Datenvorbereitung}{section.4}% 26
\BOOKMARK [2][-]{subsection.4.2}{Definieren des Netzes}{section.4}% 27 \BOOKMARK [2][-]{subsection.4.2}{Definieren des Netzes}{section.4}% 27
\BOOKMARK [2][-]{subsection.4.3}{Trainieren des Netzes}{section.4}% 28 \BOOKMARK [2][-]{subsection.4.3}{Trainieren des Netzes}{section.4}% 28
\BOOKMARK [1][-]{section.5}{Fallbeispiel I:Ein Klassifizierungsnetzwerk f\374r handgeschriebene Ziffern}{}% 29 \BOOKMARK [2][-]{subsection.4.4}{Pytorch und weights and biases}{section.4}% 29
\BOOKMARK [2][-]{subsection.5.1}{Aufgabe}{section.5}% 30 \BOOKMARK [1][-]{section.5}{Fallbeispiel I:Ein Klassifizierungsnetzwerk f\374r handgeschriebene Ziffern}{}% 30
\BOOKMARK [2][-]{subsection.5.2}{Der MNIST Datensatz}{section.5}% 31 \BOOKMARK [2][-]{subsection.5.1}{Aufgabe}{section.5}% 31
\BOOKMARK [2][-]{subsection.5.3}{Ergebnis}{section.5}% 32 \BOOKMARK [2][-]{subsection.5.2}{Der MNIST Datensatz}{section.5}% 32
\BOOKMARK [1][-]{section.6}{Fallbeispiel II:Eine selbsttrainierende KI f\374r Tic-Tac-Toe}{}% 33 \BOOKMARK [2][-]{subsection.5.3}{Das Netz}{section.5}% 33
\BOOKMARK [2][-]{subsection.6.1}{Das Prinzip}{section.6}% 34 \BOOKMARK [2][-]{subsection.5.4}{Ergebnis}{section.5}% 34
\BOOKMARK [2][-]{subsection.6.2}{Chance-Tree Optimierung}{section.6}% 35 \BOOKMARK [1][-]{section.6}{Fallbeispiel II:Eine selbsttrainierende KI f\374r Tic-Tac-Toe}{}% 35
\BOOKMARK [2][-]{subsection.6.3}{L\366sung mittels eines neuronalen Netzes}{section.6}% 36 \BOOKMARK [2][-]{subsection.6.1}{Das Prinzip}{section.6}% 36
\BOOKMARK [2][-]{subsection.6.4}{Vergleich}{section.6}% 37 \BOOKMARK [2][-]{subsection.6.2}{Chance-Tree Optimierung}{section.6}% 37
\BOOKMARK [1][-]{section.7}{Schlusswort}{}% 38 \BOOKMARK [2][-]{subsection.6.3}{L\366sung mittels eines neuronalen Netzes}{section.6}% 38
\BOOKMARK [2][-]{subsection.6.4}{Vergleich}{section.6}% 39
\BOOKMARK [1][-]{section.7}{Schlusswort}{}% 40

View file

@ -610,12 +610,60 @@ Das Definieren des Netzes ist in Pytorch bereits sehr einfach möglich, bietet j
\label{Net_simple_definition} \label{Net_simple_definition}
\end{figure}\\ \end{figure}\\
Dieses Netz hat nur drei Layers: Ein Eingabelayer (\mintinline{python}{fc0}), das genau die Größe der Eingabedaten ($28\times28$) aufweist, ein hidden Layer (\mintinline{python}{fc1}), das 64 Skalere annimmt und 120 Skalare ausgibt und ein Ausgabelayer (\mintinline{python}{fc2}), das 120 Skalare annimmt und 10 ausgibt. Dass \mintinline{python}{fc2} 10 Ausgabeneuronen besitzt ist kein Zufall, sondern liegt darin begründet, dass dieses Klassifizierungsnetz genau 10 Klassen unterscheiden soll. Die Größe von \mintinline{python}{fc1} ist jedoch völlig frei gewählt. Es ist allerdings wichtig Acht zu geben, dass die Layers die Daten auch an einander weitergeben können. Ein Layer muss also stets so viele Ausgaben aufweisen, wie das Layer, an das die Daten weitergegeben werden sollen, Eingaben besitzt.\\ Dieses Netz hat nur drei Layers: Ein Eingabelayer (\mintinline{python}{fc0}), das genau die Größe der Eingabedaten ($28\times28$) aufweist, ein hidden Layer (\mintinline{python}{fc1}), das 64 Skalere annimmt und 120 Skalare ausgibt und ein Ausgabelayer (\mintinline{python}{fc2}), das 120 Skalare annimmt und 10 ausgibt. Dass \mintinline{python}{fc2} 10 Ausgabeneuronen besitzt ist kein Zufall, sondern liegt darin begründet, dass dieses Klassifizierungsnetz genau 10 Klassen unterscheiden soll. Die Größe von \mintinline{python}{fc1} ist jedoch völlig frei gewählt. Es ist allerdings wichtig Acht zu geben, dass die Layers die Daten auch an einander weitergeben können. Ein Layer muss also stets so viele Ausgaben aufweisen, wie das Layer, an das die Daten weitergegeben werden sollen, Eingaben besitzt.\\
Die \mintinline{python}{forward(self, x)} Funktion definiert, wie die Daten innerhalb des Netzes weitergegeben werden sollen. Hier werden sie erst in \mintinline{python}{fc0} gegeben, dann wird auf die Ausgabe aus \mintinline{python}{fc0} die Aktivierungsfunktion \glqq ReLu'' (REctified Linear Unit) angewandt. Die Ausgabe daraus wird dann in das hidden Layer \mintinline{python}{fc1} gegebnen und die Aktivierungsfunktion wird erneut angewandt. Im Output Layer geschieht dies nicht. Abschließend wird die Ausgabe von \mintinline{python}{F.log_softmax} zurück gegeben. Dies wendet erst einen SoftMax und dann einen Logarythmus auf die Daten an \cite{6} um diese zu normalisieren und ist in Klassifizierungsnetzwerken oft nötig. Da die Netze als Klassen definiert werden und der Interne Datenverkehr in der \mintinline{python}{forward(self, x)} Funktion abläuft, sind neuronale Netze in Pytorch also sehr anpassbar. So wäre es beispielsweise kein Problem zwischen Input und hidden Layer die Daten mit 2 zu multiplizieren (dafür würde man zwischen Zeile 9 und 10 den Code \glqq\mintinline{python}{x = x * 2}'' einfügen), auch wenn dies in den meißten Anwendungsbereichen keinen Sinn hätte. Pytorch kombiniert mit dieser Art Netze zu definieren also eine umfangreiche Flexibilität mit einfacher Bedienbartkeit. Die \mintinline{python}{forward(self, x)} Funktion definiert, wie die Daten innerhalb des Netzes weitergegeben werden sollen. Hier werden sie erst in \mintinline{python}{fc0} gegeben, dann wird auf die Ausgabe aus \mintinline{python}{fc0} die Aktivierungsfunktion \glqq ReLu'' (REctified Linear Unit) angewandt. Die Ausgabe daraus wird dann in das hidden Layer \mintinline{python}{fc1} gegebnen und die Aktivierungsfunktion wird erneut angewandt. Im Output Layer geschieht dies nicht. Abschließend wird die Ausgabe von \mintinline{python}{F.log_softmax} zurück gegeben. Dies wendet erst einen SoftMax und dann einen Logarythmus auf die Daten an \cite{6} um diese zu normalisieren und ist in Klassifizierungsnetzwerken oft nötig um sogenannte \glqq One hot Vectors'' zu erstellen. Herkömmliche Ausgabevektoren haben einen Wert für jede Klasse und geben an wie wahrscheinlich das Netz die Eingabedaten dieser Klasse zuordnet. In One hot Vektoren ist immer der höhste Wert 1 und alle anderen Werte sind 0.\\
Da die Netze als Klassen definiert werden und der Interne Datenverkehr in der\\ \mintinline{python}{forward(self, x)} Funktion abläuft, sind neuronale Netze in Pytorch also sehr anpassbar. So wäre es beispielsweise kein Problem zwischen Input und hidden Layer die Daten mit 2 zu multiplizieren (dafür würde man zwischen Zeile 9 und 10 den Code \glqq\mintinline{python}{x = x * 2}'' einfügen), auch wenn dies in den meißten Anwendungsbereichen keinen Sinn hätte. Pytorch kombiniert mit dieser Art Netze zu definieren also eine umfangreiche Flexibilität mit einfacher Bedienbartkeit.
\subsection{Trainieren des Netzes} \subsection{Trainieren des Netzes}
Das Trainieren des Netzes erfolgt in der sogenannten \glqq Training Loop''. Also in einer Schleife, die über den Datensatz iteriert. Zumeißt steht diese noch in einer Schleife, die über die Epochenzahl iteriert. Das Trainieren des Netzes erfolgt in der sogenannten \glqq Training Loop''. Also in einer Schleife, die über den Datensatz iteriert. Zumeißt steht diese noch in einer Schleife, die über die Epochenzahl iteriert. In der Training loop wird ein Element des Datensatzes gelesen, in das Netz gegeben, die Ausgabe wird mit dem Label verglichen und schließlich werden die Parameter des Netzes Angepasst. Der Code dafür ist in Abbildung \ref{Code_train_loop} dargestellt.
\begin{figure}[h]
\begin{minted}[
frame=lines,
framesep=2mm,
baselinestretch=1.2,
fontsize=\footnotesize,
linenos,
autogobble
]{python}
net = Net()
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
print('runnning on %s' % device)
net = net.to(device)
loss_function = nn.CrossEntropyLoss()
optimizer = optim.Adam(net.parameters(), lr=LEARNING_RATE)
for epoch in range(EPOCHS):
for data in trainset:
X, y = data
net.zero_grad()
X = X.to(device)
output = net(X.view(-1, n * n))
output = output.cpu()
loss = loss_function(output, y)
loss.backward()
optimizer.step()
net = net.cpu()
torch.save(net, './nets/net_' + str(epoch) + ".pt")
net = net.to(device)
\end{minted}
\caption{Code um das Netz auf einem Datensatz zu trainieren}
\label{Code_train_loop}
\end{figure}\\
In Zeile 1 wird dafür zunächst das Netz instanziiert. In Zeile 3 und 4 Wird bestimmt ob eine Grafikkarte zum trainieren verfügbar ist und diese wird gegebenenfalls genutzt. Auch wird ausgegeben, auf welchem Gerät das Netz trainiert wird. Der Code in Zeile 6 verschiebt das Netz auf die Grafikkarte, um dort mit diesem rechnen zu können. In Zeile 8 wird die Fehlerfunktion definiert, hier der Kreuzentropiefehler. In der nächsten Zeile wird der sogenannte \glqq Optimizer'' instanziiert. Dieser berechnet später die Gradienten und passt die Parameter des Netzes an. Der Optimizer, der hier gewählt wurde nennt sich \glqq Adam''. Es handelt sich um einen gradienten basierten Optimierungsalgorythmus, der von Diederik P. Kingma und Jimmy Ba entwickelt wurde \cite{7}. Eine Liste aller Implementierten Optimierungsalgorythmen ist in der PyTorch Dokumentation unter https://pytorch.org/docs/stable/optim.html gegeben. In Zeile 11 folgt nun die Schleife, die Über die Anzahl der Epochen iteriert, in der nächste Zeile die Train loop. Sie iteriert pro Epoche ein mal über den Datensatz. In Zeile 13 werden die Daten entpackt, da diese als Tupel vorliegen. X stellt dabei eine batch von Eingabevektoren dar, y eine Batch von Features. Zeile 14 setzt die Gradienten auf 0 zurück. Dies ist notwendig, da diese sonsnt aufsummiert würden. Die Parameter würden also nicht nur den Gradienten aus diesem Schleifendurchgang entsprechend angepasst werden, sonndern entsprechend zu einer Suppe aus allen Gradienten. Das würde das Ergebnis verfälschen. Der Befehl in Zeile 15 verschiebt auch den Eingabevektor auf die Grafikkarte, da alle Daten, mit denen das Netz rechnen soll erst auf dieser sein müssen. In Zeile 16 wird dann die Ausgabe des Netzes aus den Daten berechnet. Hier wird eine weitere Einfachheit von PyTorch deutlich: Um eine Ausgabe eines Netzes zu berechnen reicht der Befehl \mintinline{python}{output = net(input)} völlig aus. \mintinline{python}{X.view(-1, n * n)} wandelt den 2-dimensionalen\footnote{Streng genommen ist der Tensor der Bilder aus dem Datensatz nicht 2, sondern 4-dimensional. Er weist die Dimensionen $Batch\_size\times Kanalanzahl\times n \times n$ auf. Die Kanalanzahl entspricht bei Bildern den Farbkanälen, liegt bei schwarz-weiß Bildern also bei 1 und sonst bei 3 bis 4 für RGBA} Tensor des Eingabebildes in einen Eingabevektor um. Auch hier muss das batching wieder beachtet werden, daher die -1. $n\times n$ stellt nämlich die Größe der Eingabebilder dar und -1 passt den ersten Wert automatisch an den zweiten an, entspricht hier also immer der Batch size. Nachdem der Ausgabevektor berechnet wurde wird er zunächst auf die CPU verschoben, da dort der Fehler berechnet wird und anschließend mit Hilfe der Fehlerfunktion mit dem Label verglichen. Dies geschieht in Zeile 17 und 18. \mintinline{python}{loss.backward()} in Zeile 19 sorgt dann dafür, dass der Optimizer alle Alle Anpassungen berechnet um sie in Zeile 20 anzuwenden. Der weitere Code dient dazu jede Epoche das Netz in einer Datei abzuspeichern. Dafür muss es erst auf die CPU verschoben werden und danach wieder zurück auf die Grafikkarte.
\subsection{Pytorch und weights and biases}
In den im folgenden erläuterten Projekten wurde ein Framework namens weights and biases verwendet. Es erlaubt während des Trainingsprozesses auf einer Seite Parameter des Netzes und wichtige Characteristika des Lernprozesses sowie Eigenschaften der Hardware zu tracken. Da es mit Pytorch gut kompatibel ist sind hierfür nur wenige Zeilen Code notwendig. Zunächst wird mit\\ \mintinline{python}{wandb.init(project='Beispielprojekt')
} das Projekt initialisiert. Danach muss angegeben werden, welches Netz betrachtet werden soll. Dafür verwendet man nachdem das Netz initialisiert wurde den Befehl \mintinline{python}{wandb.watch(model)}, wobei \mintinline{python}{model} der Instanz des Netzes entspricht. Danach kann einfach über\\
\mintinline{python}{wandb.log({'loss': loss})} Zum Beispiel in der Training loop jedes Mahl der Fehler mitgeschrieben werden.
\section{Fallbeispiel I:\newline Ein Klassifizierungsnetzwerk für handgeschriebene Ziffern} \section{Fallbeispiel I:\newline Ein Klassifizierungsnetzwerk für handgeschriebene Ziffern}
Die Klassifizierung handgeschriebener Ziffern aus dem MNIST Datensatz stellt etwa die \glqq Hello world'' Aufgabe des maschinellen Lernens dar. Sie ist gut zum Erlernen der verschiedenen Algorythmen geeignet, extrem gut Dokumentiert und daher leicht nachvollziehbar und ein Paradebeispiel eines Klassifizierungsproblemes. Wenn man sich mit maschinellem Lernen beschäftigt ist es also sehr wahrscheinlich, dass man als aller erstes ein Klassifizierungssystem für den MNIST Datensatz programmieren wird.
\subsection{Aufgabe} \subsection{Aufgabe}
Die Aufgabe besteht darin den die handgeschriebenen Ziffern des MNIST Datensatzes klassifizieren zu können. Das Ziel dabei ist es mit möglichst wenig Trainingsaufwand eine Genauigkeit von mindestens 97\% zu erreichen. Um dies zu bewältigen soll ein neuronales Netz in PyTorch programmiert und trainiert werden.
\subsection{Der MNIST Datensatz} \subsection{Der MNIST Datensatz}
Der MNIST Datensatz ist ein Datensatz von $28\times28$ Pixel großen Graustufenbildern von handgeschriebenen Ziffern. Er weist 60000 Trainingsbilder und 10000 Testbilder auf und ist ein Teil des EMNIST Datensatzes vom National Institute for Standards and Technology, U.S. Department of Commerce. Der Datensatz ist frei unter http://yann.lecun.com/exdb/mnist/ verfügbar. Die Bilder sind bereits zentriert und normalisiert, was diesen Datensatz besonders geeignet für Einsteiger macht. Die meißten Bilder des Datensatzes sind auch von Menschen einfach zu erkennen, einige sind jedoch sehr schwierig einzuordnen und teilweise kaum als Zahl erkennbar. Aufgrund der Einfachheit der Daten sind durchaus hohe Erfolgsquoten zu erwarten. Diese liegen im Schnitt bei 98\%.
\subsection{Das Netz}
\subsection{Ergebnis} \subsection{Ergebnis}
\section{Fallbeispiel II:\newline Eine selbsttrainierende KI für Tic-Tac-Toe} \section{Fallbeispiel II:\newline Eine selbsttrainierende KI für Tic-Tac-Toe}
\subsection{Das Prinzip} \subsection{Das Prinzip}
@ -652,6 +700,11 @@ Das Trainieren des Netzes erfolgt in der sogenannten \glqq Training Loop''. Also
Offizielle Dokumentation des PyTorch Frameworks\\ Offizielle Dokumentation des PyTorch Frameworks\\
https://pytorch.org/docs/stable/nn.functional.html\\ https://pytorch.org/docs/stable/nn.functional.html\\
Abgerufen am 30.01.2020 Abgerufen am 30.01.2020
\bibitem{7}
Adam: A Method for Stochastic Optimization\\
Diederik P. Kingma und Jimmy Ba\\
arXiv:1412.6980 [cs.LG] (https://arxiv.org/abs/1412.6980)\\
Abgerufen am 31.01.2020
\end{thebibliography} \end{thebibliography}
\listoffigures \listoffigures
\end{document} \end{document}

View file

@ -57,22 +57,26 @@
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {4.3}Trainieren des Netzes}{25}{subsection.4.3}% \contentsline {subsection}{\numberline {4.3}Trainieren des Netzes}{25}{subsection.4.3}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {section}{\numberline {5}Fallbeispiel I:\newline Ein Klassifizierungsnetzwerk f\IeC {\"u}r handgeschriebene Ziffern}{25}{section.5}% \contentsline {subsection}{\numberline {4.4}Pytorch und weights and biases}{26}{subsection.4.4}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {5.1}Aufgabe}{25}{subsection.5.1}% \contentsline {section}{\numberline {5}Fallbeispiel I:\newline Ein Klassifizierungsnetzwerk f\IeC {\"u}r handgeschriebene Ziffern}{27}{section.5}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {5.2}Der MNIST Datensatz}{25}{subsection.5.2}% \contentsline {subsection}{\numberline {5.1}Aufgabe}{27}{subsection.5.1}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {5.3}Ergebnis}{25}{subsection.5.3}% \contentsline {subsection}{\numberline {5.2}Der MNIST Datensatz}{27}{subsection.5.2}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {section}{\numberline {6}Fallbeispiel II:\newline Eine selbsttrainierende KI f\IeC {\"u}r Tic-Tac-Toe}{25}{section.6}% \contentsline {subsection}{\numberline {5.3}Das Netz}{28}{subsection.5.3}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {6.1}Das Prinzip}{25}{subsection.6.1}% \contentsline {subsection}{\numberline {5.4}Ergebnis}{28}{subsection.5.4}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {6.2}Chance-Tree Optimierung}{25}{subsection.6.2}% \contentsline {section}{\numberline {6}Fallbeispiel II:\newline Eine selbsttrainierende KI f\IeC {\"u}r Tic-Tac-Toe}{28}{section.6}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {6.3}L\IeC {\"o}sung mittels eines neuronalen Netzes}{25}{subsection.6.3}% \contentsline {subsection}{\numberline {6.1}Das Prinzip}{28}{subsection.6.1}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {6.4}Vergleich}{25}{subsection.6.4}% \contentsline {subsection}{\numberline {6.2}Chance-Tree Optimierung}{28}{subsection.6.2}%
\defcounter {refsection}{0}\relax \defcounter {refsection}{0}\relax
\contentsline {section}{\numberline {7}Schlusswort}{25}{section.7}% \contentsline {subsection}{\numberline {6.3}L\IeC {\"o}sung mittels eines neuronalen Netzes}{28}{subsection.6.3}%
\defcounter {refsection}{0}\relax
\contentsline {subsection}{\numberline {6.4}Vergleich}{28}{subsection.6.4}%
\defcounter {refsection}{0}\relax
\contentsline {section}{\numberline {7}Schlusswort}{28}{section.7}%

View file

@ -0,0 +1,3 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{X}\PYG{o}{.}\PYG{n}{view}\PYG{p}{(}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{n}{n} \PYG{o}{*} \PYG{n}{n}\PYG{p}{)}
\end{Verbatim}

View file

@ -0,0 +1,3 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{wandb}\PYG{o}{.}\PYG{n}{watch}\PYG{p}{(}\PYG{n}{model}\PYG{p}{)}
\end{Verbatim}

View file

@ -0,0 +1,3 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{model}
\end{Verbatim}

View file

@ -0,0 +1,3 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{output} \PYG{o}{=} \PYG{n}{net}\PYG{p}{(}\PYG{n+nb}{input}\PYG{p}{)}
\end{Verbatim}

View file

@ -0,0 +1,3 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{loss}\PYG{o}{.}\PYG{n}{backward}\PYG{p}{()}
\end{Verbatim}

View file

@ -0,0 +1,26 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{net} \PYG{o}{=} \PYG{n}{Net}\PYG{p}{()}
\PYG{n}{device} \PYG{o}{=} \PYG{n}{torch}\PYG{o}{.}\PYG{n}{device}\PYG{p}{(}\PYG{l+s+s2}{\PYGZdq{}cuda:0\PYGZdq{}} \PYG{k}{if} \PYG{n}{torch}\PYG{o}{.}\PYG{n}{cuda}\PYG{o}{.}\PYG{n}{is\PYGZus{}available}\PYG{p}{()} \PYG{k}{else} \PYG{l+s+s2}{\PYGZdq{}cpu\PYGZdq{}}\PYG{p}{)}
\PYG{n+nb}{print}\PYG{p}{(}\PYG{l+s+s1}{\PYGZsq{}runnning on }\PYG{l+s+si}{\PYGZpc{}s}\PYG{l+s+s1}{\PYGZsq{}} \PYG{o}{\PYGZpc{}} \PYG{n}{device}\PYG{p}{)}
\PYG{n}{net} \PYG{o}{=} \PYG{n}{net}\PYG{o}{.}\PYG{n}{to}\PYG{p}{(}\PYG{n}{device}\PYG{p}{)}
\PYG{n}{loss\PYGZus{}function} \PYG{o}{=} \PYG{n}{nn}\PYG{o}{.}\PYG{n}{CrossEntropyLoss}\PYG{p}{()}
\PYG{n}{optimizer} \PYG{o}{=} \PYG{n}{optim}\PYG{o}{.}\PYG{n}{Adam}\PYG{p}{(}\PYG{n}{net}\PYG{o}{.}\PYG{n}{parameters}\PYG{p}{(),} \PYG{n}{lr}\PYG{o}{=}\PYG{n}{LEARNING\PYGZus{}RATE}\PYG{p}{)}
\PYG{k}{for} \PYG{n}{epoch} \PYG{o+ow}{in} \PYG{n+nb}{range}\PYG{p}{(}\PYG{n}{EPOCHS}\PYG{p}{):}
\PYG{k}{for} \PYG{n}{data} \PYG{o+ow}{in} \PYG{n}{trainset}\PYG{p}{:}
\PYG{n}{X}\PYG{p}{,} \PYG{n}{y} \PYG{o}{=} \PYG{n}{data}
\PYG{n}{net}\PYG{o}{.}\PYG{n}{zero\PYGZus{}grad}\PYG{p}{()}
\PYG{n}{X} \PYG{o}{=} \PYG{n}{X}\PYG{o}{.}\PYG{n}{to}\PYG{p}{(}\PYG{n}{device}\PYG{p}{)}
\PYG{n}{output} \PYG{o}{=} \PYG{n}{net}\PYG{p}{(}\PYG{n}{X}\PYG{o}{.}\PYG{n}{view}\PYG{p}{(}\PYG{o}{\PYGZhy{}}\PYG{l+m+mi}{1}\PYG{p}{,} \PYG{n}{n} \PYG{o}{*} \PYG{n}{n}\PYG{p}{))}
\PYG{n}{output} \PYG{o}{=} \PYG{n}{output}\PYG{o}{.}\PYG{n}{cpu}\PYG{p}{()}
\PYG{n}{loss} \PYG{o}{=} \PYG{n}{loss\PYGZus{}function}\PYG{p}{(}\PYG{n}{output}\PYG{p}{,} \PYG{n}{y}\PYG{p}{)}
\PYG{n}{loss}\PYG{o}{.}\PYG{n}{backward}\PYG{p}{()}
\PYG{n}{optimizer}\PYG{o}{.}\PYG{n}{step}\PYG{p}{()}
\PYG{n}{net} \PYG{o}{=} \PYG{n}{net}\PYG{o}{.}\PYG{n}{cpu}\PYG{p}{()}
\PYG{n}{torch}\PYG{o}{.}\PYG{n}{save}\PYG{p}{(}\PYG{n}{net}\PYG{p}{,} \PYG{l+s+s1}{\PYGZsq{}./nets/net\PYGZus{}\PYGZsq{}} \PYG{o}{+} \PYG{n+nb}{str}\PYG{p}{(}\PYG{n}{epoch}\PYG{p}{)} \PYG{o}{+} \PYG{l+s+s2}{\PYGZdq{}.pt\PYGZdq{}}\PYG{p}{)}
\PYG{n}{net} \PYG{o}{=} \PYG{n}{net}\PYG{o}{.}\PYG{n}{to}\PYG{p}{(}\PYG{n}{device}\PYG{p}{)}
\end{Verbatim}

View file

@ -0,0 +1,3 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{wandb}\PYG{o}{.}\PYG{n}{log}\PYG{p}{(\PYGZob{}}\PYG{l+s+s1}{\PYGZsq{}loss\PYGZsq{}}\PYG{p}{:} \PYG{n}{loss}\PYG{p}{\PYGZcb{})}
\end{Verbatim}

View file

@ -0,0 +1,3 @@
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{n}{wandb}\PYG{o}{.}\PYG{n}{init}\PYG{p}{(}\PYG{n}{project}\PYG{o}{=}\PYG{l+s+s1}{\PYGZsq{}Beispielprojekt\PYGZsq{}}\PYG{p}{)}
\end{Verbatim}