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

Function main

dependency/densecrf/examples/test_pairwise.cpp:55–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53};
54
55int main() {
56 int N = 1000, M = 4, d = 2;
57 MatrixXf f = 0.3*MatrixXf::Random( d, N );
58 MatrixXf a = MatrixXf::Random( M, N ), b = MatrixXf::Random( M, N );
59 PairwiseEnergy e( f.array(), a, a );
60
61 VectorXf p = e.initialValue();
62// p = VectorXf::Random( p.rows() );
63 VectorXf g = p;
64 std::cout<<"start = "<<e.gradient( p, g )<<std::endl;
65// std::cout<<p.transpose()<<std::endl;
66 p = minimizeLBFGS( e, 5, 1 );
67 std::cout<<"E = "<<e.gradient( p, g )<<" "<<gradCheck( e, p, 1e-2 )<<" "<<p.transpose()<<std::endl;
68 std::cout<<"g = "<<g.transpose()<<std::endl;
69 std::cout<<"ng = "<<numericGradient( e, p ).transpose()<<std::endl;
70 std::cout<<"ng = "<<numericGradient( e, p, 1e-2 ).transpose()<<std::endl;
71// int id;
72// VectorXf dg = g.transpose()-numericGradient( e, p );
73// dg.array().abs().maxCoeff( &id );
74// std::cout<<computeFunction( e, p-g, 0.02*g ).transpose()<<std::endl;
75}

Callers

nothing calls this directly

Calls 7

minimizeLBFGSFunction · 0.50
gradCheckFunction · 0.50
numericGradientFunction · 0.50
arrayMethod · 0.45
initialValueMethod · 0.45
gradientMethod · 0.45
transposeMethod · 0.45

Tested by

no test coverage detected