Main Page | Data Structures | File List | Data Fields | Globals

ukr.h File Reference

UKR Toolbox header file. More...

Go to the source code of this file.

Data Structures

struct  UKR_Model
struct  UKR_G_Struct

Typedefs

typedef double(* Ukr_bp_dists_sparse )(int, const double *, double *, double *, int *, int *, int, const int *, int)
typedef double(* Ukr_bp_dists_full )(int, const double *, double *, double *, int, const int *, int)

Enumerations

enum  UKR_Kernel {
  UKR_KERNEL_UNKNOWN = 0, UKR_KERNEL_GAUSSIAN = 1, UKR_KERNEL_SPARSE = 100, UKR_KERNEL_QUARTIC = 102,
  UKR_KERNEL_TRIWEIGHT = 103
}
enum  UKR_Loss {
  UKR_LOSS_UNKNOWN = -1, UKR_LOSS_L2 = 0, UKR_LOSS_HUBER = 1, UKR_LOSS_EPS2 = 2,
  UKR_LOSS_EPS = 3
}

Functions

Ukr_bp_dists_sparse ukr_get_kernel_sparse (UKR_Kernel kernel)
Ukr_bp_dists_full ukr_get_kernel_full (UKR_Kernel kernel)
double ukr_f (double *f, const double *x, UKR_Model model)
double ukr_fJ (double *f, double *J, const double *x, UKR_Model model)
double ukr_bp_dists_gaussian (int M, const double *dist, double *b, double *p, int numExclude, const int *exclude, int normalize)
double ukr_bp_dists_quartic (int M, const double *dist, double *b, double *p, int *ir, int *nz, int numExclude, const int *exclude, int normalize)
double ukr_bp_dists_triweight (int M, const double *dist, double *b, double *p, int *ir, int *nz, int numExclude, const int *exclude, int normalize)
double ukr_loss_function (int col, double *yr, const double *y, UKR_Model model)
UKR_Kernel ukr_kernel_by_name (const char *name)
UKR_Loss ukr_loss_by_name (const char *name)
double ukr_errgrad (double *grad, UKR_Model model, int forceCV)
double ukr_errgrad_scale (double *grad, const double *s, UKR_Model model, int forceCV)
int ukr_dens_penalty (double *pen, double *grad, UKR_Model model)
int ukr_densvar_penalty (double *pen, double *grad, UKR_Model model)
int ukr_aux_dens_penalty_sparse (double *pen, double *grad, UKR_Model model)
int ukr_aux_dens_penalty_full (double *pen, double *grad, UKR_Model model)
int ukr_aux_densvar_penalty_sparse (double *pen, double *grad, UKR_Model model)
int ukr_aux_densvar_penalty_full (double *pen, double *grad, UKR_Model model)
double ukr_aux_errgrad_sparse (double *grad, UKR_Model model, int forceCV)
double ukr_aux_errgrad_full (double *grad, UKR_Model model, int forceCV)
double ukr_aux_errgrad_scale_sparse (double *grad, const double *s, UKR_Model model, int forceCV)
double ukr_aux_errgrad_scale_full (double *grad, const double *s, UKR_Model model, int forceCV)
double ukr_aux_M (int col, double *M, double *B, double *tmp_d, UKR_Model model)
double ukr_aux_M_sp (int col, double *M, const double *B, const int *ir, int nz, double *tmp_d, UKR_Model model)
void ukr_aux_R (double *R, const double *B, const double *P, const double *M, int n)
void ukr_aux_addXv_sp (double *u, const double *X, const double *v, const int *ir, int nz, int q)
void ukr_aux_add_xvT_sp (double *U, const double *x, const double *v, const int *ir, int nz, int q)
void ukr_aux_addXv (double *u, const double *X, const double *v, int q, int N)
void ukr_aux_add_xvT (double *U, const double *x, const double *v, int q, int N)
void ukr_aux_subX_diag (double *grad, const double *X, const double *sumR, int q, int N)
void ukr_aux_scaleX (double *sX, double *XX, const double *X, const double *s, int q, int N)
void ukr_aux_Jb_sparse (double *J, const double *b, const double *p, const double *x, const int *ir, int nnz, UKR_Model model)
void ukr_aux_Jb_full (double *J, const double *b, const double *p, const double *x, UKR_Model model)
void ukr_aux_f_sparse (double *f, const double *b, const int *ir, int nz, UKR_Model model)
void ukr_aux_f_full (double *f, const double *b, UKR_Model model)
void ukr_aux_Jf_sparse (double *Jf, const double *b, const double *p, const double *x, const int *ir, int nnz, UKR_Model model)
void ukr_aux_Jf_full (double *Jf, const double *b, const double *p, const double *x, UKR_Model model)
int ukr_aux_alloc_g_struct (UKR_Model model, UKR_G_Struct *gs)
void ukr_aux_free_g_struct (UKR_G_Struct gs)
double ukr_g_congrad (double *g, const double *x, UKR_Model model, UKR_G_Struct gs)
double ukr_g_errgradhess (double *g, double *H, const double *x, UKR_Model model, UKR_G_Struct ukr_gs, int bp_ready)
void ukr_aux_normalize_gs (UKR_Model model, UKR_G_Struct ukr_gs)


Detailed Description

UKR Toolbox header file.

This C library provides some low level functions of the UKR algorithm. It mainly servers as the basis for the MEX-replacements of sume functions within the Matlab UKR toolbox, but it can be used without Matlab.

For easy inter-operatability, the data format of full and sparse vectors and matrices used in this library is that of Matlab (or Fortran). That is, vectors are just arrays of doubles. Matrices are also 1-D arrays of doubles, with the elements stored in column-major order. A 2x2 matrix

\[M = \left(\begin{array}{cc} m_{11} & m_{12} \\ m_{21} & m_{22} \end{array}\right)\]

is thus stored as

         double M[4] = {m11,m21,m12,m22};

Typedef Documentation

typedef double(* Ukr_bp_dists_full)(int, const double *, double *, double *, int, const int *, int)
 

Ukr_bp_dists_full is the general type of functions which calculate vectors of kernel functions, outer derivatives and the sum of basis functions from a vector of distances for a non-sparse density kernel.

See also:
ukr_bp_dists_gaussian

typedef double(* Ukr_bp_dists_sparse)(int, const double *, double *, double *, int *, int *, int, const int *, int)
 

Ukr_bp_dists_sparse is the general type of functions which calculate vectors of kernel functions, outer derivatives and the sum of basis functions from a vector of distances for a sparse density kernel.

See also:
ukr_bp_dists_quartic

ukr_bp_dists_triweight


Enumeration Type Documentation

enum UKR_Kernel
 

Enumeration of density kernels that the UKR toolbox provides

Enumerator:
UKR_KERNEL_UNKNOWN  unknown kernel
UKR_KERNEL_GAUSSIAN  Gaussian kernel
UKR_KERNEL_SPARSE  Placeholder only, kernels with finite support get numbers > 100
UKR_KERNEL_QUARTIC  Quartic kernel, square of Epanechnikov
UKR_KERNEL_TRIWEIGHT  Triweight kernel (Epanechnikov kernel raised to power 3)

enum UKR_Loss
 

Enumeration of loss functions that the UKR toolbox provides

Enumerator:
UKR_LOSS_UNKNOWN  unknown loss function
UKR_LOSS_L2  standard squared Euclidean loss function
UKR_LOSS_HUBER  Hubers robust loss function
UKR_LOSS_EPS2  Rotation symmetric epsilon-insensitive loss function
UKR_LOSS_EPS  epsilon-insensitive loss function


Function Documentation

double ukr_bp_dists_gaussian int  M,
const double *  dist,
double *  b,
double *  p,
int  numExclude,
const int *  exclude,
int  normalize
 

Evaluates the Gaussian kernel as a function of the squared euclidean distance

Parameters:
[in] M length of the vector dist
[in] dist vector containing the distances
[out] b resulting vector of basis functions (Gaussian kernel), must point to an array of at least M doubles
[out] p vector of outer derivatives, may be NULL, or must point to an array of at least M doubles
[in] numExclude the number of elements to exclude from evaluation
For normal usage, pass numExclude=0
[in] exclude the elements to exclude.
This is useful for Leave-One-Out or Leave-K-Out cross-validation.
Elements are excluded by setting their entry in b and p to 0.
[in] normalize This flag determines if b should be normalized to |b|=1
If normalization is desired (normalize!=0) gets scaled as well
Returns:
Sum of basis functions (=|b|) before normalization, or -1.0 if an error occured

double ukr_bp_dists_quartic int  M,
const double *  dist,
double *  b,
double *  p,
int *  ir,
int *  nz,
int  numExclude,
const int *  exclude,
int  normalize
 

Evaluates the Quartic kernel as a function of the squared euclidean distance

Parameters:
[in] M the length of the vector dist
[in] dist the vector containing the distances
[out] b resulting vector of basis functions (Quartic kernel) in sparse storage, must point to an array of at least M doubles
[out] p vector of outer derivatives in sparse storage. May be NULL, or must point to an array of at least M doubles
[out] ir vector of indexes of non-zero basis functions, must point to an array of at least M doubles
[out] nz number of non-zero basis functions
[in] numExclude the number of elements to exclude from evaluation
For normal usage, pass numExclude=0
[in] exclude the elements to exclude.
This is useful for Leave-One-Out or Leave-K-Out cross-validation.
Elements are excluded by setting their entry in b and p to 0.
[in] normalize This flag determines if b should be normalized to |b|=1
If normalization is desired (normalize!=0) gets scaled as well
Returns:
Sum of basis functions (=|b|) before normalization, or -1.0 if an error occured

double ukr_bp_dists_triweight int  M,
const double *  dist,
double *  b,
double *  p,
int *  ir,
int *  nz,
int  numExclude,
const int *  exclude,
int  normalize
 

Evaluates the Quartic kernel as a function of the squared euclidean distance

See also:
ukr_bp_dists_gaussian

double ukr_errgrad double *  grad,
UKR_Model  model,
int  forceCV
 

Evaluate the UKR reconstruction error and (optionally) its gradient

Parameters:
[out] grad Gradient w.r.t. model.X, must be NULL or point to an array of at least q*N doubles
[in] model UKR model, including the current latent variables model.XA pre-calculated neighbor mask can be passed in model.MaskIs and model.MaskJs, in which case leave-K-out cross-validation is used
[in] forceCV If this flag is non-zero, leave-one-out cross-validation is used, regardless of any values in model.MaskIs and model.MaskJs If you want no cross-validation, pass forceCV=0 and model.MaskIs=model.MaskJs=NULL.
Returns:
UKR reconstruction error, or -1.0 if an error occured

double ukr_errgrad_scale double *  grad,
const double *  s,
UKR_Model  model,
int  forceCV
 

Evaluate the UKR reconstruction error and (optionally) its gradient

Parameters:
[out] grad Gradient w.r.t. , must be NULL or point to an array of at least q doubles
[in] scale Scaling factor(s) (inverse bandwidth)
[in] model UKR model, including the current latent variables model.XA pre-calculated neighbor mask can be passed in model.MaskIs and model.MaskJs, in which case leave-K-out cross-validation is used
[in] forceCV If this flag is non-zero, leave-one-out cross-validation is used, regardless of any values in model.MaskIs and model.MaskJs If you want no cross-validation, pass forceCV=0 and model.MaskIs=model.MaskJs=NULL.
Returns:
UKR reconstruction error, or -1.0 if an error occured
See also:
ukr_errgrad

double ukr_f double *  f,
const double *  x,
UKR_Model  model
 

Evaluates the UKR regression function f(x;X) for given a argument x

Returns:
density estimate p(x) in latent space, or -1.0 if an error occured
Parameters:
[out] f resulting function value (must point to an array of at least d doubles)
[in] x position in latent space
[in] model UKR model,
See also:
UKR_Model

double ukr_fJ double *  f,
double *  J,
const double *  x,
UKR_Model  model
 

Evaluates the UKR regression function f(x;X) and its Jacobian matrix for given a argument x

Returns:
density estimate p(x) in latent space, or -1.0 if an error occured
Parameters:
[out] f resulting function value (must point to an array of at least d doubles)
[out] J resulting Jacobian matrix (must point to an array of at least d*q doubles)
[in] x position in latent space
[in] model UKR model,
See also:
UKR_Model

Ukr_bp_dists_full ukr_get_kernel_full UKR_Kernel  kernel  ) 
 

ukr_get_kernel_full returns the right latent kernel function. This is used internally throughout the toolbox. Returns NULL for unsupported kernel types, or if the desired kernel is sparse.

Ukr_bp_dists_sparse ukr_get_kernel_sparse UKR_Kernel  kernel  ) 
 

ukr_get_kernel_sparse returns the right latent kernel function. This is used internally throughout the toolbox. Returns NULL for unsupported kernel types, or if the desired kernel is not sparse.

See also:
ukr_bp_dists_quartic, ukr_bp_dists_triweight

UKR_Kernel ukr_kernel_by_name const char *  name  ) 
 

Select an UKR kernel function by its name, used for Matlab inter-operation

Parameters:
[in] name Kernel function name ("Gaussian", "Quartic", "Triweight")
Returns:
UKR kernel as enumerated in UKR_Kernel

UKR_Loss ukr_loss_by_name const char *  name  ) 
 

Select an UKR loss function by its name, used for Matlab inter-operation

Parameters:
[in] name Loss function name ("L2", "Huber", ...)
Returns:
UKR loss as enumerated in UKR_Loss

double ukr_loss_function int  col,
double *  yr,
const double *  y,
UKR_Model  model
 

Evaluates the loss function as defined by model.loss

Parameters:
[in] col Current column, used only to select the right loss function parameter model.epsilon
[in,out] yr When called, the data vector as reconstructed by the UKR function
At return, the gradient of the loss function w.r.t. yr
[in] y Original data vector
[in] model UKR model
Returns:
Loss function L(yr-y), e.g. the squared euclidean distance between y and yr


Generated on Fri Aug 25 18:00:11 2006 for UKR Toolbox by  doxygen 1.4.3