Mercurial > pylearn
comparison pylearn/algorithms/kernel_regression.py @ 1504:bf5c0f797161
Fix test.
author | Frederic Bastien <nouiz@nouiz.org> |
---|---|
date | Mon, 12 Sep 2011 10:48:33 -0400 |
parents | 9b371879c6ab |
children | 723e2d761985 |
comparison
equal
deleted
inserted
replaced
1503:1ee532a6f33b | 1504:bf5c0f797161 |
---|---|
1 """ | 1 """ |
2 Implementation of kernel regression: | 2 Implementation of kernel regression: |
3 """ | 3 """ |
4 | 4 |
5 from pylearn.old_dataset.learner import OfflineLearningAlgorithm | 5 #from pylearn.old_dataset.learner import OfflineLearningAlgorithm |
6 from theano import tensor as T | 6 from theano import tensor as T |
7 from theano.tensor.nnet import prepend_1_to_each_row | 7 from theano.tensor.nnet import prepend_1_to_each_row |
8 from theano.scalar import as_scalar | 8 from theano.scalar import as_scalar |
9 from common.autoname import AutoName | 9 from common.autoname import AutoName |
10 import theano | 10 import theano |
13 # map a N-vector to a 1xN matrix | 13 # map a N-vector to a 1xN matrix |
14 row_vector = theano.tensor.DimShuffle((False,),['x',0]) | 14 row_vector = theano.tensor.DimShuffle((False,),['x',0]) |
15 # map a N-vector to a Nx1 matrix | 15 # map a N-vector to a Nx1 matrix |
16 col_vector = theano.tensor.DimShuffle((False,),[0,'x']) | 16 col_vector = theano.tensor.DimShuffle((False,),[0,'x']) |
17 | 17 |
18 class KernelRegression(OfflineLearningAlgorithm): | 18 class KernelRegression():#OfflineLearningAlgorithm): |
19 """ | 19 """ |
20 Implementation of kernel regression: | 20 Implementation of kernel regression: |
21 * the data are n (x_t,y_t) pairs and we want to estimate E[y|x] | 21 * the data are n (x_t,y_t) pairs and we want to estimate E[y|x] |
22 * the predictor computes | 22 * the predictor computes |
23 f(x) = b + \sum_{t=1}^n \alpha_t K(x,x_t) | 23 f(x) = b + \sum_{t=1}^n \alpha_t K(x,x_t) |