diff options
Diffstat (limited to 'training')
26 files changed, 307 insertions, 217 deletions
diff --git a/training/CMakeLists.txt b/training/CMakeLists.txt new file mode 100644 index 00000000..c0ae42e8 --- /dev/null +++ b/training/CMakeLists.txt @@ -0,0 +1,14 @@ + +add_subdirectory(liblbfgs) +add_subdirectory(utils) +add_subdirectory(crf) +add_subdirectory(minrisk) +add_subdirectory(dpmert) +add_subdirectory(pro) +add_subdirectory(dtrain) +add_subdirectory(latent_svm) +add_subdirectory(mira) +add_subdirectory(rampion) +add_subdirectory(const_reorder) + + diff --git a/training/Makefile.am b/training/Makefile.am deleted file mode 100644 index 2812a9be..00000000 --- a/training/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -SUBDIRS = \ - liblbfgs \ - utils \ - crf \ - minrisk \ - dpmert \ - pro \ - dtrain \ - latent_svm \ - mira \ - rampion \ - const_reorder diff --git a/training/const_reorder/CMakeLists.txt b/training/const_reorder/CMakeLists.txt new file mode 100644 index 00000000..da074a23 --- /dev/null +++ b/training/const_reorder/CMakeLists.txt @@ -0,0 +1,9 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils) + +set(const_reorder_model_trainer_SRCS constituent_reorder_model.cc trainer.h trainer.cc) +add_executable(const_reorder_model_trainer ${const_reorder_model_trainer_SRCS}) +target_link_libraries(const_reorder_model_trainer utils ${Boost_LIBRARIES} z) + +set(argument_reorder_model_trainer_SRCS argument_reorder_model.cc trainer.h trainer.cc) +add_executable(argument_reorder_model_trainer ${argument_reorder_model_trainer_SRCS}) +target_link_libraries(argument_reorder_model_trainer utils ${Boost_LIBRARIES} z) diff --git a/training/const_reorder/Makefile.am b/training/const_reorder/Makefile.am deleted file mode 100644 index 2c681398..00000000 --- a/training/const_reorder/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -bin_PROGRAMS = const_reorder_model_trainer argument_reorder_model_trainer - -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/utils -I$(top_srcdir)/decoder - -const_reorder_model_trainer_SOURCES = constituent_reorder_model.cc trainer.h trainer.cc -const_reorder_model_trainer_LDADD = ../../utils/libutils.a -argument_reorder_model_trainer_SOURCES = argument_reorder_model.cc trainer.h trainer.cc -argument_reorder_model_trainer_LDADD = ../../utils/libutils.a diff --git a/training/crf/CMakeLists.txt b/training/crf/CMakeLists.txt new file mode 100644 index 00000000..4792983e --- /dev/null +++ b/training/crf/CMakeLists.txt @@ -0,0 +1,78 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder) + + + +########### next target ############### + +set(mpi_batch_optimize_SRCS mpi_batch_optimize.cc cllh_observer.cc cllh_observer.h) +add_executable(mpi_batch_optimize ${mpi_batch_optimize_SRCS}) +target_link_libraries(mpi_batch_optimize training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + +########### next target ############### + +set(mpi_adagrad_optimize_SRCS mpi_adagrad_optimize.cc cllh_observer.cc cllh_observer.h) + +add_executable(mpi_adagrad_optimize ${mpi_adagrad_optimize_SRCS}) + +target_link_libraries(mpi_adagrad_optimize ${KDE4_KDECORE_LIBS} training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + + + +########### next target ############### + +set(mpi_compute_cllh_SRCS mpi_compute_cllh.cc cllh_observer.cc cllh_observer.h) + +add_executable(mpi_compute_cllh ${mpi_compute_cllh_SRCS}) + +target_link_libraries(mpi_compute_cllh ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + + + +########### next target ############### + +set(mpi_extract_features_SRCS mpi_extract_features.cc) + +add_executable(mpi_extract_features ${mpi_extract_features_SRCS}) + +target_link_libraries(mpi_extract_features ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + + + +########### next target ############### + +set(mpi_extract_reachable_SRCS mpi_extract_reachable.cc) + +add_executable(mpi_extract_reachable ${mpi_extract_reachable_SRCS}) + +target_link_libraries(mpi_extract_reachable ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + + +########### next target ############### + +set(mpi_flex_optimize_SRCS mpi_flex_optimize.cc) + +add_executable(mpi_flex_optimize ${mpi_flex_optimize_SRCS}) + +target_link_libraries(mpi_flex_optimize ${KDE4_KDECORE_LIBS} training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + + +########### next target ############### + +set(mpi_online_optimize_SRCS mpi_online_optimize.cc) + +add_executable(mpi_online_optimize ${mpi_online_optimize_SRCS}) + +target_link_libraries(mpi_online_optimize ${KDE4_KDECORE_LIBS} training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + +########### next target ############### + +set(mpi_baum_welch_SRCS mpi_baum_welch.cc) + +add_executable(mpi_baum_welch ${mpi_baum_welch_SRCS}) + +target_link_libraries(mpi_baum_welch ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + + diff --git a/training/crf/Makefile.am b/training/crf/Makefile.am deleted file mode 100644 index 87d9f838..00000000 --- a/training/crf/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -bin_PROGRAMS = \ - mpi_batch_optimize \ - mpi_adagrad_optimize \ - mpi_compute_cllh \ - mpi_extract_features \ - mpi_extract_reachable \ - mpi_flex_optimize \ - mpi_online_optimize \ - mpi_baum_welch - -mpi_baum_welch_SOURCES = mpi_baum_welch.cc -mpi_baum_welch_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz - -mpi_adagrad_optimize_SOURCES = mpi_adagrad_optimize.cc cllh_observer.cc cllh_observer.h -mpi_adagrad_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz - -mpi_online_optimize_SOURCES = mpi_online_optimize.cc -mpi_online_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz - -mpi_flex_optimize_SOURCES = mpi_flex_optimize.cc -mpi_flex_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz - -mpi_extract_reachable_SOURCES = mpi_extract_reachable.cc -mpi_extract_reachable_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz - -mpi_extract_features_SOURCES = mpi_extract_features.cc -mpi_extract_features_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz - -mpi_batch_optimize_SOURCES = mpi_batch_optimize.cc cllh_observer.cc cllh_observer.h -mpi_batch_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz - -mpi_compute_cllh_SOURCES = mpi_compute_cllh.cc cllh_observer.cc cllh_observer.h -mpi_compute_cllh_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a $(BOOST_MPI_LDFLAGS) $(BOOST_MPI_LIBS) -lz - -AM_CPPFLAGS = -DBOOST_TEST_DYN_LINK -W -Wall -Wno-sign-compare -I$(top_srcdir)/training -I$(top_srcdir)/training/utils -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval - diff --git a/training/dpmert/CMakeLists.txt b/training/dpmert/CMakeLists.txt new file mode 100644 index 00000000..382af070 --- /dev/null +++ b/training/dpmert/CMakeLists.txt @@ -0,0 +1,59 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder) + +set(dpmert_SRCS + mert_geometry.cc + ces.cc + error_surface.cc + mr_dpmert_map.cc + line_optimizer.cc + ces.h + error_surface.h + line_optimizer.h + mert_geometry.h) +add_library(dpmert ${dpmert_SRCS}) + +set(mr_dpmert_map_SRCS mr_dpmert_map.cc) + +add_executable(mr_dpmert_map ${mr_dpmert_map_SRCS}) +target_link_libraries(mr_dpmert_map dpmert training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + +########### next target ############### + +set(mr_dpmert_reduce_SRCS + mr_dpmert_reduce.cc) + +add_executable(mr_dpmert_reduce ${mr_dpmert_reduce_SRCS}) +target_link_libraries(mr_dpmert_reduce dpmert training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + + +set(mr_dpmert_generate_mapper_input_SRCS mr_dpmert_generate_mapper_input.cc) +add_executable(mr_dpmert_generate_mapper_input ${mr_dpmert_generate_mapper_input_SRCS}) +target_link_libraries(mr_dpmert_generate_mapper_input dpmert training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + +set(TEST_SRCS lo_test.cc) +foreach(testSrc ${TEST_SRCS}) + #Extract the filename without an extension (NAME_WE) + get_filename_component(testName ${testSrc} NAME_WE) + + #Add compile target + set_source_files_properties(${testSrc} PROPERTIES COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DTEST_DATA=\\\"test_data/\\\"") + add_executable(${testName} ${testSrc}) + + #link to Boost libraries AND your targets and dependencies + target_link_libraries(${testName} dpmert training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} ${ZLIB_LIBRARIES}) + + #I like to move testing binaries into a testBin directory + set_target_properties(${testName} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + + #Finally add it to test execution - + #Notice the WORKING_DIRECTORY and COMMAND + add_test(NAME ${testName} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${testName} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +endforeach(testSrc) + + + diff --git a/training/dpmert/Makefile.am b/training/dpmert/Makefile.am deleted file mode 100644 index b85bb275..00000000 --- a/training/dpmert/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -bin_PROGRAMS = \ - mr_dpmert_map \ - mr_dpmert_reduce \ - mr_dpmert_generate_mapper_input - -noinst_PROGRAMS = \ - lo_test -TESTS = lo_test - -mr_dpmert_generate_mapper_input_SOURCES = mr_dpmert_generate_mapper_input.cc line_optimizer.cc -mr_dpmert_generate_mapper_input_LDADD = ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a - -# nbest2hg_SOURCES = nbest2hg.cc -# nbest2hg_LDADD = $(top_srcdir)/decoder/libcdec.a $(top_srcdir)/mteval/libmteval.a $(top_srcdir)/utils/libutils.a -lfst - -mr_dpmert_map_SOURCES = mert_geometry.cc ces.cc error_surface.cc mr_dpmert_map.cc line_optimizer.cc ces.h error_surface.h line_optimizer.h mert_geometry.h -mr_dpmert_map_LDADD = ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a - -mr_dpmert_reduce_SOURCES = error_surface.cc ces.cc mr_dpmert_reduce.cc line_optimizer.cc mert_geometry.cc ces.h error_surface.h line_optimizer.h mert_geometry.h -mr_dpmert_reduce_LDADD = ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a - -lo_test_SOURCES = lo_test.cc ces.cc mert_geometry.cc error_surface.cc line_optimizer.cc ces.h error_surface.h line_optimizer.h mert_geometry.h -lo_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a - -EXTRA_DIST = test_data dpmert.pl - -AM_CPPFLAGS = -DTEST_DATA=\"$(top_srcdir)/training/dpmert/test_data\" -DBOOST_TEST_DYN_LINK -W -Wall -Wno-sign-compare -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval diff --git a/training/dpmert/ces.h b/training/dpmert/ces.h index e4fa2080..b179499d 100644 --- a/training/dpmert/ces.h +++ b/training/dpmert/ces.h @@ -1,9 +1,9 @@ #ifndef _CES_H_ #define _CES_H_ -class ConvexHull; +struct ConvexHull; class Hypergraph; -class SegmentEvaluator; +struct SegmentEvaluator; class ErrorSurface; class EvaluationMetric; diff --git a/training/dtrain/CMakeLists.txt b/training/dtrain/CMakeLists.txt new file mode 100644 index 00000000..653cfe2b --- /dev/null +++ b/training/dtrain/CMakeLists.txt @@ -0,0 +1,15 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder) + +set(dtrain_SRCS + dtrain.cc + score.cc + dtrain.h + kbestget.h + ksampler.h + pairsampling.h + score.h) +add_executable(dtrain ${dtrain_SRCS}) +target_link_libraries(dtrain libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) diff --git a/training/dtrain/Makefile.am b/training/dtrain/Makefile.am deleted file mode 100644 index 844c790d..00000000 --- a/training/dtrain/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -bin_PROGRAMS = dtrain - -dtrain_SOURCES = dtrain.cc score.cc dtrain.h kbestget.h ksampler.h pairsampling.h score.h -dtrain_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a - -AM_CPPFLAGS = -W -Wall -Wno-sign-compare -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval - diff --git a/training/latent_svm/CMakeLists.txt b/training/latent_svm/CMakeLists.txt new file mode 100644 index 00000000..ec48e02f --- /dev/null +++ b/training/latent_svm/CMakeLists.txt @@ -0,0 +1,8 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder) + +set(latent_svm_SRCS latent_svm.cc) +add_executable(latent_svm ${latent_svm_SRCS}) +target_link_libraries(latent_svm libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) diff --git a/training/latent_svm/Makefile.am b/training/latent_svm/Makefile.am deleted file mode 100644 index 65c5e038..00000000 --- a/training/latent_svm/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -bin_PROGRAMS = latent_svm - -latent_svm_SOURCES = latent_svm.cc -latent_svm_LDADD = ../..//decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a - -AM_CPPFLAGS = -W -Wall -Wno-sign-compare -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval diff --git a/training/liblbfgs/CMakeLists.txt b/training/liblbfgs/CMakeLists.txt new file mode 100644 index 00000000..d936c0ab --- /dev/null +++ b/training/liblbfgs/CMakeLists.txt @@ -0,0 +1,37 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..) + + +set(lbfgs_STAT_SRCS + lbfgs.c + arithmetic_ansi.h + arithmetic_sse_double.h + arithmetic_sse_float.h + lbfgs++.h + lbfgs.h) + +add_library(lbfgs STATIC ${lbfgs_STAT_SRCS}) + +set(TEST_SRCS ll_test.cc) + +foreach(testSrc ${TEST_SRCS}) + #Extract the filename without an extension (NAME_WE) + get_filename_component(testName ${testSrc} NAME_WE) + + #Add compile target + set_source_files_properties(${testSrc} PROPERTIES COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DTEST_DATA=\\\"test_data/\\\"") + add_executable(${testName} ${testSrc}) + + #link to Boost libraries AND your targets and dependencies + target_link_libraries(${testName} lbfgs ${Boost_LIBRARIES} ${ZLIB_LIBRARIES}) + + #I like to move testing binaries into a testBin directory + set_target_properties(${testName} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + + #Finally add it to test execution - + #Notice the WORKING_DIRECTORY and COMMAND + add_test(NAME ${testName} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${testName} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +endforeach(testSrc) + + diff --git a/training/liblbfgs/Makefile.am b/training/liblbfgs/Makefile.am deleted file mode 100644 index aa3af377..00000000 --- a/training/liblbfgs/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -noinst_LIBRARIES = liblbfgs.a - -noinst_PROGRAMS = ll_test -ll_test_SOURCES = ll_test.cc -ll_test_LDADD = liblbfgs.a -lz -TESTS = ll_test - -liblbfgs_a_SOURCES = \ - lbfgs.c \ - arithmetic_ansi.h \ - arithmetic_sse_double.h \ - arithmetic_sse_float.h \ - lbfgs++.h \ - lbfgs.h - -################################################################ -# do NOT NOT NOT add any other -I includes NO NO NO NO NO ###### -AM_LDFLAGS = liblbfgs.a -lz -AM_CPPFLAGS = -DBOOST_TEST_DYN_LINK -W -Wall -I$(top_srcdir)/training -I$(top_srcdir)/training/liblbfgs -################################################################ - diff --git a/training/minrisk/CMakeLists.txt b/training/minrisk/CMakeLists.txt new file mode 100644 index 00000000..0795bc54 --- /dev/null +++ b/training/minrisk/CMakeLists.txt @@ -0,0 +1,9 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder) + +set(minrisk_optimize_SRCS minrisk_optimize.cc) +add_executable(minrisk_optimize ${minrisk_optimize_SRCS}) +target_link_libraries(minrisk_optimize training_utils libcdec mteval utils lbfgs ${Boost_LIBRARIES} z) diff --git a/training/minrisk/Makefile.am b/training/minrisk/Makefile.am deleted file mode 100644 index ebf6fa91..00000000 --- a/training/minrisk/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -bin_PROGRAMS = minrisk_optimize - -minrisk_optimize_SOURCES = minrisk_optimize.cc -minrisk_optimize_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a ../../training/liblbfgs/liblbfgs.a - -EXTRA_DIST = minrisk.pl minrisk_generate_input.pl - -AM_CPPFLAGS = -W -Wall -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval -I$(top_srcdir)/training -I$(top_srcdir)/training/utils diff --git a/training/minrisk/minrisk_optimize.cc b/training/minrisk/minrisk_optimize.cc index a2938fb0..f90c7118 100644 --- a/training/minrisk/minrisk_optimize.cc +++ b/training/minrisk/minrisk_optimize.cc @@ -163,7 +163,7 @@ int main(int argc, char** argv) { cerr << "Loading hypergraphs...\n"; while(getline(in, line)) { istringstream is(line); - int sent_id; + int sent_id = 0; kis.resize(kis.size() + 1); training::CandidateSet& curkbest = kis.back(); string kbest_file; diff --git a/training/mira/CMakeLists.txt b/training/mira/CMakeLists.txt new file mode 100644 index 00000000..3a8fa516 --- /dev/null +++ b/training/mira/CMakeLists.txt @@ -0,0 +1,17 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder) + +set(kbest_mira_SRCS kbest_mira.cc) +add_executable(kbest_mira ${kbest_mira_SRCS}) +target_link_libraries(kbest_mira ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + +set(kbest_cut_mira_SRCS kbest_cut_mira.cc) +add_executable(kbest_cut_mira ${kbest_cut_mira_SRCS}) +target_link_libraries(kbest_cut_mira ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + +set(ada_opt_sm_SRCS ada_opt_sm.cc) +add_executable(ada_opt_sm ${ada_opt_sm_SRCS}) +target_link_libraries(ada_opt_sm ${KDE4_KDECORE_LIBS} training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + diff --git a/training/mira/Makefile.am b/training/mira/Makefile.am deleted file mode 100644 index a318cf6e..00000000 --- a/training/mira/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -bin_PROGRAMS = \ - kbest_mira \ - kbest_cut_mira \ - ada_opt_sm - -EXTRA_DIST = mira.py - -ada_opt_sm_SOURCES = ada_opt_sm.cc -ada_opt_sm_LDFLAGS= -rdynamic -ada_opt_sm_LDADD = ../utils/libtraining_utils.a ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a - -kbest_mira_SOURCES = kbest_mira.cc -kbest_mira_LDFLAGS= -rdynamic -kbest_mira_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a - -kbest_cut_mira_SOURCES = kbest_cut_mira.cc -kbest_cut_mira_LDFLAGS= -rdynamic -kbest_cut_mira_LDADD = ../../decoder/libcdec.a ../../klm/search/libksearch.a ../../mteval/libmteval.a ../../utils/libutils.a ../../klm/lm/libklm.a ../../klm/util/libklm_util.a ../../klm/util/double-conversion/libklm_util_double.a - -AM_CPPFLAGS = -W -Wall -Wno-sign-compare -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval -I$(top_srcdir)/training/utils diff --git a/training/pro/CMakeLists.txt b/training/pro/CMakeLists.txt new file mode 100644 index 00000000..5ee09a74 --- /dev/null +++ b/training/pro/CMakeLists.txt @@ -0,0 +1,18 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder) + +########### next target ############### + +set(mr_pro_map_SRCS mr_pro_map.cc) +add_executable(mr_pro_map ${mr_pro_map_SRCS}) +target_link_libraries(mr_pro_map training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z) + +########### next target ############### + +set(mr_pro_reduce_SRCS mr_pro_reduce.cc) +add_executable(mr_pro_reduce ${mr_pro_reduce_SRCS}) +target_link_libraries(mr_pro_reduce lbfgs utils ${Boost_LIBRARIES} z) + diff --git a/training/pro/Makefile.am b/training/pro/Makefile.am deleted file mode 100644 index 09364804..00000000 --- a/training/pro/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -bin_PROGRAMS = \ - mr_pro_map \ - mr_pro_reduce - -mr_pro_map_SOURCES = mr_pro_map.cc -mr_pro_map_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a - -mr_pro_reduce_SOURCES = mr_pro_reduce.cc -mr_pro_reduce_LDADD = ../../training/liblbfgs/liblbfgs.a ../../utils/libutils.a - -EXTRA_DIST = mr_pro_generate_mapper_input.pl pro.pl - -AM_CPPFLAGS = -W -Wall -Wno-sign-compare -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval -I$(top_srcdir)/training/utils -I$(top_srcdir)/training diff --git a/training/rampion/CMakeLists.txt b/training/rampion/CMakeLists.txt new file mode 100644 index 00000000..8a60b5ff --- /dev/null +++ b/training/rampion/CMakeLists.txt @@ -0,0 +1,8 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder) + +set(rampion_cccp_SRCS rampion_cccp.cc) +add_executable(rampion_cccp ${rampion_cccp_SRCS}) +target_link_libraries(rampion_cccp training_utils libcdec mteval utils ${Boost_LIBRARIES} z) diff --git a/training/rampion/Makefile.am b/training/rampion/Makefile.am deleted file mode 100644 index c72283cd..00000000 --- a/training/rampion/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -bin_PROGRAMS = rampion_cccp - -rampion_cccp_SOURCES = rampion_cccp.cc -rampion_cccp_LDADD = ../../training/utils/libtraining_utils.a ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a - -EXTRA_DIST = rampion.pl rampion_generate_input.pl - -AM_CPPFLAGS = -W -Wall $(GTEST_CPPFLAGS) -I$(top_srcdir)/utils -I$(top_srcdir)/decoder -I$(top_srcdir)/mteval -I$(top_srcdir)/training/utils diff --git a/training/utils/CMakeLists.txt b/training/utils/CMakeLists.txt new file mode 100644 index 00000000..1734ee73 --- /dev/null +++ b/training/utils/CMakeLists.txt @@ -0,0 +1,32 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder) + +set(training_utils_STAT_SRCS + candidate_set.h + entropy.h + lbfgs.h + online_optimizer.h + optimize.h + risk.h + sentserver.h + candidate_set.cc + entropy.cc + optimize.cc + online_optimizer.cc + risk.cc) + +add_library(training_utils STATIC ${training_utils_STAT_SRCS}) + + +set(sentserver_SRCS sentserver.cc) +add_executable(sentserver ${sentserver_SRCS}) +target_link_libraries(sentserver) + +set(sentclient_SRCS sentclient.cc) +add_executable(sentclient ${sentclient_SRCS}) +target_link_libraries(sentclient) + +set(grammar_convert_SRCS grammar_convert.cc) +add_executable(grammar_convert ${grammar_convert_SRCS}) +target_link_libraries(grammar_convert libcdec mteval utils ${Boost_LIBRARIES} z) diff --git a/training/utils/Makefile.am b/training/utils/Makefile.am deleted file mode 100644 index edaaf3d4..00000000 --- a/training/utils/Makefile.am +++ /dev/null @@ -1,48 +0,0 @@ -noinst_LIBRARIES = libtraining_utils.a - -bin_PROGRAMS = \ - sentserver \ - sentclient \ - grammar_convert - -noinst_PROGRAMS = \ - lbfgs_test \ - optimize_test - -EXTRA_DIST = decode-and-evaluate.pl libcall.pl parallelize.pl - -sentserver_SOURCES = sentserver.cc -sentserver_LDFLAGS = $(PTHREAD_LIBS) -sentserver_CXXFLAGS = $(PTHREAD_CFLAGS) - -sentclient_SOURCES = sentclient.cc -sentclient_LDFLAGS = $(PTHREAD_LIBS) -sentclient_CXXFLAGS = $(PTHREAD_CFLAGS) - -TESTS = lbfgs_test optimize_test - -libtraining_utils_a_SOURCES = \ - candidate_set.h \ - entropy.h \ - lbfgs.h \ - online_optimizer.h \ - optimize.h \ - risk.h \ - sentserver.h \ - candidate_set.cc \ - entropy.cc \ - optimize.cc \ - online_optimizer.cc \ - risk.cc - -optimize_test_SOURCES = optimize_test.cc -optimize_test_LDADD = libtraining_utils.a ../../utils/libutils.a - -grammar_convert_SOURCES = grammar_convert.cc -grammar_convert_LDADD = ../../decoder/libcdec.a ../../mteval/libmteval.a ../../utils/libutils.a - -lbfgs_test_SOURCES = lbfgs_test.cc -lbfgs_test_LDADD = ../../utils/libutils.a - -AM_CPPFLAGS = -W -Wall -Wno-sign-compare -I$(top_srcdir)/decoder -I$(top_srcdir)/utils -I$(top_srcdir)/mteval -I$(top_srcdir)/klm - |