|
| csvm (parameter params={}) |
| Construct a C-SVM using the SVM parameter params . More...
|
|
template<typename... Args> |
| csvm (Args &&...args) |
| Construct a C-SVM forwarding all parameters args to the plssvm::parameter constructor. More...
|
|
| csvm (const csvm &)=delete |
| Delete copy-constructor since a CSVM is a move-only type.
|
|
| csvm (csvm &&) noexcept=default |
| Default move-constructor since a virtual destructor has been declared.
|
|
csvm & | operator= (const csvm &)=delete |
| Delete copy-assignment operator since a CSVM is a move-only type. More...
|
|
csvm & | operator= (csvm &&) noexcept=default |
| Default move-assignment operator since a virtual destructor has been declared. More...
|
|
virtual | ~csvm ()=default |
| Virtual destructor to enable safe inheritance.
|
|
target_platform | get_target_platform () const noexcept |
| Return the target platform (i.e, CPU or GPU including the vendor) this SVM runs on. More...
|
|
parameter | get_params () const noexcept |
| Return the currently used SVM parameter. More...
|
|
void | set_params (parameter params) noexcept |
| Override the old SVM parameter with the new plssvm::parameter params . More...
|
|
template<typename... Args, PLSSVM_REQUIRES(detail::has_only_parameter_named_args_v< Args... >) > |
void | set_params (Args &&...named_args) |
| Override the old SVM parameter with the new ones given as named parameters in named_args . More...
|
|
template<typename real_type , typename label_type , typename... Args> |
model< real_type, label_type > | fit (const data_set< real_type, label_type > &data, Args &&...named_args) const |
| Fit a model using the current SVM on the data . More...
|
|
template<typename real_type , typename label_type > |
std::vector< label_type > | predict (const model< real_type, label_type > &model, const data_set< real_type, label_type > &data) const |
| Predict the labels for the data set using the model . More...
|
|
template<typename real_type , typename label_type > |
real_type | score (const model< real_type, label_type > &model) const |
| Calculate the accuracy of the model . More...
|
|
template<typename real_type , typename label_type > |
real_type | score (const model< real_type, label_type > &model, const data_set< real_type, label_type > &data) const |
| Calculate the accuracy of the labeled data set using the model . More...
|
|
|
virtual std::pair< std::vector< float >, float > | solve_system_of_linear_equations (const detail::parameter< float > ¶ms, const std::vector< std::vector< float >> &A, std::vector< float > b, float eps, unsigned long long max_iter) const =0 |
| Solves the equation \(Ax = b\) using the Conjugated Gradients algorithm. More...
|
|
virtual std::pair< std::vector< double >, double > | solve_system_of_linear_equations (const detail::parameter< double > ¶ms, const std::vector< std::vector< double >> &A, std::vector< double > b, double eps, unsigned long long max_iter) const =0 |
| Solves the equation \(Ax = b\) using the Conjugated Gradients algorithm. More...
|
|
virtual std::vector< float > | predict_values (const detail::parameter< float > ¶ms, const std::vector< std::vector< float >> &support_vectors, const std::vector< float > &alpha, float rho, std::vector< float > &w, const std::vector< std::vector< float >> &predict_points) const =0 |
| Uses the already learned model to predict the class of multiple (new) data points. More...
|
|
virtual std::vector< double > | predict_values (const detail::parameter< double > ¶ms, const std::vector< std::vector< double >> &support_vectors, const std::vector< double > &alpha, double rho, std::vector< double > &w, const std::vector< std::vector< double >> &predict_points) const =0 |
| Uses the already learned model to predict the class of multiple (new) data points. More...
|
|
Base class for all C-SVM backends.
This class implements all features shared between all C-SVM backends. It defines the whole public API of a C-SVM.
virtual std::pair<std::vector<float>, float> plssvm::csvm::solve_system_of_linear_equations |
( |
const detail::parameter< float > & |
params, |
|
|
const std::vector< std::vector< float >> & |
A, |
|
|
std::vector< float > |
b, |
|
|
float |
eps, |
|
|
unsigned long long |
max_iter |
|
) |
| const |
|
protectedpure virtual |
virtual std::pair<std::vector<double>, double> plssvm::csvm::solve_system_of_linear_equations |
( |
const detail::parameter< double > & |
params, |
|
|
const std::vector< std::vector< double >> & |
A, |
|
|
std::vector< double > |
b, |
|
|
double |
eps, |
|
|
unsigned long long |
max_iter |
|
) |
| const |
|
protectedpure virtual |
virtual std::vector<float> plssvm::csvm::predict_values |
( |
const detail::parameter< float > & |
params, |
|
|
const std::vector< std::vector< float >> & |
support_vectors, |
|
|
const std::vector< float > & |
alpha, |
|
|
float |
rho, |
|
|
std::vector< float > & |
w, |
|
|
const std::vector< std::vector< float >> & |
predict_points |
|
) |
| const |
|
protectedpure virtual |
Uses the already learned model to predict the class of multiple (new) data points.
- Parameters
-
[in] | params | the SVM parameters used in the respective kernel functions |
[in] | support_vectors | the previously learned support vectors |
[in] | alpha | the alpha values (weights) associated with the support vectors |
[in] | rho | the rho value determined after training the model |
[in,out] | w | the normal vector to speedup prediction in case of the linear kernel function, an empty vector in case of the polynomial or rbf kernel |
[in] | predict_points | the points to predict |
- Exceptions
-
- Returns
- a vector filled with the predictions (not the actual labels!) (
[[nodiscard]]
)
Implemented in plssvm::detail::gpu_csvm< device_ptr_t, queue_t >, plssvm::detail::gpu_csvm< detail::device_ptr, int >, plssvm::detail::gpu_csvm< detail::device_ptr, detail::command_queue >, plssvm::detail::gpu_csvm< detail::device_ptr, detail::queue >, and plssvm::openmp::csvm.
virtual std::vector<double> plssvm::csvm::predict_values |
( |
const detail::parameter< double > & |
params, |
|
|
const std::vector< std::vector< double >> & |
support_vectors, |
|
|
const std::vector< double > & |
alpha, |
|
|
double |
rho, |
|
|
std::vector< double > & |
w, |
|
|
const std::vector< std::vector< double >> & |
predict_points |
|
) |
| const |
|
protectedpure virtual |
Uses the already learned model to predict the class of multiple (new) data points.
- Parameters
-
[in] | params | the SVM parameters used in the respective kernel functions |
[in] | support_vectors | the previously learned support vectors |
[in] | alpha | the alpha values (weights) associated with the support vectors |
[in] | rho | the rho value determined after training the model |
[in,out] | w | the normal vector to speedup prediction in case of the linear kernel function, an empty vector in case of the polynomial or rbf kernel |
[in] | predict_points | the points to predict |
- Exceptions
-
- Returns
- a vector filled with the predictions (not the actual labels!) (
[[nodiscard]]
)
Implemented in plssvm::detail::gpu_csvm< device_ptr_t, queue_t >, plssvm::detail::gpu_csvm< detail::device_ptr, int >, plssvm::detail::gpu_csvm< detail::device_ptr, detail::command_queue >, plssvm::detail::gpu_csvm< detail::device_ptr, detail::queue >, and plssvm::openmp::csvm.