Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes
clsfy_logit_loss_function Class Reference

Loss function for logit of linear classifier. More...

#include <clsfy_logit_loss_function.h>

Inheritance diagram for clsfy_logit_loss_function:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 clsfy_logit_loss_function (mbl_data_wrapper< vnl_vector< double > > &x, const vnl_vector< double > &c, double min_p, vnl_cost_function *reg_fn=0)
virtual double f (vnl_vector< double > const &v)
 The main function: Compute f(v).
virtual void gradf (vnl_vector< double > const &v, vnl_vector< double > &gradient)
 Calculate the gradient of f at parameter vector v.
virtual void compute (vnl_vector< double > const &v, double *f, vnl_vector< double > *gradient)
 Compute f(v) and its gradient (if non-zero pointers supplied).
vnl_vector< double > gradf (vnl_vector< double > const &x)
int get_number_of_unknowns () const
void fdgradf (vnl_vector< double > const &x, vnl_vector< double > &gradient, double stepsize=1e-5)
vnl_vector< double > fdgradf (vnl_vector< double > const &x)
virtual double reported_error (double f_value)
virtual double get_range_min () const
virtual double get_range_max () const
virtual vnl_unary_function
< double, vnl_vector< double > > * 
Copy () const

Public Attributes

int dim

Protected Member Functions

void set_number_of_unknowns (int number_of_unknowns)

Private Attributes

mbl_data_wrapper< vnl_vector
< double > > & 
x_
const vnl_vector< double > & c_
 c[i] = -1 or +1, indicating class of x[i].
double min_p_
 Min probability (avoids log(zero)).
vnl_cost_functionreg_fn_
 Optional regularising function.

Detailed Description

Loss function for logit of linear classifier.

For vector v' = (b w') (ie b=y[0], w=(y[1]...y[n])), computes r(v) - (1/n_eg)sum log[(1-minp)logit(c_i * (b+w.x_i)) + minp]

This is the sum of log prob of correct classification (+regulariser) which should be minimised to train the classifier.

Note: Regularisor only important to deal with case where perfect classification possible, where scaling v would always increase f(v). Plausible choice of regularisor is clsfy_quad_regulariser (below)

Definition at line 22 of file clsfy_logit_loss_function.h.


Constructor & Destructor Documentation

clsfy_logit_loss_function::clsfy_logit_loss_function ( mbl_data_wrapper< vnl_vector< double > > &  x,
const vnl_vector< double > &  c,
double  min_p,
vnl_cost_function reg_fn = 0 
)

Definition at line 10 of file clsfy_logit_loss_function.cxx.


Member Function Documentation

void clsfy_logit_loss_function::compute ( vnl_vector< double > const &  v,
double *  f,
vnl_vector< double > *  gradient 
) [virtual]

Compute f(v) and its gradient (if non-zero pointers supplied).

Reimplemented from vnl_cost_function.

Definition at line 76 of file clsfy_logit_loss_function.cxx.

double clsfy_logit_loss_function::f ( vnl_vector< double > const &  v) [virtual]

The main function: Compute f(v).

The main function: Compute f(w).

Reimplemented from vnl_cost_function.

Definition at line 30 of file clsfy_logit_loss_function.cxx.

void clsfy_logit_loss_function::gradf ( vnl_vector< double > const &  v,
vnl_vector< double > &  gradient 
) [virtual]

Calculate the gradient of f at parameter vector v.

Reimplemented from vnl_cost_function.

Definition at line 45 of file clsfy_logit_loss_function.cxx.


Member Data Documentation

const vnl_vector<double>& clsfy_logit_loss_function::c_ [private]

c[i] = -1 or +1, indicating class of x[i].

Definition at line 28 of file clsfy_logit_loss_function.h.

Min probability (avoids log(zero)).

Definition at line 31 of file clsfy_logit_loss_function.h.

Optional regularising function.

Definition at line 34 of file clsfy_logit_loss_function.h.

Definition at line 25 of file clsfy_logit_loss_function.h.


The documentation for this class was generated from the following files: