mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
trace: initial support for code trace
This commit is contained in:
@@ -135,6 +135,7 @@ Ptr<LogisticRegression> LogisticRegression::load(const String& filepath, const S
|
||||
|
||||
bool LogisticRegressionImpl::train(const Ptr<TrainData>& trainData, int)
|
||||
{
|
||||
CV_TRACE_FUNCTION_SKIP_NESTED();
|
||||
// return value
|
||||
bool ok = false;
|
||||
|
||||
@@ -313,6 +314,7 @@ float LogisticRegressionImpl::predict(InputArray samples, OutputArray results, i
|
||||
|
||||
Mat LogisticRegressionImpl::calc_sigmoid(const Mat& data) const
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
Mat dest;
|
||||
exp(-data, dest);
|
||||
return 1.0/(1.0+dest);
|
||||
@@ -320,6 +322,7 @@ Mat LogisticRegressionImpl::calc_sigmoid(const Mat& data) const
|
||||
|
||||
double LogisticRegressionImpl::compute_cost(const Mat& _data, const Mat& _labels, const Mat& _init_theta)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
float llambda = 0; /*changed llambda from int to float to solve issue #7924*/
|
||||
int m;
|
||||
int n;
|
||||
@@ -410,6 +413,7 @@ struct LogisticRegressionImpl_ComputeDradient_Impl : ParallelLoopBody
|
||||
|
||||
void LogisticRegressionImpl::compute_gradient(const Mat& _data, const Mat& _labels, const Mat &_theta, const double _lambda, Mat & _gradient )
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
const int m = _data.rows;
|
||||
Mat pcal_a, pcal_b, pcal_ab;
|
||||
|
||||
@@ -431,6 +435,7 @@ void LogisticRegressionImpl::compute_gradient(const Mat& _data, const Mat& _labe
|
||||
|
||||
Mat LogisticRegressionImpl::batch_gradient_descent(const Mat& _data, const Mat& _labels, const Mat& _init_theta)
|
||||
{
|
||||
CV_TRACE_FUNCTION();
|
||||
// implements batch gradient descent
|
||||
if(this->params.alpha<=0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user