From cdb7f2b26e717bbfe84dbd73f949c6b06ca2b2d7 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Mon, 25 Nov 2013 00:14:16 -0500 Subject: remove dead code, add adagrad crf learner --- decoder/cfg_test.cc | 98 ----------------------------------------------------- 1 file changed, 98 deletions(-) delete mode 100644 decoder/cfg_test.cc (limited to 'decoder/cfg_test.cc') diff --git a/decoder/cfg_test.cc b/decoder/cfg_test.cc deleted file mode 100644 index cbe7d0be..00000000 --- a/decoder/cfg_test.cc +++ /dev/null @@ -1,98 +0,0 @@ -#include -#include -#include "cfg.h" -#include "hg_test.h" -#include "cfg_options.h" -#include "show.h" - -/* TODO: easiest way to get meaningful confirmations that things work: implement conversion back to hg, and compare viterbi/inside etc. stats for equality to original hg. or you can define CSHOW_V and see lots of output */ - -using namespace boost; - -#define CSHOW_V 0 - -#if CSHOW_V -# define CSHOWDO(x) x; -#else -# define CSHOWDO(x) -#endif -#define CSHOW(x) CSHOWDO(cerr<<#x<<'='< HgW; // hg file,weights - -struct CFGTest : public TestWithParam { - string hgfile; - Hypergraph hg; - CFG cfg; - CFGFormat form; - SparseVector weights; - - static void JsonFN(Hypergraph &hg,CFG &cfg,SparseVector &featw,std::string file - ,std::string const& wts="Model_0 1 EgivenF 1 f1 1") - { - istringstream ws(wts); - EXPECT_TRUE(ws>>featw); - CSHOW(featw) - std::string path(boost::unit_test::framework::master_test_suite().argc == 2 ? boost::unit_test::framework::master_test_suite().argv[1] : TEST_DATA); - HGSetup::JsonTestFile(&hg,path,file); - hg.Reweight(featw); - cfg.Init(hg,true,true,false); - } - static void SetUpTestCase() { - } - static void TearDownTestCase() { - } - CFGTest() { - hgfile=GetParam().first; - JsonFN(hg,cfg,weights,hgfile,GetParam().second); - CSHOWDO(cerr<<"\nCFG Test: ") - CSHOW(hgfile); - form.nt_span=true; - form.comma_nt=false; - } - ~CFGTest() { } -}; - -TEST_P(CFGTest,Binarize) { - CFGBinarize b; - b.bin_name_nts=1; - CFG cfgu=cfg; - EXPECT_EQ(cfgu,cfg); - int nrules=cfg.rules.size(); - CSHOWDO(cerr<<"\nUniqing: "<=0) { - int f=i<<1; - b.bin_l2r=1; - b.bin_unary=(f>>=1)&1; - b.bin_topo=(f>>=1)&1; - uniq=(f>>=1)&1; - } else - b.bin_l2r=0; - CFG cc=uniq?cfgu:cfg; - CSHOW("\nBinarizing "<<(uniq?"uniqued ":"")<<": "< "<