Classes | Functions
ML::SVM::linear Namespace Reference

Classes

struct  Params
 

Functions

template<typename T >
int fit (const raft::handle_t &handle, const Params &params, const std::size_t nRows, const std::size_t nCols, const int nClasses, const T *classes, const T *X, const T *y, const T *sampleWeight, T *w, T *probScale)
 Fit a linear SVM model. More...
 
template<typename T >
void computeProbabilities (const raft::handle_t &handle, const std::size_t nRows, const int nClasses, const T *probScale, T *scores, T *out)
 Compute probabilities from decision function scores. More...
 

Function Documentation

◆ computeProbabilities()

template<typename T >
void ML::SVM::linear::computeProbabilities ( const raft::handle_t &  handle,
const std::size_t  nRows,
const int  nClasses,
const T *  probScale,
T *  scores,
T *  out 
)

Compute probabilities from decision function scores.

Parameters
[in]handlethe cuML handle.
[in]nRowsthe number of input samples.
[in]nClassesthe number of input classes.
[in]probScalethe probability scales, shape=(nClasses, 2), F-contiguous.
[in,out]scoresthe decision function scores, shape=(nRows, nClasses), C-contiguous. Note that this array will be mutated in-place during the calculation.
[out]outthe computed probabilities, shape=(nRows, nClasses), C-contiguous.

◆ fit()

template<typename T >
int ML::SVM::linear::fit ( const raft::handle_t &  handle,
const Params params,
const std::size_t  nRows,
const std::size_t  nCols,
const int  nClasses,
const T *  classes,
const T *  X,
const T *  y,
const T *  sampleWeight,
T *  w,
T *  probScale 
)

Fit a linear SVM model.

Parameters
[in]handlethe cuML handle.
[in]paramsthe model parameters.
[in]nRowsthe number of input samples.
[in]nColsthe number of feature dimensions.
[in]nClassesthe number of input classes, or 0 for a regression problem.
[in]classesthe unique input classes, shape=(nClasses,), or nullptr for a regression problem.
[in]Xthe training data, shape=(nRows, nCols), F-contiguous
[in]ythe target data, shape=(nRows,)
[in]sampleWeightnon-negative weights for the training data, shape=(nRows,), or nullptr if unweighted.
[out]wthe fitted weights, shape=(nCoefs, nCols) or (nCoefs + 1, nCols + 1) if fit_intercept=true, where nCoefs = 1 for regression or if nClasses = 2, and nClasses otherwise. F-contiguous.
[out]probScalethe fitted probability scales, shape=(nClasses, 2), F-contiguous. Pass nullptr to not fit probability scales.
Returns
n_iter: the maximum number of iterations run across all classes.