diff --git a/samples/cpp/sample_logistic_regression.cpp b/samples/cpp/sample_logistic_regression.cpp new file mode 100644 index 0000000000..95649e3911 --- /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)<