Mercurial > pylearn
comparison linear_regression.py @ 421:e01f17be270a
Kernel regression learning algorithm
author | Yoshua Bengio <bengioy@iro.umontreal.ca> |
---|---|
date | Sat, 19 Jul 2008 10:11:22 -0400 |
parents | 43d9aa93934e |
children | fa4a5fee53ce |
comparison
equal
deleted
inserted
replaced
420:040cb796f4e0 | 421:e01f17be270a |
---|---|
32 The training_set must have fields "input" and "target". | 32 The training_set must have fields "input" and "target". |
33 The test_set must have field "input", and needs "target" if | 33 The test_set must have field "input", and needs "target" if |
34 we want to compute the squared errors. | 34 we want to compute the squared errors. |
35 | 35 |
36 The predictor parameters are obtained analytically from the training set. | 36 The predictor parameters are obtained analytically from the training set. |
37 | |
38 *** NOT IMPLEMENTED YET *** | |
37 Training can proceed sequentially (with multiple calls to update with | 39 Training can proceed sequentially (with multiple calls to update with |
38 different disjoint subsets of the training sets). After each call to | 40 different disjoint subsets of the training sets). After each call to |
39 update the predictor is ready to be used (and optimized for the union | 41 update the predictor is ready to be used (and optimized for the union |
40 of all the training sets passed to update since construction or since | 42 of all the training sets passed to update since construction or since |
41 the last call to forget). | 43 the last call to forget). |
42 | 44 *************************** |
45 | |
43 For each (input[t],output[t]) pair in a minibatch,:: | 46 For each (input[t],output[t]) pair in a minibatch,:: |
44 | 47 |
45 output_t = b + W * input_t | 48 output_t = b + W * input_t |
46 | 49 |
47 where b and W are obtained by minimizing:: | 50 where b and W are obtained by minimizing:: |
72 = example-wise squared error | 75 = example-wise squared error |
73 """ | 76 """ |
74 def __init__(self, L2_regularizer=0,minibatch_size=10000): | 77 def __init__(self, L2_regularizer=0,minibatch_size=10000): |
75 self.L2_regularizer=L2_regularizer | 78 self.L2_regularizer=L2_regularizer |
76 self.equations = LinearRegressionEquations() | 79 self.equations = LinearRegressionEquations() |
77 self.minibatch_size=1000 | 80 self.minibatch_size=minibatch_size |
78 | 81 |
79 def __call__(self,trainset): | 82 def __call__(self,trainset): |
80 first_example = trainset[0] | 83 first_example = trainset[0] |
81 n_inputs = first_example['input'].size | 84 n_inputs = first_example['input'].size |
82 n_outputs = first_example['target'].size | 85 n_outputs = first_example['target'].size |