De derde programmeeropgave (in het voorjaar van 2012) behorende bij het vak
Kunstmatige intelligentie gaat over
Neurale netwerken.
This assignment is in English. The same holds for your report!
In the third AI programming assignment you will develop a simple Neural Network (NN) to solve a real-world classification task. The task is based on the Iris dataset, one of the most widely cited by the Pattern Recognition community. The data consists of 150 examples, equally partitioned among 3 different classes of Iris: Setosa, Versicolor, and Virginica. Each Iris example has 4 numerical attributes: sepal length, sepal width, petal length, petal width. The task is to predict the class of a given new example of Iris.
In this assignment, we will use a reduced version of the Iris dataset consisting only
of the first 100 examples of the classes Iris Setosa and Iris Versicolor.
Your task is to implement a Neural Network consisting of four input nodes (as the
number of attributes), one hidden layer with a variable number of nodes between 1 and 40,
and one output node to discriminate between the two classes of Iris. Also consider a bias
node for both the input and the hidden layer. After deriving a training and test set from
the dataset (perhaps using Perl), use backpropagation as learning method and report the results obtained
by varying the number of hidden nodes and the learning rate.
Take care that the testset is presented many times, in random order!
In particular, answer the following questions:
Regarding the implementation: use several simple arrays. For example, use double weightsinputtohidden[INPUTS+1][MAXHIDDENS+1] for the weights on the connections between the 4+1 input nodes and the hidden nodes. Remember the bias nodes (give them index 0); e.g., do not use the weight going to hidden node 0.
Tip: first make the network do the 2-input XOR problem.
See for some hints this handout.
In the report, mention how you could deal with the full 3-classes problem.
Enthousiastic students might also program this.
Back to Dutch for some old tips:
Gebruik gnuplot
om voor het verslag
enkele grafieken te plotten, bijvoorbeeld met verschillende
aantallen verborgen knopen, leersnelheden en
stopcriteria.
Maak een file plot.p met daarin bijvoorbeeld
set xrange [0:1]
set yrange [0:1]
set pm3d
splot sin(2*pi*x)*cos(2*pi*y)
En laad deze file in gnuplot met gnuplot> load "plot.p".
Als je een netwerk hebt om deze functie te benaderen,
kun je het beste aan het eind van je
programma alle benodigde trio's (x,y,netwerkuitvoer) afdrukken in een file
(zeg net.uit;
één trio per regel),
waarbij x met kleine stapjes door het interval [0,1] loopt,
en y idem,
terwijl netwerkuitvoer de bijbehorende
uitvoer van het getrainde netwerk is.
In
gnuplot kun je eenvoudig een grafiekje
van netuitvoer en beoogde functie maken met behulp van:
gnuplot> splot "net.uit", sin(2*pi*x)*cos(2*pi*y)
Hierbij kun je zonodig PostScript-uitvoer genereren
met behulp van
gnuplot> set terminal postscript eps enhanced color
gnuplot> set output "file.ps"
vlak voor het (s)plot-commando te geven
(of enhanced monochrome voor grijswaarden-plaatjes).
En dat allemaal in een plot-file, dan hoef je het niet steeds
over te tikken.
Op internet staat alles en meer over gnuplot, bijvoorbeeld
hier of
daar.
Kijk verder in de
LaTeX-handleiding
(Hoofdstuk 4.1) hoe je PostScript-files in LaTeX kunt importeren.
Leg in het verslag ook kort BackPropagation uit, met de formules,
en een referentie naar Russell en Norvig.
In te leveren: geprint verslag (in LaTeX gemaakt; de C++-code als Appendix,
zie verder
hier
voor opmerkingen over het verslag),
en per email: C++- en Perl-code.
Stuur svp geen emails met LaTeX/PostScript/PDF.
Deadline: dinsdag 17 april 2012; Den Haag: woensdag 2 mei 2012.
Vragen en/of opmerkingen kunnen worden gestuurd naar: kosters@liacs.nl.
26 maart 2012 — http://www.liacs.nl/home/kosters/AI/nn12.html