MCPcopy Create free account
hub / github.com/HiLab-git/SimpleCRF / evaluate

Method evaluate

dependency/densecrf3d/src/objective.cpp:37–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35LogLikelihood::LogLikelihood( const VectorXs & gt, float robust ):gt_( gt ),robust_(robust){
36}
37double LogLikelihood::evaluate( MatrixXf & d_mul_Q, const MatrixXf & Q ) const {
38 assert( gt_.rows() == Q.cols() );
39 const int N = Q.cols(), M = Q.rows();
40 double r = 0;
41 d_mul_Q = 0*Q;
42 for( int i=0; i<N; i++ )
43 if( 0 <= gt_[i] && gt_[i] < M ) {
44 float QQ = std::max( Q(gt_[i],i)+robust_, 1e-20f );
45 // Make it negative since it's a
46 r += log(QQ) / N;
47 d_mul_Q(gt_[i],i) += Q(gt_[i],i) / QQ / N;
48 }
49 return r;
50}
51Hamming::Hamming( const VectorXs & gt, float class_weight_pow ):gt_( gt ){
52 int M=0,N=gt.rows();;
53 for( int i=0; i<N; i++ )

Callers 1

gradientMethod · 0.45

Calls 6

logFunction · 0.50
rowsMethod · 0.45
colsMethod · 0.45
fillMethod · 0.45
sumMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected