Ignore:
Timestamp:
Feb 23, 2006, 9:52:04 AM (16 years ago)
Author:
Peter
Message:

add prediction functions to SVM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/classifier/Kernel_SEV.cc

    r512 r523  
    1212
    1313
    14 Kernel_SEV::Kernel_SEV(const gslapi::matrix& data, const KernelFunction& kf)
    15   : Kernel(data,kf)
    16 {
    17   kernel_matrix_ = gslapi::matrix(data.columns(),data.columns());
    18   for (size_t i=0; i<kernel_matrix_.rows(); i++)
    19     for (size_t j=i; j<kernel_matrix_.columns(); j++)
    20       kernel_matrix_(i,j) = kernel_matrix_(j,i) =
    21         (*kf_)(gslapi::vector(data_,i,false),gslapi::vector(data_,j,false));
    22 }
     14  Kernel_SEV::Kernel_SEV(const gslapi::matrix& data, const KernelFunction& kf)
     15    : Kernel(data,kf)
     16  {
     17    kernel_matrix_ = gslapi::matrix(data.columns(),data.columns());
     18    for (size_t i=0; i<kernel_matrix_.rows(); i++)
     19      for (size_t j=i; j<kernel_matrix_.columns(); j++)
     20        kernel_matrix_(i,j) = kernel_matrix_(j,i) =
     21          (*kf_)(gslapi::vector(data_,i,false),gslapi::vector(data_,j,false));
     22  }
     23
     24  double Kernel_SEV::element(const gslapi::vector& vec, const size_t i) const
     25  {
     26    return kf_->operator()(vec, gslapi::vector(data_,i));
     27  }
    2328
    2429
Note: See TracChangeset for help on using the changeset viewer.