diff options
author | John Langford <jl@nyclamp.(none)> | 2014-01-11 00:01:22 +0400 |
---|---|---|
committer | John Langford <jl@nyclamp.(none)> | 2014-01-11 00:01:22 +0400 |
commit | dd6007c0e2016d4c42c6a28cf68960c779cd9297 (patch) | |
tree | b6b4ad5249102b71a149d77b73a72aaa4e420aa8 /vowpalwabbit/sparse_dense.h | |
parent | 86a9b6cface6af2b2948f6bd867149bf1318e651 (diff) |
factored out more things
Diffstat (limited to 'vowpalwabbit/sparse_dense.h')
-rw-r--r-- | vowpalwabbit/sparse_dense.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vowpalwabbit/sparse_dense.h b/vowpalwabbit/sparse_dense.h index 0e9f2164..38c1b691 100644 --- a/vowpalwabbit/sparse_dense.h +++ b/vowpalwabbit/sparse_dense.h @@ -22,8 +22,8 @@ inline float trunc_weight(const float w, const float gravity){ return (gravity < fabsf(w)) ? w - sign(w) * gravity : 0.f; } -inline void vec_add(predict_data<float>& p, float fx, float& fw) { - p.prediction += fw * fx; +inline void vec_add(float& p, float fx, float& fw) { + p += fw * fx; } inline void vec_add_trunc(predict_data<float>& p, float fx, float& fw) { @@ -31,7 +31,7 @@ inline void vec_add_trunc(predict_data<float>& p, float fx, float& fw) { } template <bool adaptive, size_t normalized_idx> -inline void vec_add_rescale(predict_data<float>& p, float fx, float& fw) { +inline void vec_add_rescale(float& p, float fx, float& fw) { weight* w = &fw; float x_abs = fabs(fx); if( x_abs > w[normalized_idx] ) {// new scale discovered @@ -41,7 +41,7 @@ inline void vec_add_rescale(predict_data<float>& p, float fx, float& fw) { } w[normalized_idx] = x_abs; } - p.prediction += fw * fx; + p += fw * fx; } template <bool adaptive, size_t normalized_idx> |