Mercurial > pylearn
comparison learner.py @ 20:266c68cb6136
Minor editions, plus adding untested ApplyFunctionDataset for GradientLearner in the works.
author | bengioy@bengiomac.local |
---|---|
date | Mon, 07 Apr 2008 09:48:39 -0400 |
parents | 5ede27026e05 |
children | 90e4c0784d6e |
comparison
equal
deleted
inserted
replaced
19:57f4015e2e09 | 20:266c68cb6136 |
---|---|
34 some statistics of the outputs computed during training. | 34 some statistics of the outputs computed during training. |
35 """ | 35 """ |
36 return self.use # default behavior is 'non-adaptive', i.e. update does not do anything | 36 return self.use # default behavior is 'non-adaptive', i.e. update does not do anything |
37 | 37 |
38 | 38 |
39 def __call__(self,training_set): | 39 def __call__(self,training_set,train_stats_collector=None): |
40 """ | 40 """ |
41 Train a learner from scratch using the provided training set, | 41 Train a learner from scratch using the provided training set, |
42 and return the learned function. | 42 and return the learned function. |
43 """ | 43 """ |
44 self.forget() | 44 self.forget() |
45 return self.update(learning_task) | 45 return self.update(learning_task,train_stats_collector) |
46 | 46 |
47 | 47 def use(self,input_dataset,output_fields=None,copy_inputs=True): |
48 def use(self,input_dataset,output_fields=None): | |
49 """Once a Learner has been trained by one or more call to 'update', it can | 48 """Once a Learner has been trained by one or more call to 'update', it can |
50 be used with one or more calls to 'use'. The argument is a DataSet (possibly | 49 be used with one or more calls to 'use'. The argument is a DataSet (possibly |
51 containing a single example) and the result is a DataSet of the same length. | 50 containing a single example) and the result is a DataSet of the same length. |
52 If output_fields is specified, it may be use to indicate which fields should | 51 If output_fields is specified, it may be use to indicate which fields should |
53 be constructed in the output DataSet (for example ['output','classification_error']). | 52 be constructed in the output DataSet (for example ['output','classification_error']). |
53 Optionally, if copy_inputs, the input fields (of the input_dataset) can be made | |
54 visible in the output DataSet returned by this function. | |
54 """ | 55 """ |
55 raise NotImplementedError | 56 raise NotImplementedError |