/usr/include/vowpalwabbit/loss_functions.h is in libvw-dev 8.5.0.dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | /*
Copyright (c) by respective owners including Yahoo!, Microsoft, and
individual contributors. All rights reserved. Released under a BSD
license as described in the file LICENSE.
*/
#pragma once
#include <string>
#include "parse_primitives.h"
struct shared_data;
struct vw;
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(shared_data*, float prediction, float label) = 0;
/*
* getUpdate evaluates the update scalar
* The function return the update scalar
*/
virtual float getUpdate(float prediction, float label, float update_scale, float pred_per_update) = 0;
virtual float getUnsafeUpdate(float prediction, float label, float eta_t) = 0;
//the number of examples of the opposite label such that updating with
//that number results in the opposite label.
//0 = prediction + pred_per_update
// * getUpdate(prediction, opposite, pred_per_update*getRevertingWeight(), pred_per_update)
virtual float getRevertingWeight(shared_data*, float prediction, float eta_t) = 0;
virtual float getSquareGrad(float prediction, float label) = 0;
virtual float first_derivative(shared_data*, float prediction, float label) = 0;
virtual float second_derivative(shared_data*, float prediction, float label) = 0;
virtual ~loss_function() {};
};
loss_function* getLossFunction(vw&, std::string funcName, float function_parameter = 0);
|