comparison learner.py @ 78:3499918faa9d

In the middle of designing TLearner
author bengioy@bengiomac.local
date Mon, 05 May 2008 09:35:30 -0400
parents 1e2bb5bad636
children c4726e19b8ec
comparison
equal deleted inserted replaced
77:1e2bb5bad636 78:3499918faa9d
55 Optionally, if copy_inputs, the input fields (of the input_dataset) can be made 55 Optionally, if copy_inputs, the input fields (of the input_dataset) can be made
56 visible in the output DataSet returned by this method. 56 visible in the output DataSet returned by this method.
57 """ 57 """
58 raise NotImplementedError 58 raise NotImplementedError
59 59
60 def attribute_names(self):
61 """
62 A Learner may have attributes that it wishes to export to other objects. To automate
63 such export, sub-classes should define here the names (list of strings) of these attributes.
64 """
65 return []
60 66
67 class TLearner(Learner):
68 """
69 TLearner is a virtual class of Learners that attempts to factor out of the definition
70 of a learner the steps that are common to many implementations of learning algorithms,
71 so as to leave only "the equations" to define in particular sub-classes, using Theano.
72
73 In the default implementations of use and update, it is assumed that the 'use' and 'update' methods
74 visit examples in the input dataset sequentially. In the 'use' method only one pass through the dataset is done,
75 whereas the sub-learner may wish to iterate over the examples multiple times. Subclasses where this
76 basic model is not appropriate can simply redefine update or use.
77
78 Sub-classes must provide the following functions and functionalities:
79 - attributeNames(): defines all the names of attributes which can be used as fields or
80 attributes in input/output datasets or in stats collectors.
81 All these attributes are expected to be theano.Result objects
82 (with a .data property and recognized by theano.Function for compilation).
83 The sub-class constructor defines the relations between
84 the Theano variables that may be used by 'use' and 'update'
85 or by a stats collector.
86 - defaultOutputFields(input_fields): return a list of default dataset output fields when
87 None are provided by the caller of use.
88 -
89
90 """
91