NormDerivativeLem3.cpp

Go to the documentation of this file.
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-2009 Soeren Sonnenburg
00008  * Copyright (C) 1999-2009 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/SimpleFeatures.h"
00015 
00016 using namespace shogun;
00017 
00018 CNormDerivativeLem3::CNormDerivativeLem3()
00019 : CSimplePreProc<float64_t>("NormDerivativeLem3", "NDL3")
00020 {
00021 }
00022 
00023 CNormDerivativeLem3::~CNormDerivativeLem3()
00024 {
00025 }
00026 
00028 bool CNormDerivativeLem3::init(CFeatures* f)
00029 {
00030     ASSERT(f->get_feature_class()==C_SIMPLE);
00031     ASSERT(f->get_feature_type()==F_DREAL);
00032 
00033     return true;
00034 }
00035 
00037 void CNormDerivativeLem3::cleanup()
00038 {
00039 }
00040 
00042 bool CNormDerivativeLem3::load(FILE* f)
00043 {
00044     SG_SET_LOCALE_C;
00045     SG_RESET_LOCALE;
00046     return false;
00047 }
00048 
00050 bool CNormDerivativeLem3::save(FILE* f)
00051 {
00052     SG_SET_LOCALE_C;
00053     SG_RESET_LOCALE;
00054     return false;
00055 }
00056 
00060 float64_t* CNormDerivativeLem3::apply_to_feature_matrix(CFeatures* f)
00061 {
00062     return NULL;
00063 }
00064 
00067 float64_t* CNormDerivativeLem3::apply_to_feature_vector(
00068     float64_t* f, int32_t& len)
00069 {
00070     return NULL;
00071 }
00072 
00073 //#warning TODO implement jahau 
00074 //#ifdef JaaHau
00075 // //this is the normalization used in jaahau
00076 //    int32_t o_p=1;
00077 //    float64_t sum_p=0;
00078 //    float64_t sum_q=0;
00079 //    //first do positive model
00080 //    for (i=0; i<pos->get_N(); i++)
00081 //    {
00082 //  featurevector[p]=exp(pos->model_derivative_p(i, x)-posx);
00083 //  sum_p=exp(pos->get_p(i))*featurevector[p++];
00084 //  featurevector[p]=exp(pos->model_derivative_q(i, x)-posx);
00085 //  sum_q=exp(pos->get_q(i))*featurevector[p++];
00086 //
00087 //  float64_t sum_a=0;
00088 //  for (j=0; j<pos->get_N(); j++)
00089 //  {
00090 //      featurevector[p]=exp(pos->model_derivative_a(i, j, x)-posx);
00091 //      sum_a=exp(pos->get_a(i,j))*featurevector[p++];
00092 //  }
00093 //  p-=pos->get_N();
00094 //  for (j=0; j<pos->get_N(); j++)
00095 //      featurevector[p++]-=sum_a;
00096 //
00097 //  float64_t sum_b=0;
00098 //  for (j=0; j<pos->get_M(); j++)
00099 //  {
00100 //      featurevector[p]=exp(pos->model_derivative_b(i, j, x)-posx);
00101 //      sum_b=exp(pos->get_b(i,j))*featurevector[p++];
00102 //  }
00103 //  p-=pos->get_M();
00104 //  for (j=0; j<pos->get_M(); j++)
00105 //      featurevector[p++]-=sum_b;
00106 //    }
00107 //
00108 //    o_p=p;
00109 //    p=1;
00110 //    for (i=0; i<pos->get_N(); i++)
00111 //    {
00112 //  featurevector[p++]-=sum_p;
00113 //  featurevector[p++]-=sum_q;
00114 //    }
00115 //    p=o_p;
00116 //
00117 //    for (i=0; i<neg->get_N(); i++)
00118 //    {
00119 //  featurevector[p]=-exp(neg->model_derivative_p(i, x)-negx);
00120 //  sum_p=exp(neg->get_p(i))*featurevector[p++];
00121 //  featurevector[p]=-exp(neg->model_derivative_q(i, x)-negx);
00122 //  sum_q=exp(neg->get_q(i))*featurevector[p++];
00123 //
00124 //  float64_t sum_a=0;
00125 //  for (j=0; j<neg->get_N(); j++)
00126 //  {
00127 //      featurevector[p]=-exp(neg->model_derivative_a(i, j, x)-negx);
00128 //      sum_a=exp(neg->get_a(i,j))*featurevector[p++];
00129 //  }
00130 //  p-=neg->get_N();
00131 //  for (j=0; j<neg->get_N(); j++)
00132 //      featurevector[p++]-=sum_a;
00133 //
00134 //  float64_t sum_b=0;
00135 //  for (j=0; j<neg->get_M(); j++)
00136 //  {
00137 //      featurevector[p]=-exp(neg->model_derivative_b(i, j, x)-negx);
00138 //      sum_b=exp(neg->get_b(i,j))*featurevector[p++];
00139 //  }
00140 //  p-=neg->get_M();
00141 //  for (j=0; j<neg->get_M(); j++)
00142 //      featurevector[p++]-=sum_b;
00143 //    }
00144 //
00145 //    p=o_p;
00146 //    for (i=0; i<neg->get_N(); i++)
00147 //    {
00148 //  featurevector[p++]-=sum_p;
00149 //  featurevector[p++]-=sum_q;
00150 //    }
00151 //#endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation