Mercurial > pylearn
annotate doc/v2_planning/learn_meeting.py @ 1170:53340a8df1fa
coding_style: Started to write full code sample
author | Olivier Delalleau <delallea@iro> |
---|---|
date | Fri, 17 Sep 2010 14:37:00 -0400 |
parents | 8c448829db30 |
children |
rev | line source |
---|---|
1087
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
1 |
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 def bagging(learner_factory): |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
4 for i in range(N): |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
5 learner_i = learner_factory.new() |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
6 # todo: get dataset_i ?? |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
7 learner_i.use_dataset(dataset_i) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
8 learner_i.train() |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
9 ''' |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
10 List of tasks types: |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
11 Attributes |
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 sequential |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
14 spatial |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
15 structured |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
16 semi-supervised |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
17 missing-values |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
18 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
19 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
20 Supervised (x,y) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
21 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
22 classification |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
23 regression |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
24 probabilistic classification |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
25 ranking |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
26 conditional density estimation |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
27 collaborative filtering |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
28 ordinal regression ?= ranking |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
29 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
30 Unsupervised (x) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
31 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
32 de-noising |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
33 feature learning ( transformation ) PCA, DAA |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
34 density estimation |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
35 inference |
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 Other |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
38 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
39 generation (sampling) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
40 structure learning ??? |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
41 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
42 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
43 Notes on metrics & statistics: |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
44 - 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
|
45 - most statistics are on the dataset |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
46 ''' |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
47 class Learner(Object): |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
48 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
49 #def use_dataset(dataset) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
50 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
51 # return a dictionary of hyperparameters names(keys) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
52 # and value(values) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
53 def get_hyper_parameters() |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
54 def set_hyper_parameters(dictionary) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
55 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
56 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
57 |
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 # Ver B |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
60 def eval(dataset) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
61 def predict(dataset) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
62 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
63 # Trainable |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
64 def train(dataset) # train until complition |
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 # Incremental |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
67 def use_dataset(dataset) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
68 def adapt(n_steps =1) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
69 def has_converged() |
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 # |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
72 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
73 class HyperLearner(Learner): |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
74 |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
75 ### def get_hyper_parameter_distribution(name) |
8c448829db30
learning committee first draft of an api
Razvan Pascanu <r.pascanu@gmail.com>
parents:
diff
changeset
|
76 def set_hyper_parameters_distribution(dictionary) |