Mercurial > pylearn
comparison doc/v2_planning/learner.txt @ 1002:f82093bf4405
adding learner.txt and dataset.txt in v2_planning/
author | Yoshua Bengio <bengioy@iro.umontreal.ca> |
---|---|
date | Wed, 01 Sep 2010 16:43:24 -0400 |
parents | |
children | 38f799f8b6cd |
comparison
equal
deleted
inserted
replaced
1001:660d784d14c7 | 1002:f82093bf4405 |
---|---|
1 | |
2 Discussion of Function Specification for Learner Types | |
3 ====================================================== | |
4 | |
5 In its most abstract form, a learner is an object with the | |
6 following semantics: | |
7 | |
8 * A learner has named hyper-parameters that control how it learns (these can be viewed | |
9 as options of the constructor, or might be set directly by a user) | |
10 | |
11 * A learner also has an internal state that depends on what it has learned. | |
12 | |
13 * A learner reads and produces data, so the definition of learner is | |
14 intimately linked to the definition of dataset (and task). | |
15 | |
16 * A learner has one or more 'train' or 'adapt' functions by which | |
17 it is given a sample of data (typically either the whole training set, or | |
18 a mini-batch, which contains as a special case a single 'example'). Learners | |
19 interface with datasets in order to obtain data. These functions cause the | |
20 learner to change its internal state and take advantage to some extent | |
21 of the data provided. The 'train' function should take charge of | |
22 completely exploiting the dataset, as specified per the hyper-parameters, | |
23 so that it would typically be called only once. An 'adapt' function | |
24 is meant for learners that can operate in an 'online' setting where | |
25 data continually arrive and the control loop (when to stop) is to | |
26 be managed outside of it. For most intents and purposes, the | |
27 'train' function could also handle the 'online' case by providing | |
28 the controlled iterations over the dataset (which would then be | |
29 seen as a stream of examples). | |
30 * learner.train(dataset) | |
31 * learner.adapt(data) | |
32 | |
33 * Different types of learners can then exploit their internal state | |
34 in order to perform various computations after training is completed, | |
35 or in the middle of training, e.g., | |
36 | |
37 * y=learner.predict(x) | |
38 for learners that see (x,y) pairs during training and predict y given x, | |
39 or for learners that see only x's and learn a transformation of it (i.e. feature extraction). | |
40 Here and below, x and y are tensor-like objects whose first index iterates | |
41 over particular examples in a batch or minibatch of examples. | |
42 | |
43 * p=learner.probability(examples) | |
44 p=learner.log_probability(examples) | |
45 for learners that can estimate probability density or probability functions, | |
46 note that example could be a pair (x,y) for learners that expect each example | |
47 to represent such a pair. The second form is provided in case the example | |
48 is high-dimensional and computations in the log-domain are numerically preferable. | |
49 The first dimension of examples or of x and y is an index over a minibatch or a dataset. | |
50 | |
51 * p=learner.free_energy(x) | |
52 for learners that can estimate a log unnormalized probability; the output has the same length as the input. | |
53 | |
54 * c=learner.costs(examples) | |
55 returns a matrix of costs (one row per example, i.e., again the output has the same length | |
56 as the input), the first column of which represents the cost whose expectation | |
57 we wish to minimize over new samples from the unknown underlying data distribution. | |
58 | |
59 | |
60 Some learners may be able to handle x's and y's that contain missing values. | |
61 | |
62 * For convenience, some of these operations could be bundled, e.g. | |
63 | |
64 * [prediction,costs] = learner.predict_and_adapt((x,y)) | |
65 | |
66 * Some learners could include in their internal state not only what they | |
67 have learned but some information about recently seen examples that conditions | |
68 the expected distribution of upcoming examples. In that case, they might | |
69 be used, e.g. in an online setting as follows: | |
70 for (x,y) in data_stream: | |
71 [prediction,costs]=learner.predict((x,y)) | |
72 accumulate_statistics(prediction,costs) | |
73 | |
74 * In some cases, each example is itself a (possibly variable-size) sequence | |
75 or other variable-size object (e.g. an image, or a video) | |
76 | |
77 | |
78 |