diff options
author | John Langford <jl@hunch.net> | 2009-12-31 04:08:34 +0300 |
---|---|---|
committer | John Langford <jl@hunch.net> | 2009-12-31 04:08:34 +0300 |
commit | 190834276c95eb4c527b550fc46a4081d251695f (patch) | |
tree | 02b2e09c2786d8726638e0ea595f40b8d13ff70f | |
parent | 4ab9d6a17a40e1705350a4a06ea7f3f1c538e879 (diff) |
Tweaked loss function parsing4.1
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | loss_functions.cc | 14 | ||||
-rw-r--r-- | parse_args.cc | 2 |
3 files changed, 12 insertions, 8 deletions
@@ -6,7 +6,7 @@ BOOST_LIBRARY = /usr/local/boost/lib ARCH = -march=nocona # for normal fast execution. -#FLAGS = -Wall $(ARCH) -ffast-math -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -I $(BOOST_INCLUDE) -O3 +FLAGS = -Wall $(ARCH) -ffast-math -fno-strict-aliasing -D_FILE_OFFSET_BITS=64 -I $(BOOST_INCLUDE) -O3 # for parallelization #FLAGS = -Wall $(ARCH) -ffast-math -Wno-strict-aliasing -D_FILE_OFFSET_BITS=64 -I $(BOOST_INCLUDE) -O3 -fopenmp @@ -15,7 +15,7 @@ ARCH = -march=nocona #FLAGS = -Wall $(ARCH) -ffast-math -D_FILE_OFFSET_BITS=64 -I $(BOOST_INCLUDE) -pg -g # for valgrind -FLAGS = -Wall $(ARCH) -ffast-math -D_FILE_OFFSET_BITS=64 -I $(BOOST_INCLUDE) -g -O0 +#FLAGS = -Wall $(ARCH) -ffast-math -D_FILE_OFFSET_BITS=64 -I $(BOOST_INCLUDE) -g -O0 BINARIES = vw diff --git a/loss_functions.cc b/loss_functions.cc index 88dcf6c9..1c3a5335 100644 --- a/loss_functions.cc +++ b/loss_functions.cc @@ -6,6 +6,8 @@ embodied in the content of this file are licensed under the BSD #include "loss_functions.h" #include<math.h> +#include <iostream> +using namespace std; class squaredloss : public loss_function { public: @@ -86,15 +88,17 @@ public: }; loss_function* getLossFunction(string funcName, double function_parameter) { - if(funcName.compare("squaredloss") == 0) { + if(funcName.compare("squared") == 0) { return new squaredloss(); - } else if(funcName.compare("hingeloss") == 0) { + } else if(funcName.compare("hinge") == 0) { return new hingeloss(); - } else if(funcName.compare("logloss") == 0) { + } else if(funcName.compare("logistic") == 0) { return new logloss(); - } else if(funcName.compare("quantileloss") == 0 || funcName.compare("pinballloss") == 0) { + } else if(funcName.compare("quantile") == 0 || funcName.compare("pinball") == 0 || funcName.compare("absolute") == 0) { return new quantileloss(function_parameter); } else { - return NULL; + cout << "Invalid loss function name: " << funcName << " Bailing!" << endl; + exit(1); } + cout << "end getLossFunction" << endl; } diff --git a/parse_args.cc b/parse_args.cc index 2deebf1d..e5bb3d71 100644 --- a/parse_args.cc +++ b/parse_args.cc @@ -58,7 +58,7 @@ po::variables_map parse_args(int argc, char *argv[], boost::program_options::opt ("sendto", po::value< vector<string> >(), "send example to <hosts>") ("testonly,t", "Ignore label information and just test") ("thread_bits", po::value<size_t>(&global.thread_bits)->default_value(0), "log_2 threads") - ("loss_function", po::value<string>()->default_value("squaredloss"), "Specify the loss function to be used, uses squaredloss by default. Currently available ones are squaredloss, hingeloss, logloss and quantileloss.") + ("loss_function", po::value<string>()->default_value("squared"), "Specify the loss function to be used, uses squared by default. Currently available ones are squared, hinge, logistic and quantile.") ("quantile_tau", po::value<double>()->default_value(0.5), "Parameter \\tau associated with Quantile loss. Defaults to 0.5") ("unique_id", po::value<size_t>(&global.unique_id)->default_value(0),"unique id used for cluster parallel") ("compressed", "use gzip format whenever appropriate. If a cache file is being created, this option creates a compressed cache file. A mixture of raw-text & compressed inputs are supported if this option is on"); |