Mercurial > pylearn
annotate doc/v2_planning/API_learner.txt @ 1174:fe6c25eb1e37
merge
author | pascanur |
---|---|
date | Fri, 17 Sep 2010 16:13:58 -0400 |
parents | 77b6ed85d3f7 |
children | 805e7c369fd1 |
rev | line source |
---|---|
1168
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
1 # A list of "task types" |
1087
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
2 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
3 ''' |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
4 List of tasks types: |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
5 Attributes |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
6 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
7 sequential |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
8 spatial |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
9 structured |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
10 semi-supervised |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
11 missing-values |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
12 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
13 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
14 Supervised (x,y) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
15 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
16 classification |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
17 regression |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
18 probabilistic classification |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
19 ranking |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
20 conditional density estimation |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
21 collaborative filtering |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
22 ordinal regression ?= ranking |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
23 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
24 Unsupervised (x) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
25 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
26 de-noising |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
27 feature learning ( transformation ) PCA, DAA |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
28 density estimation |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
29 inference |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
30 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
31 Other |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
32 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
33 generation (sampling) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
34 structure learning ??? |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
35 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
36 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
37 Notes on metrics & statistics: |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
38 - some are applied to an example, others on a batch |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
39 - most statistics are on the dataset |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
40 ''' |
1168
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
41 |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
42 |
1087
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
43 class Learner(Object): |
1168
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
44 ''' |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
45 Takes data as inputs, and learns a prediction function (or several). |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
46 |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
47 A learner is parametrized by hyper-parameters, which can be set from the |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
48 outside (a "client" from Learner, that can be a HyperLearner, a |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
49 Tester,...). |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
50 |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
51 The data can be given all at a time as a data set, or incrementally. |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
52 Some learner need to be fully trained in one step, whereas other can be |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
53 trained incrementally. |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
54 |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
55 The question of statistics collection during training remains open. |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
56 ''' |
1087
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
57 #def use_dataset(dataset) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
58 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
59 # return a dictionary of hyperparameters names(keys) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
60 # and value(values) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
61 def get_hyper_parameters() |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
62 def set_hyper_parameters(dictionary) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
63 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
64 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
65 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
66 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
67 # Ver B |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
68 def eval(dataset) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
69 def predict(dataset) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
70 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
71 # Trainable |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
72 def train(dataset) # train until complition |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
73 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
74 # Incremental |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
75 def use_dataset(dataset) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
76 def adapt(n_steps =1) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
77 def has_converged() |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
78 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
79 # |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
80 |
1168
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
81 |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
82 # Some example cases |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
83 |
1087
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
84 class HyperLearner(Learner): |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
85 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
86 ### def get_hyper_parameter_distribution(name) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
87 def set_hyper_parameters_distribution(dictionary) |
1168
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
88 |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
89 |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
90 def bagging(learner_factory): |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
91 for i in range(N): |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
92 learner_i = learner_factory.new() |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
93 # todo: get dataset_i ?? |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
94 learner_i.use_dataset(dataset_i) |
77b6ed85d3f7
Update doc of learner's API
Pascal Lamblin <lamblinp@iro.umontreal.ca>
parents:
1167
diff
changeset
|
95 learner_i.train() |