Mercurial > pylearn
diff linear_regression.py @ 379:74b402b5a81b
small modif by yoshue
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Mon, 07 Jul 2008 12:27:06 -0400 |
parents | c9a89be5cb0a |
children | efb797c5efc0 |
line wrap: on
line diff
--- a/linear_regression.py Mon Jul 07 12:02:34 2008 -0400 +++ b/linear_regression.py Mon Jul 07 12:27:06 2008 -0400 @@ -88,10 +88,11 @@ P = LinearPredictorEquations XtX = T.matrix() # (n_inputs+1) x (n_inputs+1) XtY = T.matrix() # (n_inputs+1) x n_outputs - extended_input = T.prepend_scalar_to_each_row(1,P.inputs) + extended_input = T.prepend_scalar_to_each_row(1.,P.inputs) new_XtX = add_inplace(XtX,T.dot(extended_input.T,extended_input)) new_XtY = add_inplace(XtY,T.dot(extended_input.T,P.targets)) - + new_theta = T.Cholesky_solve_inplace(P.theta,XtX,XtY) # solve linear system XtX theta = XtY + class LinearPredictor(object): """ A linear predictor has parameters theta (a bias vector and a weight matrix)