vw_math.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2009 Yahoo! Inc.  All rights reserved.  The copyrights
00003  * embodied in the content of this file are licensed under the BSD
00004  * (revised) open source license.
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 3 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * Adaptation of Vowpal Wabbit v5.1.
00012  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society.
00013  */
00014 
00015 #ifndef _VW_MATH_H__
00016 #define _VW_MATH_H__
00017 
00018 #include <shogun/lib/common.h>
00019 #include <shogun/mathematics/Math.h>
00020 #include <shogun/classifier/vw/vw_common.h>
00021 
00022 namespace shogun
00023 {
00024 
00033 inline float32_t real_weight(float32_t w,float32_t gravity)
00034 {
00035     float32_t wprime = 0.;
00036     if (gravity < fabsf(w))
00037         wprime = CMath::sign(w)*(fabsf(w) - gravity);
00038     return wprime;
00039 }
00040 
00053 float32_t sd_offset_add(float32_t* weights, vw_size_t mask, VwFeature* begin,
00054             VwFeature* end, vw_size_t offset);
00055 
00071 float32_t sd_offset_truncadd(float32_t* weights, vw_size_t mask, VwFeature* begin,
00072                  VwFeature* end, vw_size_t offset, float32_t gravity);
00073 
00084 float32_t one_pf_quad_predict(float32_t* weights, VwFeature& f,
00085                   v_array<VwFeature> &cross_features, vw_size_t mask);
00086 
00100 float32_t one_pf_quad_predict_trunc(float32_t* weights, VwFeature& f,
00101                     v_array<VwFeature> &cross_features,
00102                     vw_size_t mask, float32_t gravity);
00103 }
00104 #endif // _VW_MATH_H__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation