KSquare Utilities
SVM233::SVR_Q Class Reference
+ Inheritance diagram for SVM233::SVR_Q:

Public Member Functions

 SVR_Q (const svm_problem &prob, const svm_parameter &param)
 
 ~SVR_Q ()
 
Qfloat * get_Q (kkint32 i, kkint32 len) const
 
void swap_index (kkint32 i, kkint32 j) const
 
- Public Member Functions inherited from SVM233::Kernel
 Kernel (kkint32 l, svm_node *const *x, const svm_parameter &param)
 
virtual ~Kernel ()
 

Additional Inherited Members

- Static Public Member Functions inherited from SVM233::Kernel
static double k_function (const svm_node *x, const svm_node *y, const svm_parameter &param)
 
static double k_function_subspace (const svm_node *x, const svm_node *y, const svm_parameter &param, const double *featureWeight)
 
- Protected Attributes inherited from SVM233::Kernel
double(Kernel::* kernel_function )(kkint32 i, kkint32 j) const
 

Detailed Description

Definition at line 2738 of file svm.cpp.

Constructor & Destructor Documentation

SVM233::SVR_Q::SVR_Q ( const svm_problem prob,
const svm_parameter param 
)
inline

Definition at line 2741 of file svm.cpp.

References SVM233::Cache::Cache(), SVM233::svm_parameter::cache_size, SVM233::Kernel::Kernel(), SVM233::svm_problem::l, and SVM233::svm_problem::x.

Referenced by SVM233::solve_epsilon_svr(), and SVM233::solve_nu_svr().

2744  :Kernel (prob.l, prob.x, param)
2745  {
2746  l = prob.l;
2747  cache = new Cache(l,(kkint32)(param.cache_size*(1<<20)));
2748  sign = new schar[2*l];
2749  index = new kkint32[2*l];
2750  for(kkint32 k=0;k<l;k++)
2751  {
2752  sign[k] = 1;
2753  sign[k+l] = -1;
2754  index[k] = k;
2755  index[k+l] = k;
2756  }
2757  buffer[0] = new Qfloat[2*l];
2758  buffer[1] = new Qfloat[2*l];
2759  next_buffer = 0;
2760  }
__int32 kkint32
Definition: KKBaseTypes.h:88
Kernel(kkint32 l, svm_node *const *x, const svm_parameter &param)
Definition: svm.cpp:1609
kkint32 l
Definition: svm.h:48
double cache_size
Definition: svm.h:85
struct svm_node ** x
Definition: svm.h:52
float Qfloat
Definition: svm2.h:287
signed char schar
Definition: svm.cpp:522
SVM233::SVR_Q::~SVR_Q ( )
inline

Definition at line 2788 of file svm.cpp.

2789  {
2790  delete cache;
2791  delete[] sign;
2792  delete[] index;
2793  delete[] buffer[0];
2794  delete[] buffer[1];
2795  }

Member Function Documentation

Qfloat* SVM233::SVR_Q::get_Q ( kkint32  i,
kkint32  len 
) const
inlinevirtual

Implements SVM233::Kernel.

Definition at line 2769 of file svm.cpp.

References SVM233::Cache::get_data(), and SVM233::Kernel::kernel_function.

2770  {
2771  Qfloat *data;
2772  kkint32 real_i = index[i];
2773  if(cache->get_data(real_i,&data,l) < l)
2774  {
2775  for(kkint32 j=0;j<l;j++)
2776  data[j] = (Qfloat)(this->*kernel_function)(real_i,j);
2777  }
2778 
2779  // reorder and copy
2780  Qfloat *buf = buffer[next_buffer];
2781  next_buffer = 1 - next_buffer;
2782  schar si = sign[i];
2783  for(kkint32 j=0;j<len;j++)
2784  buf[j] = si * sign[j] * data[index[j]];
2785  return buf;
2786  }
__int32 kkint32
Definition: KKBaseTypes.h:88
double(Kernel::* kernel_function)(kkint32 i, kkint32 j) const
Definition: svm.cpp:1555
kkint32 get_data(const kkint32 index, Qfloat **data, kkint32 len)
Definition: svm.cpp:1445
float Qfloat
Definition: svm2.h:287
signed char schar
Definition: svm.cpp:522
void SVM233::SVR_Q::swap_index ( kkint32  i,
kkint32  j 
) const
inlinevirtual

Reimplemented from SVM233::Kernel.

Definition at line 2762 of file svm.cpp.

2763  {
2764  Swap(sign[i],sign[j]);
2765  Swap(index[i],index[j]);
2766  }
void Swap(T &x, T &y)
Definition: svm.cpp:687

The documentation for this class was generated from the following file: