Permalink
Browse files

Tweaked loss function parsing

  • Loading branch information...
1 parent 4ab9d6a commit 190834276c95eb4c527b550fc46a4081d251695f @JohnLangford committed Dec 31, 2009
Showing with 12 additions and 8 deletions.
  1. +2 −2 Makefile
  2. +9 −5 loss_functions.cc
  3. +1 −1 parse_args.cc
View
@@ -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
View
@@ -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 @@ class quantileloss : public loss_function {
};
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;
}
View
@@ -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");

0 comments on commit 1908342

Please sign in to comment.