00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 1999-2008 Soeren Sonnenburg 00008 * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society 00009 */ 00010 00011 #include "preproc/NormDerivativeLem3.h" 00012 #include "preproc/SimplePreProc.h" 00013 #include "features/Features.h" 00014 #include "features/RealFeatures.h" 00015 00016 CNormDerivativeLem3::CNormDerivativeLem3() 00017 : CSimplePreProc<float64_t>("NormDerivativeLem3", "NDL3") 00018 { 00019 } 00020 00021 CNormDerivativeLem3::~CNormDerivativeLem3() 00022 { 00023 } 00024 00026 bool CNormDerivativeLem3::init(CFeatures* f) 00027 { 00028 ASSERT(f->get_feature_class()==C_SIMPLE); 00029 ASSERT(f->get_feature_type()==F_DREAL); 00030 00031 return true; 00032 } 00033 00035 void CNormDerivativeLem3::cleanup() 00036 { 00037 } 00038 00040 bool CNormDerivativeLem3::load(FILE* f) 00041 { 00042 return false; 00043 } 00044 00046 bool CNormDerivativeLem3::save(FILE* f) 00047 { 00048 return false; 00049 } 00050 00054 float64_t* CNormDerivativeLem3::apply_to_feature_matrix(CFeatures* f) 00055 { 00056 return NULL; 00057 } 00058 00061 float64_t* CNormDerivativeLem3::apply_to_feature_vector( 00062 float64_t* f, int32_t len) 00063 { 00064 return NULL; 00065 } 00066 00067 //#warning TODO implement jahau 00068 //#ifdef JaaHau 00069 // //this is the normalization used in jaahau 00070 // int32_t o_p=1; 00071 // float64_t sum_p=0; 00072 // float64_t sum_q=0; 00073 // //first do positive model 00074 // for (i=0; i<pos->get_N(); i++) 00075 // { 00076 // featurevector[p]=exp(pos->model_derivative_p(i, x)-posx); 00077 // sum_p=exp(pos->get_p(i))*featurevector[p++]; 00078 // featurevector[p]=exp(pos->model_derivative_q(i, x)-posx); 00079 // sum_q=exp(pos->get_q(i))*featurevector[p++]; 00080 // 00081 // float64_t sum_a=0; 00082 // for (j=0; j<pos->get_N(); j++) 00083 // { 00084 // featurevector[p]=exp(pos->model_derivative_a(i, j, x)-posx); 00085 // sum_a=exp(pos->get_a(i,j))*featurevector[p++]; 00086 // } 00087 // p-=pos->get_N(); 00088 // for (j=0; j<pos->get_N(); j++) 00089 // featurevector[p++]-=sum_a; 00090 // 00091 // float64_t sum_b=0; 00092 // for (j=0; j<pos->get_M(); j++) 00093 // { 00094 // featurevector[p]=exp(pos->model_derivative_b(i, j, x)-posx); 00095 // sum_b=exp(pos->get_b(i,j))*featurevector[p++]; 00096 // } 00097 // p-=pos->get_M(); 00098 // for (j=0; j<pos->get_M(); j++) 00099 // featurevector[p++]-=sum_b; 00100 // } 00101 // 00102 // o_p=p; 00103 // p=1; 00104 // for (i=0; i<pos->get_N(); i++) 00105 // { 00106 // featurevector[p++]-=sum_p; 00107 // featurevector[p++]-=sum_q; 00108 // } 00109 // p=o_p; 00110 // 00111 // for (i=0; i<neg->get_N(); i++) 00112 // { 00113 // featurevector[p]=-exp(neg->model_derivative_p(i, x)-negx); 00114 // sum_p=exp(neg->get_p(i))*featurevector[p++]; 00115 // featurevector[p]=-exp(neg->model_derivative_q(i, x)-negx); 00116 // sum_q=exp(neg->get_q(i))*featurevector[p++]; 00117 // 00118 // float64_t sum_a=0; 00119 // for (j=0; j<neg->get_N(); j++) 00120 // { 00121 // featurevector[p]=-exp(neg->model_derivative_a(i, j, x)-negx); 00122 // sum_a=exp(neg->get_a(i,j))*featurevector[p++]; 00123 // } 00124 // p-=neg->get_N(); 00125 // for (j=0; j<neg->get_N(); j++) 00126 // featurevector[p++]-=sum_a; 00127 // 00128 // float64_t sum_b=0; 00129 // for (j=0; j<neg->get_M(); j++) 00130 // { 00131 // featurevector[p]=-exp(neg->model_derivative_b(i, j, x)-negx); 00132 // sum_b=exp(neg->get_b(i,j))*featurevector[p++]; 00133 // } 00134 // p-=neg->get_M(); 00135 // for (j=0; j<neg->get_M(); j++) 00136 // featurevector[p++]-=sum_b; 00137 // } 00138 // 00139 // p=o_p; 00140 // for (i=0; i<neg->get_N(); i++) 00141 // { 00142 // featurevector[p++]-=sum_p; 00143 // featurevector[p++]-=sum_q; 00144 // } 00145 //#endif