[mlpack-svn] [MLPACK] #298: Enhancement of linear regression library
MLPACK Trac
trac at coffeetalk-1.cc.gatech.edu
Thu Aug 22 16:27:46 EDT 2013
#298: Enhancement of linear regression library
--------------------------------+-------------------------------------------
Reporter: sumedhghaisas | Owner: rcurtin
Type: enhancement | Status: accepted
Priority: major | Milestone: mlpack 1.0.7
Component: mlpack | Resolution:
Keywords: linear_regression | Blocking:
Blocked By: |
--------------------------------+-------------------------------------------
Comment (by rcurtin):
Hello Sumedh,
Sorry for the slow response. I have been busy. I would suggest this as a
check for the cost:
{{{
const double cost = lr.ComputeCost(points, responses);
// 0.01% tolerance.
BOOST_REQUIRE_CLOSE(cost, 9.07497e-5, 0.001)
}}}
It might be easy to write tests for some other simple corner cases for
ComputeCost(). For instance, if the responses fit the model perfectly,
then the cost should be zero. It shouldn't be too hard to make a dataset
like that... here's one in two dimensions, with the responses as the one-
dimensional column vector to the right:
{{{
[[0 0] [[0]
[1 1] [2]
[2 2] [4]
[1 2] [3]
[6 2] [8]
[2 6]] [8]]
}}}
That's the relation y = x_1 + x_2, which the linear regression model
should fit perfectly (giving a cost of 0). You could write a test
function to run linear regression on that dataset then ensure the cost of
that dataset is 0.
--
Ticket URL: <http://trac.research.cc.gatech.edu/fastlab/ticket/298#comment:6>
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