Adding i/o code for protonn outputs

This commit is contained in:
Suresh Parthasarathy 2017-11-21 10:30:20 +05:30
Родитель 6b4beadd01
Коммит fbc316b25b
4 изменённых файлов: 64 добавлений и 12 удалений

Просмотреть файл

@ -9,7 +9,7 @@ REM # Have a look at README.md and README_PROTONN_OSS.md for details on how to s
SET test_file=-I usps10/test.txt
SET model_file=-M usps10/ProtoNNResults/ProtoNNTrainer_pd_15_protPerClass_0_prot_200_spW_1.000000_spZ_1.000000_spB_1.000000_gammaNumer_1.000000_normal_3_seed_42_bs_1024_it_20_ep_20/model
SET normalization_file=-n usps10/ProtoNNResults/ProtoNNTrainer_pd_15_protPerClass_0_prot_200_spW_1.000000_spZ_1.000000_spB_1.000000_gammaNumer_1.000000_normal_3_seed_42_bs_1024_it_20_ep_20/minMaxParams
SET output_dir=-O usps10/ProtoNNResults
SET output_dir=-O usps10\ProtoNNResults
SET input_format=-F 0
SET ntest=-e 2007
REM SET batch_size=-b 1024

Просмотреть файл

@ -13,7 +13,7 @@ SET predefined_model=-P 0
SET problem_format=-C 1
SET train_file=-I usps10/train.txt
SET validation_file=-V usps10/test.txt
SET output_dir=-O usps10/ProtoNNResults
SET output_dir=-O usps10\ProtoNNResults
SET input_format=-F 0
REM ########################################################

Просмотреть файл

@ -120,7 +120,14 @@ ProtoNNPredictor::ProtoNNPredictor(
void ProtoNNPredictor::createOutputDirs()
{
std::string subdirName = model.hyperParams.subdirName();
#ifdef LINUX
outDir = outDir + "/ProtoNNPredictor_" + subdirName;
#endif
#ifdef WINDOWS
outDir = outDir + "\\ProtoNNPredictor_" + subdirName;
#endif
try {
std::string testcommand = "test -d " + outDir;
@ -134,27 +141,46 @@ void ProtoNNPredictor::createOutputDirs()
LOG_WARNING("Error in creating directory at this location: " + outDir);
#endif
#ifdef WINDOWS
if (system(command.c_str()) != 0)
LOG_WARNING("Error in creating directory at this location: " + outDir + " (Directory might already exist)");
#endif
#ifdef DUMP
#ifdef LINUX
testcommand = "test -d " + outDir + "/dump";
command = "mkdir " + outDir + "/dump";
#ifdef LINUX
if (system(testcommand.c_str()) == 0)
LOG_INFO("Directory " + outDir + "/dump already exists.");
else
if (system(command.c_str()) != 0)
LOG_WARNING("Error in creating directory at this location: " + outDir + "/dump");
#endif
#ifdef WINDOWS
command = "mkdir " + outDir + "\\dump";
if (system(command.c_str()) != 0)
LOG_WARNING("Error in creating directory at this location: " + outDir + "\dump" + " (Directory might already exist)");
#endif
#endif
#ifdef VERIFY
#ifdef LINUX
testcommand = "test -d " + outDir + "/verify";
command = "mkdir " + outDir + "/verify";
#ifdef LINUX
if (system(testcommand.c_str()) == 0)
LOG_INFO("Directory " + outDir + "/verify already exists.");
else
if (system(command.c_str()) != 0)
LOG_WARNING("Error in creating directory at this location: " + outDir + "/verify");
#endif
#ifdef WINDOWS
command = "mkdir " + outDir + "\\verify";
if (system(command.c_str()) != 0)
LOG_WARNING("Error in creating directory at this location: " + outDir + "\verify" + " (Directory might already exist)");
#endif
#endif
}
catch (...) {

Просмотреть файл

@ -53,7 +53,14 @@ ProtoNNTrainer::ProtoNNTrainer(
void ProtoNNTrainer::createOutputDirs()
{
std::string subdirName = model.hyperParams.subdirName();
#ifdef LINUX
outDir = outDir + "/ProtoNNTrainer_" + subdirName;
#endif
#ifdef WINDOWS
outDir = outDir + "\\ProtoNNTrainer_" + subdirName;
#endif
try {
std::string testcommand = "test -d " + outDir;
@ -67,27 +74,46 @@ void ProtoNNTrainer::createOutputDirs()
LOG_WARNING("Error in creating directory at this location: " + outDir);
#endif
#ifdef WINDOWS
if (system(command.c_str()) != 0)
LOG_WARNING("Error in creating directory at this location: " + outDir + " (Directory might already exist)");
#endif
#ifdef DUMP
#ifdef LINUX
testcommand = "test -d " + outDir + "/dump";
command = "mkdir " + outDir + "/dump";
#ifdef LINUX
if (system(testcommand.c_str()) == 0)
LOG_INFO("Directory " + outDir + "/dump already exists.");
else
if (system(command.c_str()) != 0)
LOG_WARNING("Error in creating directory at this location: " + outDir + "/dump");
#endif
#ifdef WINDOWS
command = "mkdir " + outDir + "\\dump";
if (system(command.c_str()) != 0)
LOG_WARNING("Error in creating directory at this location: " + outDir + "\dump" + " (Directory might already exist)");
#endif
#endif
#ifdef VERIFY
#ifdef LINUX
testcommand = "test -d " + outDir + "/verify";
command = "mkdir " + outDir + "/verify";
#ifdef LINUX
if (system(testcommand.c_str()) == 0)
LOG_INFO("Directory " + outDir + "/verify already exists.");
else
if (system(command.c_str()) != 0)
LOG_WARNING("Error in creating directory at this location: " + outDir + "/verify");
#endif
#ifdef WINDOWS
command = "mkdir " + outDir + "\\verify";
if (system(command.c_str()) != 0)
LOG_WARNING("Error in creating directory at this location: " + outDir + "\verify" + " (Directory might already exist)");
#endif
#endif
}
catch (...) {