⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hw97.tex

📁 Mitchell的《机器学习〉随书源码
💻 TEX
📖 第 1 页 / 共 3 页
字号:
weights of hidden unit {\it n}, type:{\tt hidtopgm pose.net} {\it image-filename} {\tt 32 30} {\it n}Invoking {\tt xv} on the image {\it image-filename} should then display the range of weights,with the lowest weights mapped to pixel values of zero, and the highestmapped to 255.  If the images just look like noise, try retraining using{\tt facetrain\_init0} (compile with {\tt make facetrain\_init0}), whichinitializes the hidden unit weights of a new network to zero, ratherthan random values.\item Do the hidden units seem to weight particular regions of the imagegreater than others?  Do particular hidden units seem to be tunedto different features of some sort?\end{enumerate}\subsection{Part II. (optional!)}Now that you know your way around {\tt facetrain}, it's time to have some fun.Form a team with one or two other students, and pick some interesting topic ofyour own choice -- be creative!!  Run some experiments, and prepare a shortwrite-up of what your group's idea, experimental results, and any conclusionsyou draw (a few pages should be sufficient).  For this part of the assignment,your group can turn in a single group writeup.%We'll reserve a class period just after this assignment is due, for brief%presentations from each of the groups.  So also prepare a one-slide, three%minute presentation to summarize your group's work, and pick a group member to%present it to the class.Some possibilities for experimentation are (but please don't let this listlimit you in any way if you want to try something else):\begin{itemize}\item Use the output of the pose recognizer as input to the facerecognizer, and see how this affects performance.  To do this, you will needto add a mechanism for saving the output units of the pose recognizer and amechanism for loading this data into the face recognizer.\item Learn the {\it location} of some feature in the image, suchas eyes.  You can use {\tt xv} to tell you the coordinates of the feature inquestion for each image, which you can then use as your target values.\item Take a look at the additional data from an earlier year's class in{\tt /afs/cs.cmu.edu/project/theo-8/ml94faces}.  What techniques can youemploy to train nets to generalize better from one dataset to the other?\item How do nets perform if trained on more than one concept at once?Do representations formed for multiple concepts interfere with each other inthe hidden layer, or perhaps augment each other?\item Use the image package, weight visualization utility, and/oranything else you might have available to try to understand better what thenetwork has actually learned.  Using this information, what do you think thenetwork is learning?  Can you exploit this information to improvegeneralization?\item Change the input or output encodings to try to improvegeneralization accuracy.\item Vary the number of hidden units, the number of training examples,the number of epochs, the momentum and learning rate, or whatever else youwant to try, with the goal of getting the greatest possible discrepancybetween train and test set accuracy (i.e., how badly can you make the networkoverfit), and the smallest possible discrepancy (i.e., what is the bestperformance you can achieve).\end{itemize}\section{Documentation}\label{docs}The code for this assignment is broken into several modules:\begin{itemize}\item {\tt pgmimage.c}, {\tt pgmimage.h}: the image package.  Supportsread/write of PGM image files and pixel access/assignment.  Providesan {\tt IMAGE} data structure, and an {\tt IMAGELIST} data structure(an array of pointers to images; useful when handling many images). {\bf You will not need to modify any code in this module to completethe assignment.}\item {\tt backprop.c}, {\tt backprop.h}: the neural network package.Supports three-layer fully-connected feedforward networks, using thebackpropagation algorithm for weight tuning.  Provides high levelroutines for creating, training, and using networks.  {\bf You will notneed to modify any code in this module to complete the assignment.}\item {\tt imagenet.c}: interface routines for loading images intothe input units of a network, and setting up target vectors for training.You will need to modify the routine {\tt load\_target}, whenimplementing the face recognizer and the pose recognizer, to setup appropriate target vectors for the output encodings you choose.\item {\tt facetrain.c}: the top-level program which uses all of themodules above to implement a ``TA'' recognizer.  You will need tomodify this code to change network sizes and learning parameters,both of which are trivial changes.  The performance evaluation routines{\tt performance\_on\_imagelist()} and {\tt evaluate\_performance()} arealso in this module; you will need to modify these for your faceand pose recognizers.\item {\tt hidtopgm.c}: the hidden unit weight visualization utility.It's not necessary modify anything here, although it may be interestingto explore some of the numerous possible alternate visualization schemes.\end{itemize}Although you'll only need to modify code in {\tt imagenet.c} and{\tt facetrain.c}, feel free to modify anything you want in any ofthe files if it makes your life easier or if it allows you to doa nifty experiment.\subsection {\tt facetrain}\subsubsection{Running {\tt facetrain}}\label{RUNFACE}{\tt facetrain} has several options which can be specified on thecommand line.  This section briefly describes how each optionworks.  A very short summary of this information can be obtainedby running {\tt facetrain} with no arguments.\begin{description}\item {\tt -n <network file>} - this option either loads an existingnetwork file, or creates a new one with the given name.  At the endof training, the neural network will be saved to this file.\item {\tt -e <number of epochs>} - this option specifies the numberof training epochs which will be run.  If this option is notspecified, the default is 100.\item {\tt -T} - for test-only mode (no training).  Performancewill be reported on each of the three datasets specified, andthose images misclassified will be listed, along with the correspondingoutput unit levels.\item {\tt -s <seed>} - an integer which will be used as theseed for the random number generator.  The default seed is 102194(guess what day it was when I wrote this document).  This allows you toreproduce experiments if necessary, by generating the same sequence ofrandom numbers.  It also allows you to try a different set of randomnumbers by changing the seed.\item {\tt -S <number of epochs between saves>} - this option specifiesthe number of epochs between saves.  The default is 100, which meansthat if you train for 100 epochs (also the default), the network isonly saved when training is completed.\item {\tt -t <training image list>} - this option specifies a textfile which contains a list of image pathnames, one per line, thatwill be used for training.  If this option is not specified, itis assumed that no training will take place ($epochs = 0$), andthe network will simply be run on the test sets.  In this case,the statistics for the training set will all be zeros.\item {\tt -1 <test set 1 list>} - this option specifies a textfile which contains a list of image pathnames, one per line, thatwill be used as a test set.  If this option is not specified,the statistics for test set 1 will all be zeros.\item {\tt -2 <test set 2 list>} - same as above, but for test set 2.The idea behind having two test sets is that one can be used as partof the train/test paradigm, in which training is stopped when performanceon the test set begins to degrade.  The other can then be used as a``real'' test of the resulting network.\end{description}\subsubsection{Interpreting the output of {\tt facetrain}}When you run {\tt facetrain}, it will first read inall the data files and print a bunch of lines regardingthese operations. Once all the data is loaded, it willbegin training. At this point, the network's training and test set performance is outlined in one line per epoch.For each epoch, the following performance measures are output:{\tt <epoch> <delta> <trainperf> <trainerr> <t1perf> <t1err><t2perf> <t2err>}These values have the following meanings:\begin{description}\item {\tt epoch} is the number of the epoch just completed; it followsthat a value of 0 means that no training has yet been performed.\item {\tt delta} is the sum of all $\delta$ values on the hidden andoutput units as computed during backprop, over all training examplesfor that epoch.\item {\tt trainperf} is the percentage of examples in the training setwhich were correctly classified.\item {\tt trainerr} is the average, over all training examples,of the error function $\frac{1}{2} \sum (t_{i} - o_{i})^{2}$, where$t_{i}$ is the target value for output unit $i$ and $o_{i}$ is the actualoutput value for that unit.\item {\tt t1perf} is the percentage of examples in test set 1which were correctly classified.\item {\tt t1err} is the average, over all examples in test set 1,of the error function described above.\item {\tt t2perf} is the percentage of examples in test set 2which were correctly classified.\item {\tt t2err} is the average, over all examples in test set 2,of the error function described above.\end{description}\subsection{Tips}Although you do not have to modify the image or network packages,you will need to know a little bit about the routines and data structuresin them, so that you can easily implement new output encodings foryour networks.  The following sections describe each of the packagesin a little more detail.  You can look at {\tt imagenet.c},{\tt facetrain.c}, and {\tt facerec.c} to see how the routines areactually used.  In fact, it is probably a good idea to look over {\tt facetrain.c}first, to see how the training process works.  You will noticethat {\tt load\_target()} from {\tt imagenet.c} is called to setup the target vector for training.  You will also notice theroutines which evaluate performance and compute error statistics,{\tt performance\_on\_imagelist()} and {\tt evaluate\_performance()}.The first routine iterates through a set of images, computing theaverage error on these images, and the second routine computesthe error and accuracy on a single image.You will almost certainly not need to use all of the informationin the following sections, so don't feel like you need to knoweverything the packages do.  You should view these sectionsas reference guides for the packages, should you need informationon data structures and routines.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -