svm_model.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2023, NVIDIA CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 namespace ML {
19 namespace SVM {
20 
21 // Contains array(s) for matrix storage
22 template <typename math_t>
24  int nnz = -1;
25  int* indptr = nullptr;
26  int* indices = nullptr;
27  math_t* data = nullptr;
28 };
29 
34 template <typename math_t>
35 struct SvmModel {
36  int n_support;
37  int n_cols;
38  math_t b;
39 
42  math_t* dual_coefs;
43 
46 
49 
50  int n_classes;
52  math_t* unique_labels;
53 };
54 
55 }; // namespace SVM
56 }; // namespace ML
Definition: dbscan.hpp:30
Definition: svm_model.h:23
int * indptr
Definition: svm_model.h:25
math_t * data
Definition: svm_model.h:27
int nnz
Definition: svm_model.h:24
int * indices
Definition: svm_model.h:26
Definition: svm_model.h:35
int * support_idx
Indices (from the training set) of the support vectors, size [n_support].
Definition: svm_model.h:48
int n_support
Number of support vectors.
Definition: svm_model.h:36
SupportStorage< math_t > support_matrix
Support vector storage - can contain either CSR or dense.
Definition: svm_model.h:45
math_t * dual_coefs
Definition: svm_model.h:42
math_t * unique_labels
Device pointer for the unique classes. Size [n_classes].
Definition: svm_model.h:52
int n_classes
Definition: svm_model.h:50
int n_cols
Number of features.
Definition: svm_model.h:37
math_t b
Constant used in the decision function.
Definition: svm_model.h:38