comparison learner.py @ 13:633453635d51

Starting to work on gradient_based_learner.py
author bengioy@bengiomac.local
date Wed, 26 Mar 2008 21:38:08 -0400
parents 80bf5492e571
children 5ede27026e05
comparison
equal deleted inserted replaced
12:ff4e551490f1 13:633453635d51
1 1
2 from dataset import * 2 from dataset import *
3 from statscollector import *
4 3
5 class Learner(object): 4 class Learner(object):
6 """Base class for learning algorithms, provides an interface 5 """Base class for learning algorithms, provides an interface
7 that allows various algorithms to be applicable to generic learning 6 that allows various algorithms to be applicable to generic learning
8 algorithms. 7 algorithms.
30 Hence update can be called multiple times. This is particularly useful in the 29 Hence update can be called multiple times. This is particularly useful in the
31 on-line setting or the sequential (Bayesian or not) settings. 30 on-line setting or the sequential (Bayesian or not) settings.
32 The result is a function that can be applied on data, with the same 31 The result is a function that can be applied on data, with the same
33 semantics of the Learner.use method. 32 semantics of the Learner.use method.
34 """ 33 """
35 return self.use 34 return self.use # default behavior is 'non-adaptive', i.e. update does not do anything
36 35
37 36
38 def __call__(self,training_set): 37 def __call__(self,training_set):
39 """ 38 """
40 Train a learner from scratch using the provided training set, 39 Train a learner from scratch using the provided training set,