gpuSvmPredict            package:gputools            R Documentation

_A _s_u_p_p_o_r_t _v_e_c_t_o_r _m_a_c_h_i_n_e _s_t_y_l_e _b_i_n_a_r_y _c_l_a_s_s_i_f_i_e_r

_D_e_s_c_r_i_p_t_i_o_n:

     This function classifies points in a dataset with a support vector
     machine using a GPU.  The negative category is represented by -1.f
     and the positive one by 1.f.  The underlying code is adapted from
     Austin Carpenter's cuSVM which can be found at <URL:
     http://patternsonascreen.net/cuSVM.html>

_U_s_a_g_e:

     gpuSvmPredict(data, supportVectors, svCoefficients, svOffset,
             kernelWidth = 0.125, isRegression = FALSE)

_A_r_g_u_m_e_n_t_s:

    data: a matrix of floating point numbers.  Each row will be placed
          into one of two categories -1.f or 1.f.  Note that ncol(data)
          should equal ncol(supportVectors).

supportVectors: a matrix of floating point numbers.  Each row of the
          matrix is a support vector.  This matrix can be obtained from
          gpuSvmTrain, for example.  Note that ncol(supportVector)
          should equal ncol(data).

svCoefficients: a vector of floating point numbers representing 
          coefficients corresponding to the support vectors.  This
          vector can be obtained from gpuSvmTrain, for example.  Each
          support vector supportVectors[i,] has coefficient
          svCoefficients[i].

svOffset: a single floating point number.  It is the offset for the
          prediction function.  The offset can be obtained from
          gpuSvmTrain, for example.

kernelWidth: a single floating point number.  This is the scalar 
          Gaussian kernel parameter.

isRegression: a single logical value indicating if the supportVectors
          result from regression.

_V_a_l_u_e:

     a vector of nrow(data) entries, each either -1.f or 1.f.  Each
     entry i corresponds to the support vector machine's prediction for
     the category of data[i,].

_R_e_f_e_r_e_n_c_e_s:

     Carpenter, Austin, _cuSVM: a cuda implementation of support vector
     classification and regression_, <URL:
     http://http://patternsonascreen.net/cuSVM.html>

_E_x_a_m_p_l_e_s:

     # y is discrete: -1 or 1 and we set isRegression to FALSE
     y <- round(runif(20, min = 0, max = 1))
     for(i in 1:20) { if(y[i] == 0) {y[i] <- -1}}

     x <- matrix(runif(200), 20, 10)

     a <- gpuSvmTrain(y, x, isRegression = FALSE)
     print(a)

     b <- gpuSvmPredict(x, a$supportVectors, a$svCoefficients, a$svOffset,
         isRegression = FALSE)
     print(b)

     # this time around, y : -1 or 1 and we set isRegression to FALSE
     y <- runif(20, min = -1, max = 1)

     x <- matrix(runif(200), 20, 10)

     a <- gpuSvmTrain(y, x, isRegression = TRUE)
     print(a)

     b <- gpuSvmPredict(x, a$supportVectors, a$svCoefficients, a$svOffset,
         isRegression = TRUE)
     print(b)

