diff options
author | Brian Muller <brian.muller@livingsocial.com> | 2012-01-03 23:56:51 +0400 |
---|---|---|
committer | Brian Muller <brian.muller@livingsocial.com> | 2012-01-03 23:56:51 +0400 |
commit | 9f457bf70dcab12082ec07cc6018e3f1a75899a2 (patch) | |
tree | a30f2028788bf291a71200ff5644a3c72a842f27 /vowpalwabbit/loss_functions.h | |
parent | 5c267f9404ffbb733c88b759605386aad51e6baf (diff) |
now creating a linkable library
Diffstat (limited to 'vowpalwabbit/loss_functions.h')
-rw-r--r-- | vowpalwabbit/loss_functions.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vowpalwabbit/loss_functions.h b/vowpalwabbit/loss_functions.h new file mode 100644 index 00000000..59ebeae4 --- /dev/null +++ b/vowpalwabbit/loss_functions.h @@ -0,0 +1,36 @@ +/* +Copyright (c) 2009 Yahoo! Inc. All rights reserved. The copyrights +embodied in the content of this file are licensed under the BSD +(revised) open source license + */ + +#ifndef LOSSFUNCTIONS_H_ +#define LOSSFUNCTIONS_H_ + +#include <string> + +class loss_function { + +public : + /* + * getLoss evaluates the example loss. + * The function returns the loss value + */ + //virtual float getLoss(example *&ec, gd_vars &vars) = 0; + virtual float getLoss(float prediction, float label) = 0; + + /* + * getUpdate evaluates the update scalar + * The function return the update scalar + */ + virtual float getUpdate(float prediction, float label, float eta_t, float norm) = 0; + virtual float getRevertingWeight(float prediction, float eta_t) = 0; + virtual float getSquareGrad(float prediction, float label) = 0; + virtual float first_derivative(float prediction, float label) = 0; + virtual float second_derivative(float prediction, float label) = 0; + virtual ~loss_function() {}; +}; + +loss_function* getLossFunction(std::string funcName, double loss_parameter = 0); + +#endif /* LOSSFUNCTIONS_H_ */ |