From: Rahul Kavi Date: Mon, 5 Aug 2013 13:32:39 +0000 (-0400) Subject: added program to demonstrate use of logistic regression classifier X-Git-Tag: submit/tizen_ivi/20141117.190038~2^2~171^2~41 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=835529330644a94d9b5dfdafd2dba9f85984cc8e;p=profile%2Fivi%2Fopencv.git added program to demonstrate use of logistic regression classifier --- diff --git a/samples/cpp/sample_logistic_regression.cpp b/samples/cpp/sample_logistic_regression.cpp new file mode 100644 index 0000000..95649e3 --- /dev/null +++ b/samples/cpp/sample_logistic_regression.cpp @@ -0,0 +1,97 @@ +/////////////////////////////////////////////////////////////////////////////////////// +// sample_logistic_regression.cpp +// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. + +// By downloading, copying, installing or using the software you agree to this license. +// If you do not agree to this license, do not download, install, +// copy or use the software. + +// This is a sample program demostrating classification of digits 0 and 1 using Logistic Regression + +// AUTHOR: +// Rahul Kavi rahulkavi[at]live[at]com +// + +#include + +#include +#include + +using namespace std; +using namespace cv; + + +int main() +{ + Mat data_temp, labels_temp; + Mat data, labels; + Mat responses, result; + + FileStorage f; + + cout<<"*****************************************************************************************"<> data_temp; + f["labelsmat"] >> labels_temp; + + data_temp.convertTo(data, CV_32F); + labels_temp.convertTo(labels, CV_32F); + + cout<<"initializing Logisitc Regression Parameters\n"<(i,0)<<" :: "<< responses.at(i,0)<