include/lwpr_aux.h

Go to the documentation of this file.
00001 /*********************************************************************
00002 LWPR: A library for incremental online learning
00003 Copyright (C) 2007  Stefan Klanke, Sethu Vijayakumar
00004 Contact: sethu.vijayakumar@ed.ac.uk
00005 
00006 This library is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU Lesser General Public
00008 License as published by the Free Software Foundation; either 
00009 version 2.1 of the License, or (at your option) any later version.
00010 
00011 This library is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 Library General Public License for more details.
00015 
00016 You should have received a copy of the GNU Lesser General Public
00017 License along with this library; if not, write to the Free
00018 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 *********************************************************************/
00020 
00021 
00027 #ifndef __LWPR_AUX_H
00028 #define __LWPR_AUX_H
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00040 typedef struct LWPR_Workspace {
00041    int *derivOk;           
00042    double *storage;        
00043    double *dx;             
00044    double *dwdM;           
00045    double *dJ2dM;          
00046    double *ddwdMdM;        
00047    double *ddJ2dMdM;       
00048    double *Ps;             
00049    double *Pse;            
00050    double *xu;             
00051    double *yres;           
00052    double *ytarget;        
00053    double *xres;           
00054    double *xc;             
00055    double *xmz;            
00056    double *e_cv;           
00057    double *s;              
00058    double *dsdx;           
00059    double *Dx;             
00060    double *sum_dwdx;       
00061    double *sum_ydwdx_wdydx;
00062    double *sum_ddwdxdx;    
00063    double *sum_ddRdxdx;    
00064 } LWPR_Workspace;
00065 
00066 
00068 typedef struct {
00069    const LWPR_Model *model;
00070    LWPR_Workspace *ws;     
00071    const double *xn;       
00072    int dim;                
00073    double yn;              
00074    double cutoff;          
00075    double w_max;           
00076    double w_sec;           
00077    double sum_w;           
00078    double yp;              
00079    int start;              
00080    int incr;               
00081    int end;                
00082    int ind_max;            
00083    int ind_sec;            
00084 } LWPR_ThreadData;  
00085 
00104 void lwpr_aux_dist_derivatives(int nIn,int nInS, 
00105          double *dwdM, double *dJ2dM, double *ddwdMdM, double *ddJ2dMdM, 
00106          double w, double dwdq, double ddwdqdq, 
00107          const double *RF_D, const double *RF_M, const double *dx,
00108          int diag_only, double penalty, int meta);
00109 
00121 double lwpr_aux_update_distance_metric(LWPR_ReceptiveField *RF, 
00122       double w, double dwdq, double ddwdqdq, 
00123       double e_cv, double e, const double *xn, LWPR_Workspace *ws);
00124 
00133 double lwpr_aux_update_means(LWPR_ReceptiveField *RF, 
00134       const double *x, double y, double w, double *xmz);      
00135       
00147 void lwpr_aux_compute_projection_r(int nIn, int nInS, int nReg, 
00148       double *s, double *xres, const double *x, const double *U, const double *P);         
00149 
00161 void lwpr_aux_compute_projection(int nIn, int nInS, int nReg, 
00162       double *s, const double *x, const double *U, const double *P, LWPR_Workspace *ws);
00163       
00176 void lwpr_aux_compute_projection_d(int nIn, int nInS, int nReg, 
00177       double *s, double *dsdx, const double *x, 
00178       const double *U, const double *P, LWPR_Workspace *ws);      
00179 
00190 void lwpr_aux_update_regression(LWPR_ReceptiveField *RF, double *yp, 
00191       double *e_cv, double *e, const double *x, double y, double w, LWPR_Workspace *ws);
00192 
00199 LWPR_ReceptiveField *lwpr_aux_add_rf(LWPR_SubModel *sub, int nReg);
00200 
00209 int lwpr_aux_check_add_projection(LWPR_ReceptiveField *RF);
00210 
00221 int lwpr_aux_init_rf(LWPR_ReceptiveField *RF, const LWPR_Model *model, 
00222       const LWPR_ReceptiveField *RFT, const double *xc, double y);
00223 
00236 int lwpr_aux_update_one(LWPR_Model *model, int dim, const double *xn, 
00237       double yn, double *y_pred, double *max_w);
00238 
00243 void *lwpr_aux_update_one_T(void *ptr);      
00244 
00256 int lwpr_aux_update_one_add_prune(LWPR_Model *model, LWPR_ThreadData *TD, 
00257       int dim, const double *xn, double yn);   
00258       
00273 double lwpr_aux_predict_one(const LWPR_Model *model, int dim, 
00274       const double *xn, double cutoff, double *conf, double *max_w);         
00275       
00276       
00291 void *lwpr_aux_predict_one_T(void *ptr);
00292 
00309 void *lwpr_aux_predict_conf_one_T(void *ptr);
00310 
00311 
00325 double lwpr_aux_predict_one_J(const LWPR_Model *model, int dim, 
00326       const double *xn, double cutoff, double *dydx);
00327       
00342 double lwpr_aux_predict_one_gH(const LWPR_Model *model, int dim, 
00343       const double *xn, double cutoff, double *dydx, double *ddydxdx);      
00344       
00345       
00361 void *lwpr_aux_predict_one_J_T(void *ptr);
00362 
00363 
00364       
00380 void *lwpr_aux_predict_one_gH_T(void *ptr);
00381 
00382 
00388 void lwpr_aux_update_model_stats(LWPR_Model *model, const double *x);
00389 
00390 #ifdef __cplusplus
00391 }
00392 #endif
00393 
00394 #endif
00395 

Generated on Wed Apr 2 13:44:42 2008 for LWPR Library by  doxygen 1.4.6