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<DREAL>("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 DREAL* CNormDerivativeLem3::apply_to_feature_matrix(CFeatures* f) 00055 { 00056 return NULL; 00057 } 00058 00061 DREAL* CNormDerivativeLem3::apply_to_feature_vector(DREAL* f, INT len) 00062 { 00063 return NULL; 00064 } 00065 00066 //#warning TODO implement jahau 00067 //#ifdef JaaHau 00068 // //this is the normalization used in jaahau 00069 // INT o_p=1; 00070 // double sum_p=0; 00071 // double sum_q=0; 00072 // //first do positive model 00073 // for (i=0; i<pos->get_N(); i++) 00074 // { 00075 // featurevector[p]=exp(pos->model_derivative_p(i, x)-posx); 00076 // sum_p=exp(pos->get_p(i))*featurevector[p++]; 00077 // featurevector[p]=exp(pos->model_derivative_q(i, x)-posx); 00078 // sum_q=exp(pos->get_q(i))*featurevector[p++]; 00079 // 00080 // double sum_a=0; 00081 // for (j=0; j<pos->get_N(); j++) 00082 // { 00083 // featurevector[p]=exp(pos->model_derivative_a(i, j, x)-posx); 00084 // sum_a=exp(pos->get_a(i,j))*featurevector[p++]; 00085 // } 00086 // p-=pos->get_N(); 00087 // for (j=0; j<pos->get_N(); j++) 00088 // featurevector[p++]-=sum_a; 00089 // 00090 // double sum_b=0; 00091 // for (j=0; j<pos->get_M(); j++) 00092 // { 00093 // featurevector[p]=exp(pos->model_derivative_b(i, j, x)-posx); 00094 // sum_b=exp(pos->get_b(i,j))*featurevector[p++]; 00095 // } 00096 // p-=pos->get_M(); 00097 // for (j=0; j<pos->get_M(); j++) 00098 // featurevector[p++]-=sum_b; 00099 // } 00100 // 00101 // o_p=p; 00102 // p=1; 00103 // for (i=0; i<pos->get_N(); i++) 00104 // { 00105 // featurevector[p++]-=sum_p; 00106 // featurevector[p++]-=sum_q; 00107 // } 00108 // p=o_p; 00109 // 00110 // for (i=0; i<neg->get_N(); i++) 00111 // { 00112 // featurevector[p]=-exp(neg->model_derivative_p(i, x)-negx); 00113 // sum_p=exp(neg->get_p(i))*featurevector[p++]; 00114 // featurevector[p]=-exp(neg->model_derivative_q(i, x)-negx); 00115 // sum_q=exp(neg->get_q(i))*featurevector[p++]; 00116 // 00117 // double sum_a=0; 00118 // for (j=0; j<neg->get_N(); j++) 00119 // { 00120 // featurevector[p]=-exp(neg->model_derivative_a(i, j, x)-negx); 00121 // sum_a=exp(neg->get_a(i,j))*featurevector[p++]; 00122 // } 00123 // p-=neg->get_N(); 00124 // for (j=0; j<neg->get_N(); j++) 00125 // featurevector[p++]-=sum_a; 00126 // 00127 // double sum_b=0; 00128 // for (j=0; j<neg->get_M(); j++) 00129 // { 00130 // featurevector[p]=-exp(neg->model_derivative_b(i, j, x)-negx); 00131 // sum_b=exp(neg->get_b(i,j))*featurevector[p++]; 00132 // } 00133 // p-=neg->get_M(); 00134 // for (j=0; j<neg->get_M(); j++) 00135 // featurevector[p++]-=sum_b; 00136 // } 00137 // 00138 // p=o_p; 00139 // for (i=0; i<neg->get_N(); i++) 00140 // { 00141 // featurevector[p++]-=sum_p; 00142 // featurevector[p++]-=sum_q; 00143 // } 00144 //#endif