[mlpack-svn] [MLPACK] #298: Enhancement of linear regression library
MLPACK Trac
trac at coffeetalk-1.cc.gatech.edu
Sat Aug 10 13:11:08 EDT 2013
#298: Enhancement of linear regression library
---------------------------+------------------------------------------------
Reporter: sumedhghaisas | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: mlpack 1.0.7
Component: mlpack | Keywords: linear_regression
Blocking: | Blocked By:
---------------------------+------------------------------------------------
I have been working on my project which used linear regression on a small
scale. For that matter I modified linear regression files of mlpack.
Things I have added :
1) Regularisation - ridge regularization option is provided(lambda). New
Constructor implemented for that purpose. The implemented equation for
calculation of theta is -
theta = inv(trans(X) * X + lambda * I) * trans(X) * y;
This implementation is giving comparable, on an average better performance
considering time. The theta we get through this if we put lambda = 0 is as
same as the theta we get from QR decomposition.
2) cost function calculation : function implemented in Linear Regression
class gives cost of the current parameters on the points and responses
passed on that function.
cost = 1/m * sum(y - X*theta)^2
Things I modified :
1) The implementation of predict function was through loop in a loop which
is much of time overhead. I have implemented a a matrix implementation of
it which(Maybe) would improve the time performance.
I have attached both linear_regression.cpp and linear_regression.hpp with
my ticket. both the files are properly documented with detailed
description of the input formats.
Its not very much but these new function can be very helpful in certain
situations. Maybe u can include them in newer releases.
--
Ticket URL: <http://trac.research.cc.gatech.edu/fastlab/ticket/298>
MLPACK <www.fast-lab.org>
MLPACK is an intuitive, fast, and scalable C++ machine learning library developed at Georgia Tech.
More information about the mlpack-svn
mailing list