home *** CD-ROM | disk | FTP | other *** search
/ ftp.pasteur.org/FAQ/ / ftp-pasteur-org-FAQ.zip / FAQ / ai-faq / neural-nets / part3 < prev    next >
Encoding:
Internet Message Format  |  2003-01-01  |  108.5 KB

  1. From: saswss@unx.sas.com (Warren Sarle)
  2. Newsgroups: comp.ai.neural-nets,comp.answers,news.answers
  3. Subject: comp.ai.neural-nets FAQ, Part 3 of 7: Generalization
  4. Supersedes: <nn3.posting_1027963394@hotellng.unx.sas.com>
  5. Followup-To: comp.ai.neural-nets
  6. Date: 30 Dec 2002 21:23:08 GMT
  7. Organization: SAS Institute Inc., Cary, NC, USA
  8. Lines: 2181
  9. Approved: news-answers-request@MIT.EDU
  10. Expires: 3 Feb 2003 21:23:07 GMT
  11. Message-ID: <nn3.posting_1041283387@hotellng.unx.sas.com>
  12. Reply-To: saswss@unx.sas.com (Warren Sarle)
  13. NNTP-Posting-Host: hotellng.unx.sas.com
  14. X-Trace: license1.unx.sas.com 1041283388 5839 10.28.2.188 (30 Dec 2002 21:23:08 GMT)
  15. X-Complaints-To: usenet@unx.sas.com
  16. NNTP-Posting-Date: 30 Dec 2002 21:23:08 GMT
  17. Keywords: frequently asked questions, answers
  18. Originator: saswss@hotellng.unx.sas.com
  19. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!news-out.cwix.com!newsfeed.cwix.com!feed2.news.rcn.net!rcn!news-out.visi.com!hermes.visi.com!news.lightlink.com!vienna7.his.com!attws1!ip.att.net!lamb.sas.com!newshost!hotellng.unx.sas.com!saswss
  20. Xref: senator-bedfellow.mit.edu comp.ai.neural-nets:64337 comp.answers:52355 news.answers:243494
  21.  
  22. Archive-name: ai-faq/neural-nets/part3
  23. Last-modified: 2001-05-21
  24. URL: ftp://ftp.sas.com/pub/neural/FAQ3.html
  25. Maintainer: saswss@unx.sas.com (Warren S. Sarle)
  26.  
  27. Copyright 1997, 1998, 1999, 2000, 2001, 2002 by Warren S. Sarle, Cary, NC,
  28. USA. Answers provided by other authors as cited below are copyrighted by
  29. those authors, who by submitting the answers for the FAQ give permission for
  30. the answer to be reproduced as part of the FAQ in any of the ways specified
  31. in part 1 of the FAQ. 
  32.  
  33. This is part 3 (of 7) of a monthly posting to the Usenet newsgroup
  34. comp.ai.neural-nets. See the part 1 of this posting for full information
  35. what it is all about.
  36.  
  37. ========== Questions ========== 
  38. ********************************
  39.  
  40. Part 1: Introduction
  41. Part 2: Learning
  42. Part 3: Generalization
  43.  
  44.    How is generalization possible?
  45.    How does noise affect generalization?
  46.    What is overfitting and how can I avoid it?
  47.    What is jitter? (Training with noise)
  48.    What is early stopping?
  49.    What is weight decay?
  50.    What is Bayesian learning?
  51.    How to combine networks?
  52.    How many hidden layers should I use?
  53.    How many hidden units should I use?
  54.    How can generalization error be estimated?
  55.    What are cross-validation and bootstrapping?
  56.    How to compute prediction and confidence intervals (error bars)?
  57.  
  58. Part 4: Books, data, etc.
  59. Part 5: Free software
  60. Part 6: Commercial software
  61. Part 7: Hardware and miscellaneous
  62.  
  63. ------------------------------------------------------------------------
  64.  
  65. Subject: How is generalization possible? 
  66. =========================================
  67.  
  68. During learning, the outputs of a supervised neural net come to approximate
  69. the target values given the inputs in the training set. This ability may be
  70. useful in itself, but more often the purpose of using a neural net is to
  71. generalize--i.e., to have the outputs of the net approximate target values
  72. given inputs that are not in the training set. Generalizaton is not always
  73. possible, despite the blithe assertions of some authors. For example,
  74. Caudill and Butler, 1990, p. 8, claim that "A neural network is able to
  75. generalize", but they provide no justification for this claim, and they
  76. completely neglect the complex issues involved in getting good
  77. generalization. Anyone who reads comp.ai.neural-nets is well aware from the
  78. numerous posts pleading for help that artificial neural networks do not
  79. automatically generalize. 
  80.  
  81. Generalization requires prior knowledge, as pointed out by Hume (1739/1978),
  82. Russell (1948), and Goodman (1954/1983) and rigorously proved by Wolpert
  83. (1995a, 1996a, 1996b). For any practical application, you have to know what
  84. the relevant inputs are (you can't simply include every imaginable input).
  85. You have to know a restricted class of input-output functions that contains
  86. an adequate approximation to the function you want to learn (you can't use a
  87. learning method that is capable of fitting every imaginable function). And
  88. you have to know that the cases you want to generalize to bear some
  89. resemblance to the training cases. Thus, there are three conditions that are
  90. typically necessary--although not sufficient--for good generalization: 
  91.  
  92. 1. The first necessary condition is that the inputs to the network contain
  93.    sufficient information pertaining to the target, so that there exists a
  94.    mathematical function relating correct outputs to inputs with the desired
  95.    degree of accuracy. You can't expect a network to learn a nonexistent
  96.    function--neural nets are not clairvoyant! For example, if you want to
  97.    forecast the price of a stock, a historical record of the stock's prices
  98.    is rarely sufficient input; you need detailed information on the
  99.    financial state of the company as well as general economic conditions,
  100.    and to avoid nasty surprises, you should also include inputs that can
  101.    accurately predict wars in the Middle East and earthquakes in Japan.
  102.    Finding good inputs for a net and collecting enough training data often
  103.    take far more time and effort than training the network. 
  104.  
  105. 2. The second necessary condition is that the function you are trying to
  106.    learn (that relates inputs to correct outputs) be, in some sense, smooth.
  107.    In other words, a small change in the inputs should, most of the time,
  108.    produce a small change in the outputs. For continuous inputs and targets,
  109.    smoothness of the function implies continuity and restrictions on the
  110.    first derivative over most of the input space. Some neural nets can learn
  111.    discontinuities as long as the function consists of a finite number of
  112.    continuous pieces. Very nonsmooth functions such as those produced by
  113.    pseudo-random number generators and encryption algorithms cannot be
  114.    generalized by neural nets. Often a nonlinear transformation of the input
  115.    space can increase the smoothness of the function and improve
  116.    generalization. 
  117.  
  118.    For classification, if you do not need to estimate posterior
  119.    probabilities, then smoothness is not theoretically necessary. In
  120.    particular, feedforward networks with one hidden layer trained by
  121.    minimizing the error rate (a very tedious training method) are
  122.    universally consistent classifiers if the number of hidden units grows at
  123.    a suitable rate relative to the number of training cases (Devroye,
  124.    Gy÷rfi, and Lugosi, 1996). However, you are likely to get better
  125.    generalization with realistic sample sizes if the classification
  126.    boundaries are smoother. 
  127.  
  128.    For Boolean functions, the concept of smoothness is more elusive. It
  129.    seems intuitively clear that a Boolean network with a small number of
  130.    hidden units and small weights will compute a "smoother" input-output
  131.    function than a network with many hidden units and large weights. If you
  132.    know a good reference characterizing Boolean functions for which good
  133.    generalization is possible, please inform the FAQ maintainer
  134.    (saswss@unx.sas.com). 
  135.  
  136. 3. The third necessary condition for good generalization is that the
  137.    training cases be a sufficiently large and representative subset
  138.    ("sample" in statistical terminology) of the set of all cases that you
  139.    want to generalize to (the "population" in statistical terminology). The
  140.    importance of this condition is related to the fact that there are,
  141.    loosely speaking, two different types of generalization: interpolation
  142.    and extrapolation. Interpolation applies to cases that are more or less
  143.    surrounded by nearby training cases; everything else is extrapolation. In
  144.    particular, cases that are outside the range of the training data require
  145.    extrapolation. Cases inside large "holes" in the training data may also
  146.    effectively require extrapolation. Interpolation can often be done
  147.    reliably, but extrapolation is notoriously unreliable. Hence it is
  148.    important to have sufficient training data to avoid the need for
  149.    extrapolation. Methods for selecting good training sets are discussed in
  150.    numerous statistical textbooks on sample surveys and experimental design.
  151.  
  152. Thus, for an input-output function that is smooth, if you have a test case
  153. that is close to some training cases, the correct output for the test case
  154. will be close to the correct outputs for those training cases. If you have
  155. an adequate sample for your training set, every case in the population will
  156. be close to a sufficient number of training cases. Hence, under these
  157. conditions and with proper training, a neural net will be able to generalize
  158. reliably to the population. 
  159.  
  160. If you have more information about the function, e.g. that the outputs
  161. should be linearly related to the inputs, you can often take advantage of
  162. this information by placing constraints on the network or by fitting a more
  163. specific model, such as a linear model, to improve generalization.
  164. Extrapolation is much more reliable in linear models than in flexible
  165. nonlinear models, although still not nearly as safe as interpolation. You
  166. can also use such information to choose the training cases more efficiently.
  167. For example, with a linear model, you should choose training cases at the
  168. outer limits of the input space instead of evenly distributing them
  169. throughout the input space. 
  170.  
  171. References: 
  172.  
  173.    Caudill, M. and Butler, C. (1990). Naturally Intelligent Systems. MIT
  174.    Press: Cambridge, Massachusetts. 
  175.  
  176.    Devroye, L., Gy÷rfi, L., and Lugosi, G. (1996), A Probabilistic Theory of
  177.    Pattern Recognition, NY: Springer. 
  178.  
  179.    Goodman, N. (1954/1983), Fact, Fiction, and Forecast, 1st/4th ed.,
  180.    Cambridge, MA: Harvard University Press. 
  181.  
  182.    Holland, J.H., Holyoak, K.J., Nisbett, R.E., Thagard, P.R. (1986), 
  183.    Induction: Processes of Inference, Learning, and Discovery, Cambridge, MA:
  184.    The MIT Press. 
  185.  
  186.    Howson, C. and Urbach, P. (1989), Scientific Reasoning: The Bayesian
  187.    Approach, La Salle, IL: Open Court. 
  188.  
  189.    Hume, D. (1739/1978), A Treatise of Human Nature, Selby-Bigge, L.A.,
  190.    and Nidditch, P.H. (eds.), Oxford: Oxford University Press. 
  191.  
  192.    Plotkin, H. (1993), Darwin Machines and the Nature of Knowledge,
  193.    Cambridge, MA: Harvard University Press. 
  194.  
  195.    Russell, B. (1948), Human Knowledge: Its Scope and Limits, London:
  196.    Routledge. 
  197.  
  198.    Stone, C.J. (1977), "Consistent nonparametric regression," Annals of
  199.    Statistics, 5, 595-645. 
  200.  
  201.    Stone, C.J. (1982), "Optimal global rates of convergence for
  202.    nonparametric regression," Annals of Statistics, 10, 1040-1053. 
  203.  
  204.    Vapnik, V.N. (1995), The Nature of Statistical Learning Theory, NY:
  205.    Springer. 
  206.  
  207.    Wolpert, D.H. (1995a), "The relationship between PAC, the statistical
  208.    physics framework, the Bayesian framework, and the VC framework," in
  209.    Wolpert (1995b), 117-214. 
  210.  
  211.    Wolpert, D.H. (ed.) (1995b), The Mathematics of Generalization: The
  212.    Proceedings of the SFI/CNLS Workshop on Formal Approaches to
  213.    Supervised Learning, Santa Fe Institute Studies in the Sciences of
  214.    Complexity, Volume XX, Reading, MA: Addison-Wesley. 
  215.  
  216.    Wolpert, D.H. (1996a), "The lack of a priori distinctions between
  217.    learning algorithms," Neural Computation, 8, 1341-1390. 
  218.  
  219.    Wolpert, D.H. (1996b), "The existence of a priori distinctions between
  220.    learning algorithms," Neural Computation, 8, 1391-1420. 
  221.  
  222. ------------------------------------------------------------------------
  223.  
  224. Subject: How does noise affect generalization? 
  225. ===============================================
  226.  
  227. "Statistical noise" means variation in the target values that is
  228. unpredictable from the inputs of a specific network, regardless of the
  229. architecture or weights. "Physical noise" refers to variation in the target
  230. values that is inherently unpredictable regardless of what inputs are used.
  231. Noise in the inputs usually refers to measurement error, so that if the same
  232. object or example is presented to the network more than once, the input
  233. values differ. 
  234.  
  235. Noise in the actual data is never a good thing, since it limits the accuracy
  236. of generalization that can be achieved no matter how extensive the training
  237. set is. On the other hand, injecting artificial noise (jitter) into the
  238. inputs during training is one of several ways to improve generalization for
  239. smooth functions when you have a small training set. 
  240.  
  241. Certain assumptions about noise are necessary for theoretical results.
  242. Usually, the noise distribution is assumed to have zero mean and finite
  243. variance. The noise in different cases is usually assumed to be independent
  244. or to follow some known stochastic model, such as an autoregressive process.
  245. The more you know about the noise distribution, the more effectively you can
  246. train the network (e.g., McCullagh and Nelder 1989). 
  247.  
  248. If you have noise in the target values, what the network learns depends
  249. mainly on the error function. For example, if the noise is independent with
  250. finite variance for all training cases, a network that is well-trained using
  251. least squares will produce outputs that approximate the conditional mean of
  252. the target values (White, 1990; Bishop, 1995). Note that for a binary 0/1
  253. variable, the mean is equal to the probability of getting a 1. Hence, the
  254. results in White (1990) immediately imply that for a categorical target with
  255. independent noise using 1-of-C coding (see "How should categories be
  256. encoded?"), a network that is well-trained using least squares will produce
  257. outputs that approximate the posterior probabilities of each class (see
  258. Rojas, 1996, if you want a simple explanation of why least-squares estimates
  259. probabilities). Posterior probabilities can also be learned using
  260. cross-entropy and various other error functions (Finke and Mⁿller, 1994;
  261. Bishop, 1995). The conditional median can be learned by least-absolute-value
  262. training (White, 1992a). Conditional modes can be approximated by yet other
  263. error functions (e.g., Rohwer and van der Rest 1996). For noise
  264. distributions that cannot be adequately approximated by a single location
  265. estimate (such as the mean, median, or mode), a network can be trained to
  266. approximate quantiles (White, 1992a) or mixture components (Bishop, 1995;
  267. Husmeier, 1999). 
  268.  
  269. If you have noise in the target values, the mean squared generalization
  270. error can never be less than the variance of the noise, no matter how much
  271. training data you have. But you can estimate the mean of the target values,
  272. conditional on a given set of input values, to any desired degree of
  273. accuracy by obtaining a sufficiently large and representative training set,
  274. assuming that the function you are trying to learn is one that can indeed be
  275. learned by the type of net you are using, and assuming that the complexity
  276. of the network is regulated appropriately (White 1990). 
  277.  
  278. Noise in the target values increases the danger of overfitting (Moody 1992).
  279.  
  280. Noise in the inputs limits the accuracy of generalization, but in a more
  281. complicated way than does noise in the targets. In a region of the input
  282. space where the function being learned is fairly flat, input noise will have
  283. little effect. In regions where that function is steep, input noise can
  284. degrade generalization severely. 
  285.  
  286. Furthermore, if the target function is Y=f(X), but you observe noisy inputs
  287. X+D, you cannot obtain an arbitrarily accurate estimate of f(X) given X+D no
  288. matter how large a training set you use. The net will not learn f(X), but
  289. will instead learn a convolution of f(X) with the distribution of the noise
  290. D (see "What is jitter?)" 
  291.  
  292. For more details, see one of the statistically-oriented references on neural
  293. nets such as: 
  294.  
  295.    Bishop, C.M. (1995), Neural Networks for Pattern Recognition, Oxford:
  296.    Oxford University Press, especially section 6.4. 
  297.  
  298.    Finke, M., and Mⁿller, K.-R. (1994), "Estimating a-posteriori
  299.    probabilities using stochastic network models," in Mozer, Smolensky,
  300.    Touretzky, Elman, & Weigend, eds., Proceedings of the 1993 Connectionist
  301.    Models Summer School, Hillsdale, NJ: Lawrence Erlbaum Associates, pp.
  302.    324-331. 
  303.  
  304.    Geman, S., Bienenstock, E. and Doursat, R. (1992), "Neural Networks and
  305.    the Bias/Variance Dilemma", Neural Computation, 4, 1-58. 
  306.  
  307.    Husmeier, D. (1999), Neural Networks for Conditional Probability
  308.    Estimation: Forecasting Beyond Point Predictions, Berlin: Springer
  309.    Verlag, ISBN 185233095. 
  310.  
  311.    McCullagh, P. and Nelder, J.A. (1989) Generalized Linear Models, 2nd
  312.    ed., London: Chapman & Hall. 
  313.  
  314.    Moody, J.E. (1992), "The Effective Number of Parameters: An Analysis of
  315.    Generalization and Regularization in Nonlinear Learning Systems", in
  316.    Moody, J.E., Hanson, S.J., and Lippmann, R.P., Advances in Neural
  317.    Information Processing Systems 4, 847-854. 
  318.  
  319.    Ripley, B.D. (1996) Pattern Recognition and Neural Networks, Cambridge:
  320.    Cambridge University Press. 
  321.  
  322.    Rohwer, R., and van der Rest, J.C. (1996), "Minimum description length,
  323.    regularization, and multimodal data," Neural Computation, 8, 595-609. 
  324.  
  325.    Rojas, R. (1996), "A short proof of the posterior probability property of
  326.    classifier neural networks," Neural Computation, 8, 41-43. 
  327.  
  328.    White, H. (1990), "Connectionist Nonparametric Regression: Multilayer
  329.    Feedforward Networks Can Learn Arbitrary Mappings," Neural Networks, 3,
  330.    535-550. Reprinted in White (1992). 
  331.  
  332.    White, H. (1992a), "Nonparametric Estimation of Conditional Quantiles
  333.    Using Neural Networks," in Page, C. and Le Page, R. (eds.), Proceedings
  334.    of the 23rd Sympsium on the Interface: Computing Science and Statistics,
  335.    Alexandria, VA: American Statistical Association, pp. 190-199. Reprinted
  336.    in White (1992b). 
  337.  
  338.    White, H. (1992b), Artificial Neural Networks: Approximation and
  339.    Learning Theory, Blackwell. 
  340.  
  341. ------------------------------------------------------------------------
  342.  
  343. Subject: What is overfitting and how can I avoid it? 
  344. =====================================================
  345.  
  346. The critical issue in developing a neural network is generalization: how
  347. well will the network make predictions for cases that are not in the
  348. training set? NNs, like other flexible nonlinear estimation methods such as
  349. kernel regression and smoothing splines, can suffer from either underfitting
  350. or overfitting. A network that is not sufficiently complex can fail to
  351. detect fully the signal in a complicated data set, leading to underfitting.
  352. A network that is too complex may fit the noise, not just the signal,
  353. leading to overfitting. Overfitting is especially dangerous because it can
  354. easily lead to predictions that are far beyond the range of the training
  355. data with many of the common types of NNs. Overfitting can also produce wild
  356. predictions in multilayer perceptrons even with noise-free data. 
  357.  
  358. For an elementary discussion of overfitting, see Smith (1996). For a more
  359. rigorous approach, see the article by Geman, Bienenstock, and Doursat (1992)
  360. on the bias/variance trade-off (it's not really a dilemma). We are talking
  361. about statistical bias here: the difference between the average value of an
  362. estimator and the correct value. Underfitting produces excessive bias in the
  363. outputs, whereas overfitting produces excessive variance. There are
  364. graphical examples of overfitting and underfitting in Sarle (1995, 1999). 
  365.  
  366. The best way to avoid overfitting is to use lots of training data. If you
  367. have at least 30 times as many training cases as there are weights in the
  368. network, you are unlikely to suffer from much overfitting, although you may
  369. get some slight overfitting no matter how large the training set is. For
  370. noise-free data, 5 times as many training cases as weights may be
  371. sufficient. But you can't arbitrarily reduce the number of weights for fear
  372. of underfitting. 
  373.  
  374. Given a fixed amount of training data, there are at least six approaches to
  375. avoiding underfitting and overfitting, and hence getting good
  376. generalization: 
  377.  
  378.  o Model selection 
  379.  o Jittering 
  380.  o Early stopping 
  381.  o Weight decay 
  382.  o Bayesian learning 
  383.  o Combining networks 
  384.  
  385. The first five approaches are based on well-understood theory. Methods for
  386. combining networks do not have such a sound theoretical basis but are the
  387. subject of current research. These six approaches are discussed in more
  388. detail under subsequent questions. 
  389.  
  390. The complexity of a network is related to both the number of weights and the
  391. size of the weights. Model selection is concerned with the number of
  392. weights, and hence the number of hidden units and layers. The more weights
  393. there are, relative to the number of training cases, the more overfitting
  394. amplifies noise in the targets (Moody 1992). The other approaches listed
  395. above are concerned, directly or indirectly, with the size of the weights.
  396. Reducing the size of the weights reduces the "effective" number of
  397. weights--see Moody (1992) regarding weight decay and Weigend (1994)
  398. regarding early stopping. Bartlett (1997) obtained learning-theory results
  399. in which generalization error is related to the L_1 norm of the weights
  400. instead of the VC dimension. 
  401.  
  402. Overfitting is not confined to NNs with hidden units. Overfitting can occur
  403. in generalized linear models (networks with no hidden units) if either or
  404. both of the following conditions hold: 
  405.  
  406. 1. The number of input variables (and hence the number of weights) is large
  407.    with respect to the number of training cases. Typically you would want at
  408.    least 10 times as many training cases as input variables, but with
  409.    noise-free targets, twice as many training cases as input variables would
  410.    be more than adequate. These requirements are smaller than those stated
  411.    above for networks with hidden layers, because hidden layers are prone to
  412.    creating ill-conditioning and other pathologies. 
  413.  
  414. 2. The input variables are highly correlated with each other. This condition
  415.    is called "multicollinearity" in the statistical literature.
  416.    Multicollinearity can cause the weights to become extremely large because
  417.    of numerical ill-conditioning--see "How does ill-conditioning affect NN
  418.    training?" 
  419.  
  420. Methods for dealing with these problems in the statistical literature
  421. include ridge regression (similar to weight decay), partial least squares
  422. (similar to Early stopping), and various methods with even stranger names,
  423. such as the lasso and garotte (van Houwelingen and le Cessie, ????). 
  424.  
  425. References: 
  426.  
  427.    Bartlett, P.L. (1997), "For valid generalization, the size of the weights
  428.    is more important than the size of the network," in Mozer, M.C., Jordan,
  429.    M.I., and Petsche, T., (eds.) Advances in Neural Information Processing
  430.    Systems 9, Cambrideg, MA: The MIT Press, pp. 134-140. 
  431.  
  432.    Geman, S., Bienenstock, E. and Doursat, R. (1992), "Neural Networks and
  433.    the Bias/Variance Dilemma", Neural Computation, 4, 1-58. 
  434.  
  435.    Moody, J.E. (1992), "The Effective Number of Parameters: An Analysis of
  436.    Generalization and Regularization in Nonlinear Learning Systems", in
  437.    Moody, J.E., Hanson, S.J., and Lippmann, R.P., Advances in Neural
  438.    Information Processing Systems 4, 847-854. 
  439.  
  440.    Sarle, W.S. (1995), "Stopped Training and Other Remedies for
  441.    Overfitting," Proceedings of the 27th Symposium on the Interface of
  442.    Computing Science and Statistics, 352-360, 
  443.    ftp://ftp.sas.com/pub/neural/inter95.ps.Z (this is a very large
  444.    compressed postscript file, 747K, 10 pages) 
  445.  
  446.    Sarle, W.S. (1999), "Donoho-Johnstone Benchmarks: Neural Net Results," 
  447.    ftp://ftp.sas.com/pub/neural/dojo/dojo.html 
  448.  
  449.    Smith, M. (1996). Neural Networks for Statistical Modeling, Boston:
  450.    International Thomson Computer Press, ISBN 1-850-32842-0.
  451.  
  452.    van Houwelingen,H.C., and le Cessie, S. (????), "Shrinkage and penalized
  453.    likelihood as methods to improve predictive accuracy," 
  454.    http://www.medstat.medfac.leidenuniv.nl/ms/HH/Files/shrinkage.pdf and 
  455.    http://www.medstat.medfac.leidenuniv.nl/ms/HH/Files/figures.pdf 
  456.  
  457.    Weigend, A. (1994), "On overfitting and the effective number of hidden
  458.    units," Proceedings of the 1993 Connectionist Models Summer School,
  459.    335-342. 
  460.  
  461. ------------------------------------------------------------------------
  462.  
  463. Subject: What is jitter? (Training with noise) 
  464. ===============================================
  465.  
  466. Jitter is artificial noise deliberately added to the inputs during training.
  467. Training with jitter is a form of smoothing related to kernel regression
  468. (see "What is GRNN?"). It is also closely related to regularization methods
  469. such as weight decay and ridge regression. 
  470.  
  471. Training with jitter works because the functions that we want NNs to learn
  472. are mostly smooth. NNs can learn functions with discontinuities, but the
  473. functions must be piecewise continuous in a finite number of regions if our
  474. network is restricted to a finite number of hidden units. 
  475.  
  476. In other words, if we have two cases with similar inputs, the desired
  477. outputs will usually be similar. That means we can take any training case
  478. and generate new training cases by adding small amounts of jitter to the
  479. inputs. As long as the amount of jitter is sufficiently small, we can assume
  480. that the desired output will not change enough to be of any consequence, so
  481. we can just use the same target value. The more training cases, the merrier,
  482. so this looks like a convenient way to improve training. But too much jitter
  483. will obviously produce garbage, while too little jitter will have little
  484. effect (Koistinen and Holmstr÷m 1992). 
  485.  
  486. Consider any point in the input space, not necessarily one of the original
  487. training cases. That point could possibly arise as a jittered input as a
  488. result of jittering any of several of the original neighboring training
  489. cases. The average target value at the given input point will be a weighted
  490. average of the target values of the original training cases. For an infinite
  491. number of jittered cases, the weights will be proportional to the
  492. probability densities of the jitter distribution, located at the original
  493. training cases and evaluated at the given input point. Thus the average
  494. target values given an infinite number of jittered cases will, by
  495. definition, be the Nadaraya-Watson kernel regression estimator using the
  496. jitter density as the kernel. Hence, training with jitter is an
  497. approximation to training with the kernel regression estimator as target.
  498. Choosing the amount (variance) of jitter is equivalent to choosing the
  499. bandwidth of the kernel regression estimator (Scott 1992). 
  500.  
  501. When studying nonlinear models such as feedforward NNs, it is often helpful
  502. first to consider what happens in linear models, and then to see what
  503. difference the nonlinearity makes. So let's consider training with jitter in
  504. a linear model. Notation: 
  505.  
  506.    x_ij is the value of the jth input (j=1, ..., p) for the
  507.         ith training case (i=1, ..., n).
  508.    X={x_ij} is an n by p matrix.
  509.    y_i is the target value for the ith training case.
  510.    Y={y_i} is a column vector.
  511.  
  512. Without jitter, the least-squares weights are B = inv(X'X)X'Y, where
  513. "inv" indicates a matrix inverse and "'" indicates transposition. Note that
  514. if we replicate each training case c times, or equivalently stack c copies
  515. of the X and Y matrices on top of each other, the least-squares weights are
  516. inv(cX'X)cX'Y = (1/c)inv(X'X)cX'Y = B, same as before. 
  517.  
  518. With jitter, x_ij is replaced by c cases x_ij+z_ijk, k=1, ...,
  519. c, where z_ijk is produced by some random number generator, usually with
  520. a normal distribution with mean 0 and standard deviation s, and the 
  521. z_ijk's are all independent. In place of the n by p matrix X, this
  522. gives us a big matrix, say Q, with cn rows and p columns. To compute the
  523. least-squares weights, we need Q'Q. Let's consider the jth diagonal
  524. element of Q'Q, which is 
  525.  
  526.                    2           2       2
  527.    sum (x_ij+z_ijk) = sum (x_ij + z_ijk + 2 x_ij z_ijk)
  528.    i,k                i,k
  529.  
  530. which is approximately, for c large, 
  531.  
  532.              2     2
  533.    c(sum x_ij  + ns ) 
  534.       i
  535.  
  536. which is c times the corresponding diagonal element of X'X plus ns^2.
  537. Now consider the u,vth off-diagonal element of Q'Q, which is 
  538.  
  539.    sum (x_iu+z_iuk)(x_iv+z_ivk)
  540.    i,k
  541.  
  542. which is approximately, for c large, 
  543.  
  544.    c(sum x_iu x_iv)
  545.       i
  546.  
  547. which is just c times the corresponding element of X'X. Thus, Q'Q equals
  548. c(X'X+ns^2I), where I is an identity matrix of appropriate size.
  549. Similar computations show that the crossproduct of Q with the target values
  550. is cX'Y. Hence the least-squares weights with jitter of variance s^2 are
  551. given by 
  552.  
  553.        2                2                    2
  554.    B(ns ) = inv(c(X'X+ns I))cX'Y = inv(X'X+ns I)X'Y
  555.  
  556. In the statistics literature, B(ns^2) is called a ridge regression
  557. estimator with ridge value ns^2. 
  558.  
  559. If we were to add jitter to the target values Y, the cross-product X'Y
  560. would not be affected for large c for the same reason that the off-diagonal
  561. elements of X'X are not afected by jitter. Hence, adding jitter to the
  562. targets will not change the optimal weights; it will just slow down training
  563. (An 1996). 
  564.  
  565. The ordinary least squares training criterion is (Y-XB)'(Y-XB).
  566. Weight decay uses the training criterion (Y-XB)'(Y-XB)+d^2B'B,
  567. where d is the decay rate. Weight decay can also be implemented by
  568. inventing artificial training cases. Augment the training data with p new
  569. training cases containing the matrix dI for the inputs and a zero vector
  570. for the targets. To put this in a formula, let's use A;B to indicate the
  571. matrix A stacked on top of the matrix B, so (A;B)'(C;D)=A'C+B'D.
  572. Thus the augmented inputs are X;dI and the augmented targets are Y;0,
  573. where 0 indicates the zero vector of the appropriate size. The squared error
  574. for the augmented training data is: 
  575.  
  576.    (Y;0-(X;dI)B)'(Y;0-(X;dI)B)
  577.    = (Y;0)'(Y;0) - 2(Y;0)'(X;dI)B + B'(X;dI)'(X;dI)B
  578.    = Y'Y - 2Y'XB + B'(X'X+d^2I)B
  579.    = Y'Y - 2Y'XB + B'X'XB + B'(d^2I)B
  580.    = (Y-XB)'(Y-XB)+d^2B'B
  581.  
  582. which is the weight-decay training criterion. Thus the weight-decay
  583. estimator is: 
  584.  
  585.     inv[(X;dI)'(X;dI)](X;dI)'(Y;0) = inv(X'X+d^2I)X'Y
  586.  
  587. which is the same as the jitter estimator B(d^2), i.e. jitter with
  588. variance d^2/n. The equivalence between the weight-decay estimator and
  589. the jitter estimator does not hold for nonlinear models unless the jitter
  590. variance is small relative to the curvature of the nonlinear function (An
  591. 1996). However, the equivalence of the two estimators for linear models
  592. suggests that they will often produce similar results even for nonlinear
  593. models. Details for nonlinear models, including classification problems, are
  594. given in An (1996). 
  595.  
  596. B(0) is obviously the ordinary least-squares estimator. It can be shown
  597. that as s^2 increases, the Euclidean norm of B(ns^2) decreases; in
  598. other words, adding jitter causes the weights to shrink. It can also be
  599. shown that under the usual statistical assumptions, there always exists some
  600. value of ns^2 > 0 such that B(ns^2) provides better expected
  601. generalization than B(0). Unfortunately, there is no way to calculate a
  602. value of ns^2 from the training data that is guaranteed to improve
  603. generalization. There are other types of shrinkage estimators called Stein
  604. estimators that do guarantee better generalization than B(0), but I'm not
  605. aware of a nonlinear generalization of Stein estimators applicable to neural
  606. networks. 
  607.  
  608. The statistics literature describes numerous methods for choosing the ridge
  609. value. The most obvious way is to estimate the generalization error by
  610. cross-validation, generalized cross-validation, or bootstrapping, and to
  611. choose the ridge value that yields the smallest such estimate. There are
  612. also quicker methods based on empirical Bayes estimation, one of which
  613. yields the following formula, useful as a first guess: 
  614.  
  615.     2    p(Y-XB(0))'(Y-XB(0))
  616.    s   = --------------------
  617.     1      n(n-p)B(0)'B(0)
  618.  
  619. You can iterate this a few times: 
  620.  
  621.     2      p(Y-XB(0))'(Y-XB(0))
  622.    s     = --------------------
  623.     l+1              2     2
  624.             n(n-p)B(s )'B(s )
  625.                      l     l
  626.  
  627. Note that the more training cases you have, the less noise you need. 
  628.  
  629. References: 
  630.  
  631.    An, G. (1996), "The effects of adding noise during backpropagation
  632.    training on a generalization performance," Neural Computation, 8,
  633.    643-674. 
  634.  
  635.    Bishop, C.M. (1995), Neural Networks for Pattern Recognition, Oxford:
  636.    Oxford University Press. 
  637.  
  638.    Holmstr÷m, L. and Koistinen, P. (1992) "Using additive noise in
  639.    back-propagation training", IEEE Transaction on Neural Networks, 3,
  640.    24-38. 
  641.  
  642.    Koistinen, P. and Holmstr÷m, L. (1992) "Kernel regression and
  643.    backpropagation training with noise," NIPS4, 1033-1039. 
  644.  
  645.    Reed, R.D., and Marks, R.J, II (1999), Neural Smithing: Supervised
  646.    Learning in Feedforward Artificial Neural Networks, Cambridge, MA: The
  647.    MIT Press, ISBN 0-262-18190-8. 
  648.  
  649.    Scott, D.W. (1992) Multivariate Density Estimation, Wiley. 
  650.  
  651.    Vinod, H.D. and Ullah, A. (1981) Recent Advances in Regression Methods,
  652.    NY: Marcel-Dekker. 
  653.  
  654. ------------------------------------------------------------------------
  655.  
  656. Subject: What is early stopping? 
  657. =================================
  658.  
  659. NN practitioners often use nets with many times as many parameters as
  660. training cases. E.g., Nelson and Illingworth (1991, p. 165) discuss training
  661. a network with 16,219 parameters with only 50 training cases! The method
  662. used is called "early stopping" or "stopped training" and proceeds as
  663. follows: 
  664.  
  665. 1. Divide the available data into training and validation sets. 
  666. 2. Use a large number of hidden units. 
  667. 3. Use very small random initial values. 
  668. 4. Use a slow learning rate. 
  669. 5. Compute the validation error rate periodically during training. 
  670. 6. Stop training when the validation error rate "starts to go up". 
  671.  
  672. It is crucial to realize that the validation error is not a good estimate
  673. of the generalization error. One method for getting an unbiased estimate of
  674. the generalization error is to run the net on a third set of data, the test
  675. set, that is not used at all during the training process. For other methods,
  676. see "How can generalization error be estimated?" 
  677.  
  678. Early stopping has several advantages: 
  679.  
  680.  o It is fast. 
  681.  o It can be applied successfully to networks in which the number of weights
  682.    far exceeds the sample size. 
  683.  o It requires only one major decision by the user: what proportion of
  684.    validation cases to use. 
  685.  
  686. But there are several unresolved practical issues in early stopping: 
  687.  
  688.  o How many cases do you assign to the training and validation sets? Rules
  689.    of thumb abound, but appear to be no more than folklore. The only
  690.    systematic results known to the FAQ maintainer are in Sarle (1995), which
  691.    deals only with the case of a single input. Amari et al. (1995) attempts
  692.    a theoretical approach but contains serious errors that completely
  693.    invalidate the results, especially the incorrect assumption that the
  694.    direction of approach to the optimum is distributed isotropically. 
  695.  o Do you split the data into training and validation sets randomly or by
  696.    some systematic algorithm? 
  697.  o How do you tell when the validation error rate "starts to go up"? It may
  698.    go up and down numerous times during training. The safest approach is to
  699.    train to convergence, then go back and see which iteration had the lowest
  700.    validation error. For more elaborate algorithms, see Prechelt (1994,
  701.    1998). 
  702.  
  703. Statisticians tend to be skeptical of stopped training because it appears to
  704. be statistically inefficient due to the use of the split-sample technique;
  705. i.e., neither training nor validation makes use of the entire sample, and
  706. because the usual statistical theory does not apply. However, there has been
  707. recent progress addressing both of the above concerns (Wang 1994). 
  708.  
  709. Early stopping is closely related to ridge regression. If the learning rate
  710. is sufficiently small, the sequence of weight vectors on each iteration will
  711. approximate the path of continuous steepest descent down the error surface.
  712. Early stopping chooses a point along this path that optimizes an estimate of
  713. the generalization error computed from the validation set. Ridge regression
  714. also defines a path of weight vectors by varying the ridge value. The ridge
  715. value is often chosen by optimizing an estimate of the generalization error
  716. computed by cross-validation, generalized cross-validation, or bootstrapping
  717. (see "What are cross-validation and bootstrapping?") There always exists a
  718. positive ridge value that will improve the expected generalization error in
  719. a linear model. A similar result has been obtained for early stopping in
  720. linear models (Wang, Venkatesh, and Judd 1994). In linear models, the ridge
  721. path lies close to, but does not coincide with, the path of continuous
  722. steepest descent; in nonlinear models, the two paths can diverge widely. The
  723. relationship is explored in more detail by Sj÷berg and Ljung (1992). 
  724.  
  725. References: 
  726.  
  727.    S. Amari, N.Murata, K.-R. Muller, M. Finke, H. Yang. Asymptotic
  728.    Statistical Theory of Overtraining and Cross-Validation. METR 95-06,
  729.    1995, Department of Mathematical Engineering and Information Physics,
  730.    University of Tokyo, Hongo 7-3-1, Bunkyo-ku, Tokyo 113, Japan. 
  731.  
  732.    Finnof, W., Hergert, F., and Zimmermann, H.G. (1993), "Improving model
  733.    selection by nonconvergent methods," Neural Networks, 6, 771-783. 
  734.  
  735.    Nelson, M.C. and Illingworth, W.T. (1991), A Practical Guide to Neural
  736.    Nets, Reading, MA: Addison-Wesley. 
  737.  
  738.    Orr, G.B., and Mueller, K.-R., eds. (1998), Neural Networks: Tricks of
  739.    the Trade, Berlin: Springer, ISBN 3-540-65311-2. 
  740.  
  741.    Prechelt, L. (1998), "Early stopping--But when?" in Orr and Mueller
  742.    (1998), 55-69. 
  743.  
  744.    Prechelt, L. (1994), "PROBEN1--A set of neural network benchmark problems
  745.    and benchmarking rules," Technical Report 21/94, Universitat Karlsruhe,
  746.    76128 Karlsruhe, Germany, 
  747.    ftp://ftp.ira.uka.de/pub/papers/techreports/1994/1994-21.ps.gz. 
  748.  
  749.    Sarle, W.S. (1995), "Stopped Training and Other Remedies for
  750.    Overfitting," Proceedings of the 27th Symposium on the Interface of
  751.    Computing Science and Statistics, 352-360, 
  752.    ftp://ftp.sas.com/pub/neural/inter95.ps.Z (this is a very large
  753.    compressed postscript file, 747K, 10 pages) 
  754.  
  755.    Sj÷berg, J. and Ljung, L. (1992), "Overtraining, Regularization, and
  756.    Searching for Minimum in Neural Networks," Technical Report
  757.    LiTH-ISY-I-1297, Department of Electrical Engineering, Linkoping
  758.    University, S-581 83 Linkoping, Sweden, http://www.control.isy.liu.se . 
  759.  
  760.    Wang, C. (1994), A Theory of Generalisation in Learning Machines with
  761.    Neural Network Application, Ph.D. thesis, University of Pennsylvania. 
  762.  
  763.    Wang, C., Venkatesh, S.S., and Judd, J.S. (1994), "Optimal Stopping and
  764.    Effective Machine Complexity in Learning," NIPS6, 303-310. 
  765.  
  766.    Weigend, A. (1994), "On overfitting and the effective number of hidden
  767.    units," Proceedings of the 1993 Connectionist Models Summer School,
  768.    335-342. 
  769.  
  770. ------------------------------------------------------------------------
  771.  
  772. Subject: What is weight decay? 
  773. ===============================
  774.  
  775. Weight decay adds a penalty term to the error function. The usual penalty is
  776. the sum of squared weights times a decay constant. In a linear model, this
  777. form of weight decay is equivalent to ridge regression. See "What is
  778. jitter?" for more explanation of ridge regression. 
  779.  
  780. Weight decay is a subset of regularization methods. The penalty term in
  781. weight decay, by definition, penalizes large weights. Other regularization
  782. methods may involve not only the weights but various derivatives of the
  783. output function (Bishop 1995). 
  784.  
  785. The weight decay penalty term causes the weights to converge to smaller
  786. absolute values than they otherwise would. Large weights can hurt
  787. generalization in two different ways. Excessively large weights leading to
  788. hidden units can cause the output function to be too rough, possibly with
  789. near discontinuities. Excessively large weights leading to output units can
  790. cause wild outputs far beyond the range of the data if the output activation
  791. function is not bounded to the same range as the data. To put it another
  792. way, large weights can cause excessive variance of the output (Geman,
  793. Bienenstock, and Doursat 1992). According to Bartlett (1997), the size (L_1
  794. norm) of the weights is more important than the number of weights in
  795. determining generalization. 
  796.  
  797. Other penalty terms besides the sum of squared weights are sometimes used. 
  798. Weight elimination (Weigend, Rumelhart, and Huberman 1991) uses: 
  799.  
  800.           (w_i)^2
  801.    sum -------------
  802.     i  (w_i)^2 + c^2
  803.  
  804. where w_i is the ith weight and c is a user-specified constant. Whereas
  805. decay using the sum of squared weights tends to shrink the large
  806. coefficients more than the small ones, weight elimination tends to shrink
  807. the small coefficients more, and is therefore more useful for suggesting
  808. subset models (pruning). 
  809.  
  810. The generalization ability of the network can depend crucially on the decay
  811. constant, especially with small training sets. One approach to choosing the
  812. decay constant is to train several networks with different amounts of decay
  813. and estimate the generalization error for each; then choose the decay
  814. constant that minimizes the estimated generalization error. Weigend,
  815. Rumelhart, and Huberman (1991) iteratively update the decay constant during
  816. training. 
  817.  
  818. There are other important considerations for getting good results from
  819. weight decay. You must either standardize the inputs and targets, or adjust
  820. the penalty term for the standard deviations of all the inputs and targets.
  821. It is usually a good idea to omit the biases from the penalty term. 
  822.  
  823. A fundamental problem with weight decay is that different types of weights
  824. in the network will usually require different decay constants for good
  825. generalization. At the very least, you need three different decay constants
  826. for input-to-hidden, hidden-to-hidden, and hidden-to-output weights.
  827. Adjusting all these decay constants to produce the best estimated
  828. generalization error often requires vast amounts of computation. 
  829.  
  830. Fortunately, there is a superior alternative to weight decay: hierarchical 
  831. Bayesian learning. Bayesian learning makes it possible to estimate
  832. efficiently numerous decay constants. 
  833.  
  834. References: 
  835.  
  836.    Bartlett, P.L. (1997), "For valid generalization, the size of the weights
  837.    is more important than the size of the network," in Mozer, M.C., Jordan,
  838.    M.I., and Petsche, T., (eds.) Advances in Neural Information Processing
  839.    Systems 9, Cambrideg, MA: The MIT Press, pp. 134-140. 
  840.  
  841.    Bishop, C.M. (1995), Neural Networks for Pattern Recognition, Oxford:
  842.    Oxford University Press. 
  843.  
  844.    Geman, S., Bienenstock, E. and Doursat, R. (1992), "Neural Networks and
  845.    the Bias/Variance Dilemma", Neural Computation, 4, 1-58. 
  846.  
  847.    Ripley, B.D. (1996) Pattern Recognition and Neural Networks, Cambridge:
  848.    Cambridge University Press. 
  849.  
  850.    Weigend, A. S., Rumelhart, D. E., & Huberman, B. A. (1991).
  851.    Generalization by weight-elimination with application to forecasting. In:
  852.    R. P. Lippmann, J. Moody, & D. S. Touretzky (eds.), Advances in Neural
  853.    Information Processing Systems 3, San Mateo, CA: Morgan Kaufmann. 
  854.  
  855. ------------------------------------------------------------------------
  856.  
  857. Subject: What is Bayesian Learning?
  858. ===================================
  859.  
  860. By Radford Neal. 
  861.  
  862. Conventional training methods for multilayer perceptrons ("backprop" nets)
  863. can be interpreted in statistical terms as variations on maximum likelihood
  864. estimation. The idea is to find a single set of weights for the network that
  865. maximize the fit to the training data, perhaps modified by some sort of
  866. weight penalty to prevent overfitting. 
  867.  
  868. The Bayesian school of statistics is based on a different view of what it
  869. means to learn from data, in which probability is used to represent
  870. uncertainty about the relationship being learned (a use that is shunned in
  871. conventional--i.e., frequentist--statistics). Before we have seen any data,
  872. our prior opinions about what the true relationship might be can be
  873. expresssed in a probability distribution over the network weights that
  874. define this relationship. After we look at the data (or after our program
  875. looks at the data), our revised opinions are captured by a posterior
  876. distribution over network weights. Network weights that seemed plausible
  877. before, but which don't match the data very well, will now be seen as being
  878. much less likely, while the probability for values of the weights that do
  879. fit the data well will have increased. 
  880.  
  881. Typically, the purpose of training is to make predictions for future cases
  882. in which only the inputs to the network are known. The result of
  883. conventional network training is a single set of weights that can be used to
  884. make such predictions. In contrast, the result of Bayesian training is a
  885. posterior distribution over network weights. If the inputs of the network
  886. are set to the values for some new case, the posterior distribution over
  887. network weights will give rise to a distribution over the outputs of the
  888. network, which is known as the predictive distribution for this new case. If
  889. a single-valued prediction is needed, one might use the mean of the
  890. predictive distribution, but the full predictive distribution also tells you
  891. how uncertain this prediction is. 
  892.  
  893. Why bother with all this? The hope is that Bayesian methods will provide
  894. solutions to such fundamental problems as: 
  895.  
  896.  o How to judge the uncertainty of predictions. This can be solved by
  897.    looking at the predictive distribution, as described above. 
  898.  o How to choose an appropriate network architecture (eg, the number hidden
  899.    layers, the number of hidden units in each layer). 
  900.  o How to adapt to the characteristics of the data (eg, the smoothness of
  901.    the function, the degree to which different inputs are relevant). 
  902.  
  903. Good solutions to these problems, especially the last two, depend on using
  904. the right prior distribution, one that properly represents the uncertainty
  905. that you probably have about which inputs are relevant, how smooth the
  906. function is, how much noise there is in the observations, etc. Such
  907. carefully vague prior distributions are usually defined in a hierarchical
  908. fashion, using hyperparameters, some of which are analogous to the weight
  909. decay constants of more conventional training procedures. The use of
  910. hyperparameters is discussed by Mackay (1992a, 1992b, 1995) and Neal (1993a,
  911. 1996), who in particular use an "Automatic Relevance Determination" scheme
  912. that aims to allow many possibly-relevant inputs to be included without
  913. damaging effects. 
  914.  
  915. Selection of an appropriate network architecture is another place where
  916. prior knowledge plays a role. One approach is to use a very general
  917. architecture, with lots of hidden units, maybe in several layers or groups,
  918. controlled using hyperparameters. This approach is emphasized by Neal
  919. (1996), who argues that there is no statistical need to limit the complexity
  920. of the network architecture when using well-designed Bayesian methods. It is
  921. also possible to choose between architectures in a Bayesian fashion, using
  922. the "evidence" for an architecture, as discussed by Mackay (1992a, 1992b). 
  923.  
  924. Implementing all this is one of the biggest problems with Bayesian methods.
  925. Dealing with a distribution over weights (and perhaps hyperparameters) is
  926. not as simple as finding a single "best" value for the weights. Exact
  927. analytical methods for models as complex as neural networks are out of the
  928. question. Two approaches have been tried: 
  929.  
  930. 1. Find the weights/hyperparameters that are most probable, using methods
  931.    similar to conventional training (with regularization), and then
  932.    approximate the distribution over weights using information available at
  933.    this maximum. 
  934. 2. Use a Monte Carlo method to sample from the distribution over weights.
  935.    The most efficient implementations of this use dynamical Monte Carlo
  936.    methods whose operation resembles that of backprop with momentum. 
  937.  
  938. The first method comes in two flavours. Buntine and Weigend (1991) describe
  939. a procedure in which the hyperparameters are first integrated out
  940. analytically, and numerical methods are then used to find the most probable
  941. weights. MacKay (1992a, 1992b) instead finds the values for the
  942. hyperparameters that are most likely, integrating over the weights (using an
  943. approximation around the most probable weights, conditional on the
  944. hyperparameter values). There has been some controversy regarding the merits
  945. of these two procedures, with Wolpert (1993) claiming that analytically
  946. integrating over the hyperparameters is preferable because it is "exact".
  947. This criticism has been rebutted by Mackay (1993). It would be inappropriate
  948. to get into the details of this controversy here, but it is important to
  949. realize that the procedures based on analytical integration over the
  950. hyperparameters do not provide exact solutions to any of the problems of
  951. practical interest. The discussion of an analogous situation in a different
  952. statistical context by O'Hagan (1985) may be illuminating. 
  953.  
  954. Monte Carlo methods for Bayesian neural networks have been developed by Neal
  955. (1993a, 1996). In this approach, the posterior distribution is represented
  956. by a sample of perhaps a few dozen sets of network weights. The sample is
  957. obtained by simulating a Markov chain whose equilibrium distribution is the
  958. posterior distribution for weights and hyperparameters. This technique is
  959. known as "Markov chain Monte Carlo (MCMC)"; see Neal (1993b) for a review.
  960. The method is exact in the limit as the size of the sample and the length of
  961. time for which the Markov chain is run increase, but convergence can
  962. sometimes be slow in practice, as for any network training method. 
  963.  
  964. Work on Bayesian neural network learning has so far concentrated on
  965. multilayer perceptron networks, but Bayesian methods can in principal be
  966. applied to other network models, as long as they can be interpreted in
  967. statistical terms. For some models (eg, RBF networks), this should be a
  968. fairly simple matter; for others (eg, Boltzmann Machines), substantial
  969. computational problems would need to be solved. 
  970.  
  971. Software implementing Bayesian neural network models (intended for research
  972. use) is available from the home pages of David MacKay and Radford Neal. 
  973.  
  974. There are many books that discuss the general concepts of Bayesian
  975. inference, though they mostly deal with models that are simpler than neural
  976. networks. Here are some recent ones: 
  977.  
  978.    Bernardo, J. M. and Smith, A. F. M. (1994) Bayesian Theory, New York:
  979.    John Wiley. 
  980.  
  981.    Gelman, A., Carlin, J.B., Stern, H.S., and Rubin, D.B. (1995) Bayesian
  982.    Data Analysis, London: Chapman & Hall, ISBN 0-412-03991-5. 
  983.  
  984.    O'Hagan, A. (1994) Bayesian Inference (Volume 2B in Kendall's Advanced
  985.    Theory of Statistics), ISBN 0-340-52922-9. 
  986.  
  987.    Robert, C. P. (1995) The Bayesian Choice, New York: Springer-Verlag. 
  988.  
  989. The following books and papers have tutorial material on Bayesian learning
  990. as applied to neural network models: 
  991.  
  992.    Bishop, C. M. (1995) Neural Networks for Pattern Recognition, Oxford:
  993.    Oxford University Press. 
  994.  
  995.    Lee, H.K.H (1999), Model Selection and Model Averaging for Neural
  996.    Networks, Doctoral dissertation, Carnegie Mellon University,
  997.    Pittsburgh, USA, http://lib.stat.cmu.edu/~herbie/thesis.html 
  998.  
  999.    MacKay, D. J. C. (1995) "Probable networks and plausible predictions - a
  1000.    review of practical Bayesian methods for supervised neural networks",
  1001.    available at ftp://wol.ra.phy.cam.ac.uk/pub/www/mackay/network.ps.gz. 
  1002.  
  1003.    Mueller, P. and Insua, D.R. (1995) "Issues in Bayesian Analysis of Neural
  1004.    Network Models," Neural Computation, 10, 571-592, (also Institute of
  1005.    Statistics and Decision Sciences Working Paper 95-31), 
  1006.    ftp://ftp.isds.duke.edu/pub/WorkingPapers/95-31.ps 
  1007.  
  1008.    Neal, R. M. (1996) Bayesian Learning for Neural Networks, New York:
  1009.    Springer-Verlag, ISBN 0-387-94724-8. 
  1010.  
  1011.    Ripley, B. D. (1996) Pattern Recognition and Neural Networks,
  1012.    Cambridge: Cambridge University Press. 
  1013.  
  1014.    Thodberg, H. H. (1996) "A review of Bayesian neural networks with an
  1015.    application to near infrared spectroscopy", IEEE Transactions on Neural
  1016.    Networks, 7, 56-72. 
  1017.  
  1018. Some other references: 
  1019.  
  1020.    Bernardo, J.M., DeGroot, M.H., Lindley, D.V. and Smith, A.F.M., eds.,
  1021.    (1985), Bayesian Statistics 2, Amsterdam: Elsevier Science Publishers B.V.
  1022.    (North-Holland). 
  1023.  
  1024.    Buntine, W. L. and Weigend, A. S. (1991) "Bayesian back-propagation", 
  1025.    Complex Systems, 5, 603-643. 
  1026.  
  1027.    MacKay, D. J. C. (1992a) "Bayesian interpolation", Neural Computation,
  1028.    4, 415-447. 
  1029.  
  1030.    MacKay, D. J. C. (1992b) "A practical Bayesian framework for
  1031.    backpropagation networks," Neural Computation, 4, 448-472. 
  1032.  
  1033.    MacKay, D. J. C. (1993) "Hyperparameters: Optimize or Integrate Out?",
  1034.    available at ftp://wol.ra.phy.cam.ac.uk/pub/www/mackay/alpha.ps.gz. 
  1035.  
  1036.    Neal, R. M. (1993a) "Bayesian learning via stochastic dynamics", in C. L.
  1037.    Giles, S. J. Hanson, and J. D. Cowan (editors), Advances in Neural
  1038.    Information Processing Systems 5, San Mateo, California: Morgan
  1039.    Kaufmann, 475-482. 
  1040.  
  1041.    Neal, R. M. (1993b) Probabilistic Inference Using Markov Chain Monte
  1042.    Carlo Methods, available at 
  1043.    ftp://ftp.cs.utoronto.ca/pub/radford/review.ps.Z. 
  1044.  
  1045.    O'Hagan, A. (1985) "Shoulders in hierarchical models", in J. M. Bernardo,
  1046.    M. H. DeGroot, D. V. Lindley, and A. F. M. Smith (editors), Bayesian
  1047.    Statistics 2, Amsterdam: Elsevier Science Publishers B.V. (North-Holland),
  1048.    697-710. 
  1049.  
  1050.    Sarle, W. S. (1995) "Stopped Training and Other Remedies for
  1051.    Overfitting," Proceedings of the 27th Symposium on the Interface of
  1052.    Computing Science and Statistics, 352-360, 
  1053.    ftp://ftp.sas.com/pub/neural/inter95.ps.Z (this is a very large
  1054.    compressed postscript file, 747K, 10 pages) 
  1055.  
  1056.    Wolpert, D. H. (1993) "On the use of evidence in neural networks", in C.
  1057.    L. Giles, S. J. Hanson, and J. D. Cowan (editors), Advances in Neural
  1058.    Information Processing Systems 5, San Mateo, California: Morgan
  1059.    Kaufmann, 539-546. 
  1060.  
  1061. Finally, David MacKay maintains a FAQ about Bayesian methods for neural
  1062. networks, at http://wol.ra.phy.cam.ac.uk/mackay/Bayes_FAQ.html . 
  1063.  
  1064. Comments on Bayesian learning
  1065. +++++++++++++++++++++++++++++
  1066.  
  1067. By Warren Sarle. 
  1068.  
  1069. Bayesian purists may argue over the proper way to do a Bayesian analysis,
  1070. but even the crudest Bayesian computation (maximizing over both parameters
  1071. and hyperparameters) is shown by Sarle (1995) to generalize better than
  1072. early stopping when learning nonlinear functions. This approach requires the
  1073. use of slightly informative hyperpriors and at least twice as many training
  1074. cases as weights in the network. A full Bayesian analysis by MCMC can be
  1075. expected to work even better under even broader conditions. Bayesian
  1076. learning works well by frequentist standards--what MacKay calls the
  1077. "evidence framework" is used by frequentist statisticians under the name
  1078. "empirical Bayes." Although considerable research remains to be done,
  1079. Bayesian learning seems to be the most promising approach to training neural
  1080. networks. 
  1081.  
  1082. Bayesian learning should not be confused with the "Bayes classifier." In the
  1083. latter, the distribution of the inputs given the target class is assumed to
  1084. be known exactly, and the prior probabilities of the classes are assumed
  1085. known, so that the posterior probabilities can be computed by a
  1086. (theoretically) simple application of Bayes' theorem. The Bayes classifier
  1087. involves no learning--you must already know everything that needs to be
  1088. known! The Bayes classifier is a gold standard that can almost never be used
  1089. in real life but is useful in theoretical work and in simulation studies
  1090. that compare classification methods. The term "Bayes rule" is also used to
  1091. mean any classification rule that gives results identical to those of a
  1092. Bayes classifier. 
  1093.  
  1094. Bayesian learning also should not be confused with the "naive" or "idiot's"
  1095. Bayes classifier (Warner et al. 1961; Ripley, 1996), which assumes that the
  1096. inputs are conditionally independent given the target class. The naive Bayes
  1097. classifier is usually applied with categorical inputs, and the distribution
  1098. of each input is estimated by the proportions in the training set; hence the
  1099. naive Bayes classifier is a frequentist method. 
  1100.  
  1101. The term "Bayesian network" often refers not to a neural network but to a
  1102. belief network (also called a causal net, influence diagram, constraint
  1103. network, qualitative Markov network, or gallery). Belief networks are more
  1104. closely related to expert systems than to neural networks, and do not
  1105. necessarily involve learning (Pearl, 1988; Ripley, 1996). Here are some URLs
  1106. on Bayesian belief networks: 
  1107.  
  1108.  o http://bayes.stat.washington.edu/almond/belief.html 
  1109.  o http://www.cs.orst.edu/~dambrosi/bayesian/frame.html 
  1110.  o http://www2.sis.pitt.edu/~genie 
  1111.  o http://www.research.microsoft.com/dtg/msbn 
  1112.  
  1113. References for comments: 
  1114.  
  1115.    Pearl, J. (1988) Probabilistic Reasoning in Intelligent Systems: Networks
  1116.    of Plausible Inference, San Mateo, CA: Morgan Kaufmann. 
  1117.  
  1118.    Ripley, B. D. (1996) Pattern Recognition and Neural Networks,
  1119.    Cambridge: Cambridge University Press. 
  1120.  
  1121.    Warner, H.R., Toronto, A.F., Veasy, L.R., and Stephenson, R. (1961), "A
  1122.    mathematical model for medical diagnosis--application to congenital heart
  1123.    disease," J. of the American Medical Association, 177, 177-184. 
  1124.  
  1125. ------------------------------------------------------------------------
  1126.  
  1127. Subject: How to combine networks? 
  1128. ==================================
  1129.  
  1130. Methods for combining networks are a subject of active research. Many
  1131. different methods with different purposes have been proposed. The properties
  1132. and relationships of these methods are just beginning to be understood. Some
  1133. methods, such as boosting, are remedies for underfitting. Other methods,
  1134. such as bagging, are mainly remedies for overfitting or instability.
  1135. Bayesian learning naturally leads to model averaging (Hoeting et al., 1999).
  1136. A good general reference is the book edited by Sharkey (1999), especially
  1137. the article by Drucker (1999). Regarding the effects of bagging and weight
  1138. decay used together, see Taniguchi and Tresp (1997). 
  1139.  
  1140. Here is a list of terms used for various methods of combining models, mostly
  1141. taken from Christoph M. Friedrich's web page (see below): 
  1142.  
  1143.  o Adaboost 
  1144.  o ADDEMUP 
  1145.  o arcing: adaptive recombination of classifiers 
  1146.  o bagging: bootstrap aggregation 
  1147.  o bag-stacking: bagging plus stacking 
  1148.  o boosting 
  1149.  o cascading 
  1150.  o combination of classifiers 
  1151.  o committees of networks 
  1152.  o consensus theory 
  1153.  o cragging: cross aggregation (like k-fold cross validation) 
  1154.  o dagging: disjoint-sample aggregation 
  1155.  o dag-stacking: dagging plus stacking 
  1156.  o divide and conquer classifiers 
  1157.  o ensembles 
  1158.  o hagging: half-sample aggregation 
  1159.  o mixture of experts 
  1160.  o multiple classifier systems: 
  1161.  o multi-stage and multi-level classifiers 
  1162.  o OLC: optimal linear combination 
  1163.  o pandemonium of reflective agents 
  1164.  o sieving algorithms 
  1165.  o stacking: feeding outputs of several models (and possibly the the
  1166.    original inputs) into a second-level model 
  1167.  o voting 
  1168.  
  1169. URLs: 
  1170.  
  1171.  o Christoph M. Friedrich's web page, "Combinations of Classifiers and
  1172.    Regressors Bibliography and Guide to Internet Resources" at 
  1173.    http://www.tussy.uni-wh.de/~chris/ensemble/ensemble.html 
  1174.  
  1175.  o Tirthankar RayChaudhuri's web page on combining estimators at 
  1176.    http://www-comp.mpce.mq.edu.au/~tirthank/combest.html 
  1177.  
  1178.  o Robert E. Schapire's boosting page at 
  1179.    http://www.research.att.com/~schapire/boost.html 
  1180.  
  1181.  o http://www.boosting.org/ 
  1182.  
  1183. References: 
  1184.  
  1185.    Clemen, Robert T. (1989), "Combining forecasts: A review and annotated
  1186.    bibliography", International Journal of Forecasting, Vol 5, pp 559-584. 
  1187.  
  1188.    Drucker, H. (1999), "Boosting using neural networks," in Sharkey (1999),
  1189.    pp. 51-78. 
  1190.  
  1191.    Hoeting, J. A., Madigan, D., Raftery, A.E., and Volinsky, C.T. (1999)
  1192.    "Bayesian Model Averaging: A Tutorial (with discussion)," Statistical
  1193.    Science, 14:4, 382-417. Corrected version available at 
  1194.    http://www.stat.washington.edu/www/research/online/hoeting1999.pdf 
  1195.  
  1196.    Sharkey, A.J.C. (1999), Combining Artificial Neural Nets: Ensemble and
  1197.    Modular Multi-Net Systems, London: Springer. 
  1198.  
  1199.    Taniguchi, M., and Tresp, V. (1997), "Averaging regularized estimators,"
  1200.    Neural Computation, 9, 1163-1178. 
  1201.  
  1202. ------------------------------------------------------------------------
  1203.  
  1204. Subject: How many hidden layers should I use? 
  1205. ==============================================
  1206.  
  1207. You may not need any hidden layers at all. Linear and generalized linear
  1208. models are useful in a wide variety of applications (McCullagh and Nelder
  1209. 1989). And even if the function you want to learn is mildly nonlinear, you
  1210. may get better generalization with a simple linear model than with a
  1211. complicated nonlinear model if there is too little data or too much noise to
  1212. estimate the nonlinearities accurately. 
  1213.  
  1214. In MLPs with step/threshold/Heaviside activation functions, you need two
  1215. hidden layers for full generality (Sontag 1992). For further discussion, see
  1216. Bishop (1995, 121-126). 
  1217.  
  1218. In MLPs with any of a wide variety of continuous nonlinear hidden-layer
  1219. activation functions, one hidden layer with an arbitrarily large number of
  1220. units suffices for the "universal approximation" property (e.g., Hornik,
  1221. Stinchcombe and White 1989; Hornik 1993; for more references, see Bishop
  1222. 1995, 130, and Ripley, 1996, 173-180). But there is no theory yet to tell
  1223. you how many hidden units are needed to approximate any given function. 
  1224.  
  1225. If you have only one input, there seems to be no advantage to using more
  1226. than one hidden layer. But things get much more complicated when there are
  1227. two or more inputs. To illustrate, examples with two inputs and one output
  1228. will be used so that the results can be shown graphically. In each example
  1229. there are 441 training cases on a regular 21-by-21 grid. The test sets have
  1230. 1681 cases on a regular 41-by-41 grid over the same domain as the training
  1231. set. If you are reading the HTML version of this document via a web browser,
  1232. you can see surface plots based on the test set by clicking on the file
  1233. names mentioned in the folowing text. Each plot is a gif file, approximately
  1234. 9K in size. 
  1235.  
  1236. Consider a target function of two inputs, consisting of a Gaussian hill in
  1237. the middle of a plane (hill.gif). An MLP with an identity output activation
  1238. function can easily fit the hill by surrounding it with a few sigmoid
  1239. (logistic, tanh, arctan, etc.) hidden units, but there will be spurious
  1240. ridges and valleys where the plane should be flat (h_mlp_6.gif). It takes
  1241. dozens of hidden units to flatten out the plane accurately (h_mlp_30.gif). 
  1242.  
  1243. Now suppose you use a logistic output activation function. As the input to a
  1244. logistic function goes to negative infinity, the output approaches zero. The
  1245. plane in the Gaussian target function also has a value of zero. If the
  1246. weights and bias for the output layer yield large negative values outside
  1247. the base of the hill, the logistic function will flatten out any spurious
  1248. ridges and valleys. So fitting the flat part of the target function is easy 
  1249. (h_mlpt_3_unsq.gif and h_mlpt_3.gif). But the logistic function also tends
  1250. to lower the top of the hill. 
  1251.  
  1252. If instead of a rounded hill, the target function was a mesa with a large,
  1253. flat top with a value of one, the logistic output activation function would
  1254. be able to smooth out the top of the mesa just like it smooths out the plane
  1255. below. Target functions like this, with large flat areas with values of
  1256. either zero or one, are just what you have in many noise-free classificaton
  1257. problems. In such cases, a single hidden layer is likely to work well. 
  1258.  
  1259. When using a logistic output activation function, it is common practice to
  1260. scale the target values to a range of .1 to .9. Such scaling is bad in a
  1261. noise-free classificaton problem, because it prevents the logistic function
  1262. from smoothing out the flat areas (h_mlpt1-9_3.gif). 
  1263.  
  1264. For the Gaussian target function, [.1,.9] scaling would make it easier to
  1265. fit the top of the hill, but would reintroduce undulations in the plane. It
  1266. would be better for the Gaussian target function to scale the target values
  1267. to a range of 0 to .9. But for a more realistic and complicated target
  1268. function, how would you know the best way to scale the target values? 
  1269.  
  1270. By introducing a second hidden layer with one sigmoid activation function
  1271. and returning to an identity output activation function, you can let the net
  1272. figure out the best scaling (h_mlp1_3.gif). Actually, the bias and weight
  1273. for the output layer scale the output rather than the target values, and you
  1274. can use whatever range of target values is convenient. 
  1275.  
  1276. For more complicated target functions, especially those with several hills
  1277. or valleys, it is useful to have several units in the second hidden layer.
  1278. Each unit in the second hidden layer enables the net to fit a separate hill
  1279. or valley. So an MLP with two hidden layers can often yield an accurate
  1280. approximation with fewer weights than an MLP with one hidden layer. (Chester
  1281. 1990). 
  1282.  
  1283. To illustrate the use of multiple units in the second hidden layer, the next
  1284. example resembles a landscape with a Gaussian hill and a Gaussian valley,
  1285. both elliptical (hillanvale.gif). The table below gives the RMSE (root mean
  1286. squared error) for the test set with various architectures. If you are
  1287. reading the HTML version of this document via a web browser, click on any
  1288. number in the table to see a surface plot of the corresponding network
  1289. output. 
  1290.  
  1291. The MLP networks in the table have one or two hidden layers with a tanh
  1292. activation function. The output activation function is the identity. Using a
  1293. squashing function on the output layer is of no benefit for this function,
  1294. since the only flat area in the function has a target value near the middle
  1295. of the target range. 
  1296.  
  1297.           Hill and Valley Data: RMSE for the Test Set
  1298.               (Number of weights in parentheses)
  1299.                          MLP Networks
  1300.  
  1301. HUs in                  HUs in Second Layer
  1302. First  ----------------------------------------------------------
  1303. Layer     0           1           2           3           4
  1304.  1     0.204(  5)  0.204(  7)  0.189( 10)  0.187( 13)  0.185( 16)
  1305.  2     0.183(  9)  0.163( 11)  0.147( 15)  0.094( 19)  0.096( 23)
  1306.  3     0.159( 13)  0.095( 15)  0.054( 20)  0.033( 25)  0.045( 30)
  1307.  4     0.137( 17)  0.093( 19)  0.009( 25)  0.021( 31)  0.016( 37)
  1308.  5     0.121( 21)  0.092( 23)              0.010( 37)  0.011( 44)
  1309.  6     0.100( 25)  0.092( 27)              0.007( 43)  0.005( 51)
  1310.  7     0.086( 29)  0.077( 31)
  1311.  8     0.079( 33)  0.062( 35)
  1312.  9     0.072( 37)  0.055( 39)
  1313. 10     0.059( 41)  0.047( 43)
  1314. 12     0.047( 49)  0.042( 51)
  1315. 15     0.039( 61)  0.032( 63)
  1316. 20     0.025( 81)  0.018( 83)  
  1317. 25     0.021(101)  0.016(103)  
  1318. 30     0.018(121)  0.015(123)  
  1319. 40     0.012(161)  0.015(163)  
  1320. 50     0.008(201)  0.014(203)  
  1321.  
  1322. For an MLP with only one hidden layer (column 0), Gaussian hills and valleys
  1323. require a large number of hidden units to approximate well. When there is
  1324. one unit in the second hidden layer, the network can represent one hill or
  1325. valley easily, which is what happens with three to six units in the first
  1326. hidden layer. But having only one unit in the second hidden layer is of
  1327. little benefit for learning two hills or valleys. Using two units in the
  1328. second hidden layer enables the network to approximate two hills or valleys
  1329. easily; in this example, only four units are required in the first hidden
  1330. layer to get an excellent fit. Each additional unit in the second hidden
  1331. layer enables the network to learn another hill or valley with a relatively
  1332. small number of units in the first hidden layer, as explained by Chester
  1333. (1990). In this example, having three or four units in the second hidden
  1334. layer helps little, and actually produces a worse approximation when there
  1335. are four units in the first hidden layer due to problems with local minima. 
  1336.  
  1337. Unfortunately, using two hidden layers exacerbates the problem of local
  1338. minima, and it is important to use lots of random initializations or other
  1339. methods for global optimization. Local minima with two hidden layers can
  1340. have extreme spikes or blades even when the number of weights is much
  1341. smaller than the number of training cases. One of the few advantages of 
  1342. standard backprop is that it is so slow that spikes and blades will not
  1343. become very sharp for practical training times. 
  1344.  
  1345. More than two hidden layers can be useful in certain architectures such as
  1346. cascade correlation (Fahlman and Lebiere 1990) and in special applications,
  1347. such as the two-spirals problem (Lang and Witbrock 1988) and ZIP code
  1348. recognition (Le Cun et al. 1989). 
  1349.  
  1350. RBF networks are most often used with a single hidden layer. But an extra,
  1351. linear hidden layer before the radial hidden layer enables the network to
  1352. ignore irrelevant inputs (see How do MLPs compare with RBFs?") The linear
  1353. hidden layer allows the RBFs to take elliptical, rather than radial
  1354. (circular), shapes in the space of the inputs. Hence the linear layer gives
  1355. you an elliptical basis function (EBF) network. In the hill and valley
  1356. example, an ORBFUN network requires nine hidden units (37 weights) to get
  1357. the test RMSE below .01, but by adding a linear hidden layer, you can get an
  1358. essentially perfect fit with three linear units followed by two radial units
  1359. (20 weights). 
  1360.  
  1361. References: 
  1362.  
  1363.    Bishop, C.M. (1995), Neural Networks for Pattern Recognition, Oxford:
  1364.    Oxford University Press. 
  1365.  
  1366.    Chester, D.L. (1990), "Why Two Hidden Layers are Better than One,"
  1367.    IJCNN-90-WASH-DC, Lawrence Erlbaum, 1990, volume 1, 265-268. 
  1368.  
  1369.    Fahlman, S.E. and Lebiere, C. (1990), "The Cascade Correlation Learning
  1370.    Architecture," NIPS2, 524-532, 
  1371.    ftp://archive.cis.ohio-state.edu/pub/neuroprose/fahlman.cascor-tr.ps.Z. 
  1372.  
  1373.    Hornik, K., Stinchcombe, M. and White, H. (1989), "Multilayer feedforward
  1374.    networks are universal approximators," Neural Networks, 2, 359-366. 
  1375.  
  1376.    Hornik, K. (1993), "Some new results on neural network approximation,"
  1377.    Neural Networks, 6, 1069-1072. 
  1378.  
  1379.    Lang, K.J. and Witbrock, M.J. (1988), "Learning to tell two spirals
  1380.    apart," in Touretzky, D., Hinton, G., and Sejnowski, T., eds., 
  1381.    Procedings of the 1988 Connectionist Models Summer School, San Mateo,
  1382.    CA: Morgan Kaufmann. 
  1383.  
  1384.    Le Cun, Y., Boser, B., Denker, J.s., Henderson, D., Howard, R.E.,
  1385.    Hubbard, W., and Jackel, L.D. (1989), "Backpropagation applied to
  1386.    handwritten ZIP code recognition", Neural Computation, 1, 541-551. 
  1387.  
  1388.    McCullagh, P. and Nelder, J.A. (1989) Generalized Linear Models, 2nd
  1389.    ed., London: Chapman & Hall. 
  1390.  
  1391.    Ripley, B.D. (1996) Pattern Recognition and Neural Networks, Cambridge:
  1392.    Cambridge University Press. 
  1393.  
  1394.    Sontag, E.D. (1992), "Feedback stabilization using two-hidden-layer
  1395.    nets", IEEE Transactions on Neural Networks, 3, 981-990. 
  1396.  
  1397. ------------------------------------------------------------------------
  1398.  
  1399. Subject: How many hidden units should I use? 
  1400. =============================================
  1401.  
  1402. The best number of hidden units depends in a complex way on: 
  1403.  
  1404.  o the numbers of input and output units 
  1405.  o the number of training cases 
  1406.  o the amount of noise in the targets 
  1407.  o the complexity of the function or classification to be learned 
  1408.  o the architecture 
  1409.  o the type of hidden unit activation function 
  1410.  o the training algorithm 
  1411.  o regularization 
  1412.  
  1413. In most situations, there is no way to determine the best number of hidden
  1414. units without training several networks and estimating the generalization
  1415. error of each. If you have too few hidden units, you will get high training
  1416. error and high generalization error due to underfitting and high statistical
  1417. bias. If you have too many hidden units, you may get low training error but
  1418. still have high generalization error due to overfitting and high variance.
  1419. Geman, Bienenstock, and Doursat (1992) discuss how the number of hidden
  1420. units affects the bias/variance trade-off. 
  1421.  
  1422. Some books and articles offer "rules of thumb" for choosing an architecture;
  1423. for example: 
  1424.  
  1425.  o "A rule of thumb is for the size of this [hidden] layer to be somewhere
  1426.    between the input layer size ... and the output layer size ..." (Blum,
  1427.    1992, p. 60). 
  1428.  o "To calculate the number of hidden nodes we use a general rule of:
  1429.    (Number of inputs + outputs) * (2/3)" (from the FAQ for a commercial
  1430.    neural network software company). 
  1431.  o "you will never require more than twice the number of hidden units as you
  1432.    have inputs" in an MLP with one hidden layer (Swingler, 1996, p. 53). See
  1433.    the section in Part 4 of the FAQ on The Worst books for the source of
  1434.    this myth.) 
  1435.  o "How large should the hidden layer be? One rule of thumb is that it
  1436.    should never be more than twice as large as the input layer." (Berry and
  1437.    Linoff, 1997, p. 323). 
  1438.  o "Typically, we specify as many hidden nodes as dimensions [principal
  1439.    components] needed to capture 70-90% of the variance of the input data
  1440.    set." (Boger and Guterman, 1997) 
  1441.  
  1442. These rules of thumb are nonsense because they ignore the number of training
  1443. cases, the amount of noise in the targets, and the complexity of the
  1444. function. Even if you restrict consideration to minimizing training error on
  1445. data with lots of training cases and no noise, it is easy to construct
  1446. counterexamples that disprove these rules of thumb. For example: 
  1447.  
  1448.  o There are 100 Boolean inputs and 100 Boolean targets. Each target is a
  1449.    conjunction of some subset of inputs. No hidden units are needed. 
  1450.  
  1451.  o There are two continuous inputs X and Y which take values uniformly
  1452.    distributed on a square [0,8] by [0,8]. Think of the input space as a
  1453.    chessboard, and number the squares 1 to 64. The categorical target
  1454.    variable C is the square number, so there are 64 output units. For
  1455.    example, you could generate the data as follows (this is the SAS
  1456.    programming language, but it should be easy to translate into any other
  1457.    language): 
  1458.  
  1459.    data chess;
  1460.       step = 1/4;
  1461.       do x = step/2 to 8-step/2 by step;
  1462.          do y = step/2 to 8-step/2 by step;
  1463.             c = 8*floor(x) + floor(y) + 1;
  1464.             output;
  1465.          end;
  1466.       end;
  1467.    run;
  1468.  
  1469.    No hidden units are needed. 
  1470.  
  1471.  o The classic two-spirals problem has two continuous inputs and a Boolean
  1472.    classification target. The data can be generated as follows: 
  1473.  
  1474.    data spirals;
  1475.       pi = arcos(-1);
  1476.       do i = 0 to 96;
  1477.          angle = i*pi/16.0;
  1478.          radius = 6.5*(104-i)/104;
  1479.          x = radius*cos(angle);
  1480.          y = radius*sin(angle);
  1481.          c = 1;
  1482.          output;
  1483.          x = -x;
  1484.          y = -y;
  1485.          c = 0;
  1486.          output;
  1487.       end;
  1488.    run;
  1489.  
  1490.    With one hidden layer, about 50 tanh hidden units are needed. Many NN
  1491.    programs may actually need closer to 100 hidden units to get zero
  1492.    training error. 
  1493.  
  1494.  o There is one continuous input X that takes values on [0,100]. There is
  1495.    one continuous target Y = sin(X). Getting a good approximation to Y
  1496.    requires about 20 to 25 tanh hidden units. Of course, 1 sine hidden unit
  1497.    would do the job. 
  1498.  
  1499. Some rules of thumb relate the total number of trainable weights in the
  1500. network to the number of training cases. A typical recommendation is that
  1501. the number of weights should be no more than 1/30 of the number of training
  1502. cases. Such rules are only concerned with overfitting and are at best crude
  1503. approximations. Also, these rules do not apply when regularization is used.
  1504. It is true that without regularization, if the number of training cases is 
  1505. much larger (but no one knows exactly how much larger) than the number of
  1506. weights, you are unlikely to get overfitting, but you may suffer from
  1507. underfitting. For a noise-free quantitative target variable, twice as many
  1508. training cases as weights may be more than enough to avoid overfitting. For
  1509. a very noisy categorical target variable, 30 times as many training cases as
  1510. weights may not be enough to avoid overfitting. 
  1511.  
  1512. An intelligent choice of the number of hidden units depends on whether you
  1513. are using early stopping or some other form of regularization. If not, you
  1514. must simply try many networks with different numbers of hidden units, 
  1515. estimate the generalization error for each one, and choose the network with
  1516. the minimum estimated generalization error. For examples using statistical
  1517. criteria to choose the number of hidden units, see 
  1518. ftp://ftp.sas.com/pub/neural/dojo/dojo.html. 
  1519.  
  1520. Using conventional optimization algorithms (see "What are conjugate
  1521. gradients, Levenberg-Marquardt, etc.?"), there is little point in trying a
  1522. network with more weights than training cases, since such a large network is
  1523. likely to overfit. 
  1524.  
  1525. Using standard online backprop, however, Lawrence, Giles, and Tsoi (1996,
  1526. 1997) have shown that it can be difficult to reduce training error to a
  1527. level near the globally optimal value, even when using more weights than
  1528. training cases. But increasing the number of weights makes it easier for
  1529. standard backprop to find a good local optimum, so using "oversize" networks
  1530. can reduce both training error and generalization error. 
  1531.  
  1532. If you are using early stopping, it is essential to use lots of hidden units
  1533. to avoid bad local optima (Sarle 1995). There seems to be no upper limit on
  1534. the number of hidden units, other than that imposed by computer time and
  1535. memory requirements. Weigend (1994) makes this assertion, but provides only
  1536. one example as evidence. Tetko, Livingstone, and Luik (1995) provide
  1537. simulation studies that are more convincing. Similar results were obtained
  1538. in conjunction with the simulations in Sarle (1995), but those results are
  1539. not reported in the paper for lack of space. On the other hand, there seems
  1540. to be no advantage to using more hidden units than you have training cases,
  1541. since bad local minima do not occur with so many hidden units. 
  1542.  
  1543. If you are using weight decay or Bayesian estimation, you can also use lots
  1544. of hidden units (Neal 1996). However, it is not strictly necessary to do so,
  1545. because other methods are available to avoid local minima, such as multiple
  1546. random starts and simulated annealing (such methods are not safe to use with
  1547. early stopping). You can use one network with lots of hidden units, or you
  1548. can try different networks with different numbers of hidden units, and
  1549. choose on the basis of estimated generalization error. With weight decay or
  1550. MAP Bayesian estimation, it is prudent to keep the number of weights less
  1551. than half the number of training cases. 
  1552.  
  1553. Bear in mind that with two or more inputs, an MLP with one hidden layer
  1554. containing only a few units can fit only a limited variety of target
  1555. functions. Even simple, smooth surfaces such as a Gaussian bump in two
  1556. dimensions may require 20 to 50 hidden units for a close approximation.
  1557. Networks with a smaller number of hidden units often produce spurious ridges
  1558. and valleys in the output surface (see Chester 1990 and "How do MLPs compare
  1559. with RBFs?") Training a network with 20 hidden units will typically require
  1560. anywhere from 150 to 2500 training cases if you do not use early stopping or
  1561. regularization. Hence, if you have a smaller training set than that, it is
  1562. usually advisable to use early stopping or regularization rather than to
  1563. restrict the net to a small number of hidden units. 
  1564.  
  1565. Ordinary RBF networks containing only a few hidden units also produce
  1566. peculiar, bumpy output functions. Normalized RBF networks are better at
  1567. approximating simple smooth surfaces with a small number of hidden units
  1568. (see How do MLPs compare with RBFs?). 
  1569.  
  1570. There are various theoretical results on how fast approximation error
  1571. decreases as the number of hidden units increases, but the conclusions are
  1572. quite sensitive to the assumptions regarding the function you are trying to
  1573. approximate. See p. 178 in Ripley (1996) for a summary. According to a
  1574. well-known result by Barron (1993), in a network with I inputs and H units
  1575. in a single hidden layer, the root integrated squared error (RISE) will
  1576. decrease at least as fast as H^(-1/2) under some quite complicated
  1577. smoothness assumptions. Ripley cites another paper by DeVore et al. (1989)
  1578. that says if the function has only R bounded derivatives, RISE may decrease
  1579. as slowly as H^(-R/I). For some examples with from 1 to 4 hidden layers
  1580. see How many hidden layers should I use?" and "How do MLPs compare with
  1581. RBFs?" 
  1582.  
  1583. For learning a finite training set exactly, bounds for the number of hidden
  1584. units required are provided by Elisseeff and Paugam-Moisy (1997). 
  1585.  
  1586. References: 
  1587.  
  1588.    Barron, A.R. (1993), "Universal approximation bounds for superpositions
  1589.    of a sigmoid function," IEEE Transactions on Information Theory, 39,
  1590.    930-945. 
  1591.  
  1592.    Berry, M.J.A., and Linoff, G. (1997), Data Mining Techniques, NY: John
  1593.    Wiley & Sons. 
  1594.  
  1595.    Blum, A. (1992), Neural Networks in C++, NY: Wiley. 
  1596.  
  1597.    Boger, Z., and Guterman, H. (1997), "Knowledge extraction from artificial
  1598.    neural network models," IEEE Systems, Man, and Cybernetics Conference,
  1599.    Orlando, FL. 
  1600.  
  1601.    Chester, D.L. (1990), "Why Two Hidden Layers are Better than One,"
  1602.    IJCNN-90-WASH-DC, Lawrence Erlbaum, 1990, volume 1, 265-268. 
  1603.  
  1604.    DeVore, R.A., Howard, R., and Micchelli, C.A. (1989), "Optimal nonlinear
  1605.    approximation," Manuscripta Mathematica, 63, 469-478. 
  1606.  
  1607.    Elisseeff, A., and Paugam-Moisy, H. (1997), "Size of multilayer networks
  1608.    for exact learning: analytic approach," in Mozer, M.C., Jordan, M.I., and
  1609.    Petsche, T., (eds.) Advances in Neural Information Processing Systems 9,
  1610.    Cambrideg, MA: The MIT Press, pp.162-168. 
  1611.  
  1612.    Geman, S., Bienenstock, E. and Doursat, R. (1992), "Neural Networks and
  1613.    the Bias/Variance Dilemma", Neural Computation, 4, 1-58. 
  1614.  
  1615.    Lawrence, S., Giles, C.L., and Tsoi, A.C. (1996), "What size neural
  1616.    network gives optimal generalization? Convergence properties of
  1617.    backpropagation," Technical Report UMIACS-TR-96-22 and CS-TR-3617,
  1618.    Institute for Advanced Computer Studies, University of Maryland, College
  1619.    Park, MD 20742, 
  1620.    http://www.neci.nj.nec.com/homepages/lawrence/papers/minima-tr96/minima-tr96.html
  1621.  
  1622.    Lawrence, S., Giles, C.L., and Tsoi, A.C. (1997), "Lessons in Neural
  1623.    Network Training: Overfitting May be Harder than Expected," Proceedings
  1624.    of the Fourteenth National Conference on Artificial Intelligence,
  1625.    AAAI-97, AAAI Press, Menlo Park, California, pp. 540-545, 
  1626.    http://www.neci.nj.nec.com/homepages/lawrence/papers/overfitting-aaai97/overfitting-aaai97-bib.html
  1627.  
  1628.    Neal, R. M. (1996) Bayesian Learning for Neural Networks, New York:
  1629.    Springer-Verlag, ISBN 0-387-94724-8. 
  1630.  
  1631.    Ripley, B.D. (1996) Pattern Recognition and Neural Networks, Cambridge:
  1632.    Cambridge University Press, 
  1633.  
  1634.    Sarle, W.S. (1995), "Stopped Training and Other Remedies for
  1635.    Overfitting," Proceedings of the 27th Symposium on the Interface of
  1636.    Computing Science and Statistics, 352-360, 
  1637.    ftp://ftp.sas.com/pub/neural/inter95.ps.Z (this is a very large
  1638.    compressed postscript file, 747K, 10 pages) 
  1639.  
  1640.    Swingler, K. (1996), Applying Neural Networks: A Practical Guide, 
  1641.    London: Academic Press. 
  1642.  
  1643.    Tetko, I.V., Livingstone, D.J., and Luik, A.I. (1995), "Neural Network
  1644.    Studies. 1. Comparison of Overfitting and Overtraining," J. Chem. Info.
  1645.    Comp. Sci., 35, 826-833. 
  1646.  
  1647.    Weigend, A. (1994), "On overfitting and the effective number of hidden
  1648.    units," Proceedings of the 1993 Connectionist Models Summer School,
  1649.    335-342. 
  1650.  
  1651. ------------------------------------------------------------------------
  1652.  
  1653. Subject: How can generalization error be estimated? 
  1654. ====================================================
  1655.  
  1656. There are many methods for estimating generalization error. 
  1657.  
  1658. Single-sample statistics: AIC, SBC, MDL, FPE, Mallows' C_p, etc. 
  1659.    In linear models, statistical theory provides several simple estimators
  1660.    of the generalization error under various sampling assumptions
  1661.    (Darlington 1968; Efron and Tibshirani 1993; Miller 1990). These
  1662.    estimators adjust the training error for the number of weights being
  1663.    estimated, and in some cases for the noise variance if that is known. 
  1664.  
  1665.    These statistics can also be used as crude estimates of the
  1666.    generalization error in nonlinear models when you have a "large" training
  1667.    set. Correcting these statistics for nonlinearity requires substantially
  1668.    more computation (Moody 1992), and the theory does not always hold for
  1669.    neural networks due to violations of the regularity conditions. 
  1670.  
  1671.    Among the simple generalization estimators that do not require the noise
  1672.    variance to be known, Schwarz's Bayesian Criterion (known as both SBC and
  1673.    BIC; Schwarz 1978; Judge et al. 1980; Raftery 1995) often works well for
  1674.    NNs (Sarle 1995, 1999). AIC and FPE tend to overfit with NNs. Rissanen's
  1675.    Minimum Description Length principle (MDL; Rissanen 1978, 1987, 1999) is
  1676.    closely related to SBC. A special issue of Computer Journal contains
  1677.    several articles on MDL, which can be found online at 
  1678.    http://www3.oup.co.uk/computer_journal/hdb/Volume_42/Issue_04/ 
  1679.    Several articles on SBC/BIC are available at the University of
  1680.    Washigton's web site at http://www.stat.washington.edu/tech.reports 
  1681.  
  1682.    For classification problems, the formulas are not as simple as for
  1683.    regression with normal noise. See Efron (1986) regarding logistic
  1684.    regression. 
  1685.  
  1686. Split-sample or hold-out validation. 
  1687.    The most commonly used method for estimating generalization error in
  1688.    neural networks is to reserve part of the data as a "test" set, which
  1689.    must not be used in any way during training. The test set must be a
  1690.    representative sample of the cases that you want to generalize to. After
  1691.    training, run the network on the test set, and the error on the test set
  1692.    provides an unbiased estimate of the generalization error, provided that
  1693.    the test set was chosen randomly. The disadvantage of split-sample
  1694.    validation is that it reduces the amount of data available for both
  1695.    training and validation. See Weiss and Kulikowski (1991). 
  1696.  
  1697. Cross-validation (e.g., leave one out). 
  1698.    Cross-validation is an improvement on split-sample validation that allows
  1699.    you to use all of the data for training. The disadvantage of
  1700.    cross-validation is that you have to retrain the net many times. See 
  1701.    "What are cross-validation and bootstrapping?". 
  1702.  
  1703. Bootstrapping. 
  1704.    Bootstrapping is an improvement on cross-validation that often provides
  1705.    better estimates of generalization error at the cost of even more
  1706.    computing time. See "What are cross-validation and bootstrapping?". 
  1707.  
  1708. If you use any of the above methods to choose which of several different
  1709. networks to use for prediction purposes, the estimate of the generalization
  1710. error of the best network will be optimistic. For example, if you train
  1711. several networks using one data set, and use a second (validation set) data
  1712. set to decide which network is best, you must use a third (test set) data
  1713. set to obtain an unbiased estimate of the generalization error of the chosen
  1714. network. Hjorth (1994) explains how this principle extends to
  1715. cross-validation and bootstrapping. 
  1716.  
  1717. References: 
  1718.  
  1719.    Darlington, R.B. (1968), "Multiple Regression in Psychological Research
  1720.    and Practice," Psychological Bulletin, 69, 161-182. 
  1721.  
  1722.    Efron, B. (1986), "How biased is the apparent error rate of a prediction
  1723.    rule?" J. of the American Statistical Association, 81, 461-470. 
  1724.  
  1725.    Efron, B. and Tibshirani, R.J. (1993), An Introduction to the Bootstrap,
  1726.    London: Chapman & Hall. 
  1727.  
  1728.    Hjorth, J.S.U. (1994), Computer Intensive Statistical Methods:
  1729.    Validation, Model Selection, and Bootstrap, London: Chapman & Hall. 
  1730.  
  1731.    Miller, A.J. (1990), Subset Selection in Regression, London: Chapman &
  1732.    Hall. 
  1733.  
  1734.    Moody, J.E. (1992), "The Effective Number of Parameters: An Analysis of
  1735.    Generalization and Regularization in Nonlinear Learning Systems", in
  1736.    Moody, J.E., Hanson, S.J., and Lippmann, R.P., Advances in Neural
  1737.    Information Processing Systems 4, 847-854. 
  1738.  
  1739.    Raftery, A.E. (1995), "Bayesian Model Selection in Social Research," in
  1740.    Marsden, P.V. (ed.), Sociological Methodology 1995, Cambridge, MA:
  1741.    Blackwell, ftp://ftp.stat.washington.edu/pub/tech.reports/bic.ps.z or 
  1742.    http://www.stat.washington.edu/tech.reports/bic.ps 
  1743.  
  1744.    Rissanen, J. (1978), "Modelling by shortest data description,"
  1745.    Automatica, 14, 465-471. 
  1746.  
  1747.    Rissanen, J. (1987), "Stochastic complexity" (with discussion), J. of the
  1748.    Royal Statistical Society, Series B, 49, 223-239. 
  1749.  
  1750.    Rissanen, J. (1999), "Hypothesis Selection and Testing by the MDL
  1751.    Principle," Computer Journal, 42, 260-269, 
  1752.    http://www3.oup.co.uk/computer_journal/hdb/Volume_42/Issue_04/ 
  1753.  
  1754.    Sarle, W.S. (1995), "Stopped Training and Other Remedies for
  1755.    Overfitting," Proceedings of the 27th Symposium on the Interface of
  1756.    Computing Science and Statistics, 352-360, 
  1757.    ftp://ftp.sas.com/pub/neural/inter95.ps.Z (this is a very large
  1758.    compressed postscript file, 747K, 10 pages) 
  1759.  
  1760.    Sarle, W.S. (1999), "Donoho-Johnstone Benchmarks: Neural Net Results," 
  1761.    ftp://ftp.sas.com/pub/neural/dojo/dojo.html 
  1762.  
  1763.    Weiss, S.M. & Kulikowski, C.A. (1991), Computer Systems That Learn,
  1764.    Morgan Kaufmann. 
  1765.  
  1766. ------------------------------------------------------------------------
  1767.  
  1768. Subject: What are cross-validation and bootstrapping? 
  1769. ======================================================
  1770.  
  1771. Cross-validation and bootstrapping are both methods for estimating
  1772. generalization error based on "resampling" (Weiss and Kulikowski 1991; Efron
  1773. and Tibshirani 1993; Hjorth 1994; Plutowski, Sakata, and White 1994; Shao
  1774. and Tu 1995). The resulting estimates of generalization error are often used
  1775. for choosing among various models, such as different network architectures. 
  1776.  
  1777. Cross-validation
  1778. ++++++++++++++++
  1779.  
  1780. In k-fold cross-validation, you divide the data into k subsets of
  1781. (approximately) equal size. You train the net k times, each time leaving
  1782. out one of the subsets from training, but using only the omitted subset to
  1783. compute whatever error criterion interests you. If k equals the sample
  1784. size, this is called "leave-one-out" cross-validation. "Leave-v-out" is a
  1785. more elaborate and expensive version of cross-validation that involves
  1786. leaving out all possible subsets of v cases. 
  1787.  
  1788. Note that cross-validation is quite different from the "split-sample" or
  1789. "hold-out" method that is commonly used for early stopping in NNs. In the
  1790. split-sample method, only a single subset (the validation set) is used to
  1791. estimate the generalization error, instead of k different subsets; i.e.,
  1792. there is no "crossing". While various people have suggested that
  1793. cross-validation be applied to early stopping, the proper way of doing so is
  1794. not obvious. 
  1795.  
  1796. The distinction between cross-validation and split-sample validation is
  1797. extremely important because cross-validation is markedly superior for small
  1798. data sets; this fact is demonstrated dramatically by Goutte (1997) in a
  1799. reply to Zhu and Rohwer (1996). For an insightful discussion of the
  1800. limitations of cross-validatory choice among several learning methods, see
  1801. Stone (1977). 
  1802.  
  1803. Jackknifing
  1804. +++++++++++
  1805.  
  1806. Leave-one-out cross-validation is also easily confused with jackknifing.
  1807. Both involve omitting each training case in turn and retraining the network
  1808. on the remaining subset. But cross-validation is used to estimate
  1809. generalization error, while the jackknife is used to estimate the bias of a
  1810. statistic. In the jackknife, you compute some statistic of interest in each
  1811. subset of the data. The average of these subset statistics is compared with
  1812. the corresponding statistic computed from the entire sample in order to
  1813. estimate the bias of the latter. You can also get a jackknife estimate of
  1814. the standard error of a statistic. Jackknifing can be used to estimate the
  1815. bias of the training error and hence to estimate the generalization error,
  1816. but this process is more complicated than leave-one-out cross-validation
  1817. (Efron, 1982; Ripley, 1996, p. 73). 
  1818.  
  1819. Choice of cross-validation method
  1820. +++++++++++++++++++++++++++++++++
  1821.  
  1822. Cross-validation can be used simply to estimate the generalization error of
  1823. a given model, or it can be used for model selection by choosing one of
  1824. several models that has the smallest estimated generalization error. For
  1825. example, you might use cross-validation to choose the number of hidden
  1826. units, or you could use cross-validation to choose a subset of the inputs
  1827. (subset selection). A subset that contains all relevant inputs will be
  1828. called a "good" subsets, while the subset that contains all relevant inputs
  1829. but no others will be called the "best" subset. Note that subsets are "good"
  1830. and "best" in an asymptotic sense (as the number of training cases goes to
  1831. infinity). With a small training set, it is possible that a subset that is
  1832. smaller than the "best" subset may provide better generalization error. 
  1833.  
  1834. Leave-one-out cross-validation often works well for estimating
  1835. generalization error for continuous error functions such as the mean squared
  1836. error, but it may perform poorly for discontinuous error functions such as
  1837. the number of misclassified cases. In the latter case, k-fold
  1838. cross-validation is preferred. But if k gets too small, the error estimate
  1839. is pessimistically biased because of the difference in training-set size
  1840. between the full-sample analysis and the cross-validation analyses. (For
  1841. model-selection purposes, this bias can actually help; see the discussion
  1842. below of Shao, 1993.) A value of 10 for k is popular for estimating
  1843. generalization error. 
  1844.  
  1845. Leave-one-out cross-validation can also run into trouble with various
  1846. model-selection methods. Again, one problem is lack of continuity--a small
  1847. change in the data can cause a large change in the model selected (Breiman,
  1848. 1996). For choosing subsets of inputs in linear regression, Breiman and
  1849. Spector (1992) found 10-fold and 5-fold cross-validation to work better than
  1850. leave-one-out. Kohavi (1995) also obtained good results for 10-fold
  1851. cross-validation with empirical decision trees (C4.5). Values of k as small
  1852. as 5 or even 2 may work even better if you analyze several different random 
  1853. k-way splits of the data to reduce the variability of the cross-validation
  1854. estimate. 
  1855.  
  1856. Leave-one-out cross-validation also has more subtle deficiencies for model
  1857. selection. Shao (1995) showed that in linear models, leave-one-out
  1858. cross-validation is asymptotically equivalent to AIC (and Mallows' C_p), but
  1859. leave-v-out cross-validation is asymptotically equivalent to Schwarz's
  1860. Bayesian criterion (called SBC or BIC) when v =
  1861. n[1-1/(log(n)-1)], where n is the number of training cases. SBC
  1862. provides consistent subset-selection, while AIC does not. That is, SBC will
  1863. choose the "best" subset with probability approaching one as the size of the
  1864. training set goes to infinity. AIC has an asymptotic probability of one of
  1865. choosing a "good" subset, but less than one of choosing the "best" subset
  1866. (Stone, 1979). Many simulation studies have also found that AIC overfits
  1867. badly in small samples, and that SBC works well (e.g., Hurvich and Tsai,
  1868. 1989; Shao and Tu, 1995). Hence, these results suggest that leave-one-out
  1869. cross-validation should overfit in small samples, but leave-v-out
  1870. cross-validation with appropriate v should do better. However, when true
  1871. models have an infinite number of parameters, SBC is not efficient, and
  1872. other criteria that are asymptotically efficient but not consistent for
  1873. model selection may produce better generalization (Hurvich and Tsai, 1989). 
  1874.  
  1875. Shao (1993) obtained the surprising result that for selecting subsets of
  1876. inputs in a linear regression, the probability of selecting the "best" does
  1877. not converge to 1 (as the sample size n goes to infinity) for leave-v-out
  1878. cross-validation unless the proportion v/n approaches 1. At first glance,
  1879. Shao's result seems inconsistent with the analysis by Kearns (1997) of
  1880. split-sample validation, which shows that the best generalization is
  1881. obtained with v/n strictly between 0 and 1, with little sensitivity to the
  1882. precise value of v/n for large data sets. But the apparent conflict is due
  1883. to the fundamentally different properties of cross-validation and
  1884. split-sample validation. 
  1885.  
  1886. To obtain an intuitive understanding of Shao (1993), let's review some
  1887. background material on generalization error. Generalization error can be
  1888. broken down into three additive parts, noise variance + estimation variance
  1889. + squared estimation bias. Noise variance is the same for all subsets of
  1890. inputs. Bias is nonzero for subsets that are not "good", but it's zero for
  1891. all "good" subsets, since we are assuming that the function to be learned is
  1892. linear. Hence the generalization error of "good" subsets will differ only in
  1893. the estimation variance. The estimation variance is (2p/t)s^2 where p
  1894. is the number of inputs in the subset, t is the training set size, and s^2
  1895. is the noise variance. The "best" subset is better than other "good" subsets
  1896. only because the "best" subset has (by definition) the smallest value of p.
  1897. But the t in the denominator means that differences in generalization error
  1898. among the "good" subsets will all go to zero as t goes to infinity.
  1899. Therefore it is difficult to guess which subset is "best" based on the
  1900. generalization error even when t is very large. It is well known that
  1901. unbiased estimates of the generalization error, such as those based on AIC,
  1902. FPE, and C_p, do not produce consistent estimates of the "best" subset
  1903. (e.g., see Stone, 1979). 
  1904.  
  1905. In leave-v-out cross-validation, t=n-v. The differences of the
  1906. cross-validation estimates of generalization error among the "good" subsets
  1907. contain a factor 1/t, not 1/n. Therefore by making t small enough (and
  1908. thereby making each regression based on t cases bad enough), we can make
  1909. the differences of the cross-validation estimates large enough to detect. It
  1910. turns out that to make t small enough to guess the "best" subset
  1911. consistently, we have to have t/n go to 0 as n goes to infinity. 
  1912.  
  1913. The crucial distinction between cross-validation and split-sample validation
  1914. is that with cross-validation, after guessing the "best" subset, we train
  1915. the linear regression model for that subset using all n cases, but with
  1916. split-sample validation, only t cases are ever used for training. If our
  1917. main purpose were really to choose the "best" subset, I suspect we would
  1918. still have to have t/n go to 0 even for split-sample validation. But
  1919. choosing the "best" subset is not the same thing as getting the best
  1920. generalization. If we are more interested in getting good generalization
  1921. than in choosing the "best" subset, we do not want to make our regression
  1922. estimate based on only t cases as bad as we do in cross-validation, because
  1923. in split-sample validation that bad regression estimate is what we're stuck
  1924. with. So there is no conflict between Shao and Kearns, but there is a
  1925. conflict between the two goals of choosing the "best" subset and getting the
  1926. best generalization in split-sample validation. 
  1927.  
  1928. Bootstrapping
  1929. +++++++++++++
  1930.  
  1931. Bootstrapping seems to work better than cross-validation in many cases
  1932. (Efron, 1983). In the simplest form of bootstrapping, instead of repeatedly
  1933. analyzing subsets of the data, you repeatedly analyze subsamples of the
  1934. data. Each subsample is a random sample with replacement from the full
  1935. sample. Depending on what you want to do, anywhere from 50 to 2000
  1936. subsamples might be used. There are many more sophisticated bootstrap
  1937. methods that can be used not only for estimating generalization error but
  1938. also for estimating confidence bounds for network outputs (Efron and
  1939. Tibshirani 1993). For estimating generalization error in classification
  1940. problems, the .632+ bootstrap (an improvement on the popular .632 bootstrap)
  1941. is one of the currently favored methods that has the advantage of performing
  1942. well even when there is severe overfitting. Use of bootstrapping for NNs is
  1943. described in Baxt and White (1995), Tibshirani (1996), and Masters (1995).
  1944. However, the results obtained so far are not very thorough, and it is known
  1945. that bootstrapping does not work well for some other methodologies such as
  1946. empirical decision trees (Breiman, Friedman, Olshen, and Stone, 1984;
  1947. Kohavi, 1995), for which it can be excessively optimistic. 
  1948.  
  1949. For further information
  1950. +++++++++++++++++++++++
  1951.  
  1952. Cross-validation and bootstrapping become considerably more complicated for
  1953. time series data; see Hjorth (1994) and Snijders (1988). 
  1954.  
  1955. More information on jackknife and bootstrap confidence intervals is
  1956. available at ftp://ftp.sas.com/pub/neural/jackboot.sas (this is a plain-text
  1957. file). 
  1958.  
  1959. References: 
  1960.  
  1961.    Baxt, W.G. and White, H. (1995) "Bootstrapping confidence intervals for
  1962.    clinical input variable effects in a network trained to identify the
  1963.    presence of acute myocardial infarction", Neural Computation, 7, 624-638.
  1964.  
  1965.    Breiman, L. (1996), "Heuristics of instability and stabilization in model
  1966.    selection," Annals of Statistics, 24, 2350-2383. 
  1967.  
  1968.    Breiman, L., Friedman, J.H., Olshen, R.A. and Stone, C.J. (1984), 
  1969.    Classification and Regression Trees, Belmont, CA: Wadsworth. 
  1970.  
  1971.    Breiman, L., and Spector, P. (1992), "Submodel selection and evaluation
  1972.    in regression: The X-random case," International Statistical Review, 60,
  1973.    291-319. 
  1974.  
  1975.    Dijkstra, T.K., ed. (1988), On Model Uncertainty and Its Statistical
  1976.    Implications, Proceedings of a workshop held in Groningen, The
  1977.    Netherlands, September 25-26, 1986, Berlin: Springer-Verlag. 
  1978.  
  1979.    Efron, B. (1982) The Jackknife, the Bootstrap and Other Resampling
  1980.    Plans, Philadelphia: SIAM. 
  1981.  
  1982.    Efron, B. (1983), "Estimating the error rate of a prediction rule:
  1983.    Improvement on cross-validation," J. of the American Statistical
  1984.    Association, 78, 316-331. 
  1985.  
  1986.    Efron, B. and Tibshirani, R.J. (1993), An Introduction to the Bootstrap,
  1987.    London: Chapman & Hall. 
  1988.  
  1989.    Efron, B. and Tibshirani, R.J. (1997), "Improvements on cross-validation:
  1990.    The .632+ bootstrap method," J. of the American Statistical Association,
  1991.    92, 548-560. 
  1992.  
  1993.    Goutte, C. (1997), "Note on free lunches and cross-validation," Neural
  1994.    Computation, 9, 1211-1215,
  1995.    ftp://eivind.imm.dtu.dk/dist/1997/goutte.nflcv.ps.gz. 
  1996.  
  1997.    Hjorth, J.S.U. (1994), Computer Intensive Statistical Methods Validation,
  1998.    Model Selection, and Bootstrap, London: Chapman & Hall. 
  1999.  
  2000.    Hurvich, C.M., and Tsai, C.-L. (1989), "Regression and time series model
  2001.    selection in small samples," Biometrika, 76, 297-307. 
  2002.  
  2003.    Kearns, M. (1997), "A bound on the error of cross validation using the
  2004.    approximation and estimation rates, with consequences for the
  2005.    training-test split," Neural Computation, 9, 1143-1161. 
  2006.  
  2007.    Kohavi, R. (1995), "A study of cross-validation and bootstrap for
  2008.    accuracy estimation and model selection," International Joint Conference
  2009.    on Artificial Intelligence (IJCAI), pp. ?, 
  2010.    http://robotics.stanford.edu/users/ronnyk/ 
  2011.  
  2012.    Masters, T. (1995) Advanced Algorithms for Neural Networks: A C++
  2013.    Sourcebook, NY: John Wiley and Sons, ISBN 0-471-10588-0 
  2014.  
  2015.    Plutowski, M., Sakata, S., and White, H. (1994), "Cross-validation
  2016.    estimates IMSE," in Cowan, J.D., Tesauro, G., and Alspector, J. (eds.) 
  2017.    Advances in Neural Information Processing Systems 6, San Mateo, CA:
  2018.    Morgan Kaufman, pp. 391-398. 
  2019.  
  2020.    Ripley, B.D. (1996) Pattern Recognition and Neural Networks, Cambridge:
  2021.    Cambridge University Press. 
  2022.  
  2023.    Shao, J. (1993), "Linear model selection by cross-validation," J. of the
  2024.    American Statistical Association, 88, 486-494. 
  2025.  
  2026.    Shao, J. (1995), "An asymptotic theory for linear model selection,"
  2027.    Statistica Sinica ?. 
  2028.  
  2029.    Shao, J. and Tu, D. (1995), The Jackknife and Bootstrap, New York:
  2030.    Springer-Verlag. 
  2031.  
  2032.    Snijders, T.A.B. (1988), "On cross-validation for predictor evaluation in
  2033.    time series," in Dijkstra (1988), pp. 56-69. 
  2034.  
  2035.    Stone, M. (1977), "Asymptotics for and against cross-validation,"
  2036.    Biometrika, 64, 29-35. 
  2037.  
  2038.    Stone, M. (1979), "Comments on model selection criteria of Akaike and
  2039.    Schwarz," J. of the Royal Statistical Society, Series B, 41, 276-278. 
  2040.  
  2041.    Tibshirani, R. (1996), "A comparison of some error estimates for neural
  2042.    network models," Neural Computation, 8, 152-163. 
  2043.  
  2044.    Weiss, S.M. and Kulikowski, C.A. (1991), Computer Systems That Learn,
  2045.    Morgan Kaufmann. 
  2046.  
  2047.    Zhu, H., and Rohwer, R. (1996), "No free lunch for cross-validation,"
  2048.    Neural Computation, 8, 1421-1426. 
  2049.  
  2050. ------------------------------------------------------------------------
  2051.  
  2052. Subject: How to compute prediction and confidence
  2053. =================================================
  2054. intervals (error bars)?
  2055. =======================
  2056.  
  2057. (This answer is only about half finished. I will get around to the other
  2058. half eventually.) 
  2059.  
  2060. In addition to estimating over-all generalization error, it is often useful
  2061. to be able to estimate the accuracy of the network's predictions for
  2062. individual cases. 
  2063.  
  2064. Let: 
  2065.  
  2066.    Y      = the target variable
  2067.    y_i    = the value of Y for the ith case
  2068.    X      = the vector of input variables
  2069.    x_i    = the value of X for the ith case
  2070.    N      = the noise in the target variable
  2071.    n_i    = the value of N for the ith case
  2072.    m(X)   = E(Y|X) = the conditional mean of Y given X
  2073.    w      = a vector of weights for a neural network
  2074.    w^     = the weight obtained via training the network
  2075.    p(X,w) = the output of a neural network given input X and weights w
  2076.    p_i    = p(x_i,w)
  2077.    L      = the number of training (learning) cases, (y_i,x_i), i=1, ..., L
  2078.    Q(w)   = the objective function
  2079.  
  2080. Assume the data are generated by the model: 
  2081.  
  2082.    Y = m(X) + N
  2083.    E(N|X) = 0
  2084.    N and X are independent
  2085.  
  2086. The network is trained by attempting to minimize the objective function 
  2087. Q(w), which, for example, could be the sum of squared errors or the
  2088. negative log likelihood based on an assumed family of noise distributions. 
  2089.  
  2090. Given a test input x_0, a 100c% prediction interval for y_0 is an
  2091. interval [LPB_0,UPB_0] such that Pr(LPB_0 <= y_0 <=
  2092. UPB_0) = c, where c is typically .95 or .99, and the probability is
  2093. computed over repeated random selection of the training set and repeated
  2094. observation of Y given the test input x_0. A 100c% confidence interval
  2095. for p_0 is an interval [LCB_0,UCB_0] such that Pr(LCB_0 <=
  2096. p_0 <= UCB_0) = c, where again the probability is computed over
  2097. repeated random selection of the training set. Note that p_0 is a
  2098. nonrandom quantity, since x_0 is given. A confidence interval is narrower
  2099. than the corresponding prediction interval, since the prediction interval
  2100. must include variation due to noise in y_0, while the confidence interval
  2101. does not. Both intervals include variation due to sampling of the training
  2102. set and possible variation in the training process due, for example, to
  2103. random initial weights and local minima of the objective function. 
  2104.  
  2105. Traditional statistical methods for nonlinear models depend on several
  2106. assumptions (Gallant, 1987): 
  2107.  
  2108. 1. The inputs for the training cases are either fixed or obtained by simple
  2109.    random sampling or some similarly well-behaved process. 
  2110. 2. Q(w) has continuous first and second partial derivatives with respect
  2111.    to w over some convex, bounded subset S_W of the weight space. 
  2112. 3. Q(w) has a unique global minimum at w^, which is an interior point of
  2113.    S_W. 
  2114. 4. The model is well-specified, which requires (a) that there exist weights 
  2115.    w$ in the interior of S_W such that m(x) = p(x,w$), and (b)
  2116.    that the assumptions about the noise distribution are correct. (Sorry
  2117.    about the w$ notation, but I'm running out of plain text symbols.) 
  2118.  
  2119. These traditional methods are based on a linear approximation to p(x,w)
  2120. in a neighborhood of w$, yielding a quadratic approximation to Q(w).
  2121. Hence the Hessian of Q(w) (the square matrix of second-order partial
  2122. derivatives with respect to w) frequently appears in these methods. 
  2123.  
  2124. Assumption (3) is not satisfied for neural nets, because networks with
  2125. hidden units always have multiple global minima, and the global minima are
  2126. often improper. Hence, confidence intervals for the weights cannot be
  2127. obtained using standard Hessian-based methods. However, Hwang and Ding
  2128. (1997) have shown that confidence intervals for predicted values can be
  2129. obtained because the predicted values are statistically identified even
  2130. though the weights are not. 
  2131.  
  2132. Cardell, Joerding, and Li (1994) describe a more serious violation of
  2133. assumption (3), namely that that for some m(x), no finite global minimum
  2134. exists. In such situations, it may be possible to use regularization methods
  2135. such as weight decay to obtain valid confidence intervals (De Veaux, Schumi,
  2136. Schweinsberg, and Ungar, 1998), but more research is required on this
  2137. subject, since the derivation in the cited paper assumes a finite global
  2138. minimum. 
  2139.  
  2140. For large samples, the sampling variability in w^ can be approximated in
  2141. various ways: 
  2142.  
  2143.  o Fisher's information matrix, which is the expected value of the Hessian
  2144.    of Q(w) divided by L, can be used when Q(w) is the negative log
  2145.    likelihood (Spall, 1998). 
  2146.  o The delta method, based on the Hessian of Q(w) or the Gauss-Newton
  2147.    approximation using the cross-product Jacobian of Q(w), can also be
  2148.    used when Q(w) is the negative log likelihood (Tibshirani, 1996; Hwang
  2149.    and Ding, 1997; De Veaux, Schumi, Schweinsberg, and Ungar, 1998). 
  2150.  o The sandwich estimator, a more elaborate Hessian-based method, relaxes
  2151.    assumption (4) (Gallant, 1987; White, 1989; Tibshirani, 1996). 
  2152.  o Bootstrapping can be used without knowing the form of the noise
  2153.    distribution and takes into account variability introduced by local
  2154.    minima in training, but requires training the network many times on
  2155.    different resamples of the training set (Tibshirani, 1996; Heskes 1997). 
  2156.  
  2157. References: 
  2158.  
  2159.    Cardell, N.S., Joerding, W., and Li, Y. (1994), "Why some feedforward
  2160.    networks cannot learn some polynomials," Neural Computation, 6, 761-766. 
  2161.  
  2162.    De Veaux,R.D., Schumi, J., Schweinsberg, J., and Ungar, L.H. (1998),
  2163.    "Prediction intervals for neural networks via nonlinear regression,"
  2164.    Technometrics, 40, 273-282. 
  2165.  
  2166.    Gallant, A.R. (1987) Nonlinear Statistical Models, NY: Wiley. 
  2167.  
  2168.    Heskes, T. (1997), "Practical confidence and prediction intervals," in
  2169.    Mozer, M.C., Jordan, M.I., and Petsche, T., (eds.) Advances in Neural
  2170.    Information Processing Systems 9, Cambrideg, MA: The MIT Press, pp.
  2171.    176-182. 
  2172.  
  2173.    Hwang, J.T.G., and Ding, A.A. (1997), "Prediction intervals for
  2174.    artificial neural networks," J. of the American Statistical Association,
  2175.    92, 748-757. 
  2176.  
  2177.    Nix, D.A., and Weigend, A.S. (1995), "Learning local error bars for
  2178.    nonlinear regression," in Tesauro, G., Touretzky, D., and Leen, T.,
  2179.    (eds.) Advances in Neural Information Processing Systems 7, Cambridge,
  2180.    MA: The MIT Press, pp. 489-496. 
  2181.  
  2182.    Spall, J.C. (1998), "Resampling-based calculation of the information
  2183.    matrix in nonlinear statistical models," Proceedings of the 4th Joint
  2184.    Conference on Information Sciences, October 23-28, Research Triangle
  2185.    PArk, NC, USA, Vol 4, pp. 35-39. 
  2186.  
  2187.    Tibshirani, R. (1996), "A comparison of some error estimates for neural
  2188.    network models," Neural Computation, 8, 152-163. 
  2189.  
  2190.    White, H. (1989), "Some Asymptotic Results for Learning in Single Hidden
  2191.    Layer Feedforward Network Models", J. of the American Statistical Assoc.,
  2192.    84, 1008-1013. 
  2193.  
  2194. ------------------------------------------------------------------------
  2195.  
  2196. Next part is part 4 (of 7). Previous part is part 2. 
  2197.  
  2198. -- 
  2199.  
  2200. Warren S. Sarle       SAS Institute Inc.   The opinions expressed here
  2201. saswss@unx.sas.com    SAS Campus Drive     are mine and not necessarily
  2202. (919) 677-8000        Cary, NC 27513, USA  those of SAS Institute.
  2203.