knn_mg.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2024, 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 
17 #pragma once
18 
19 #include <cumlprims/opg/matrix/data.hpp>
20 #include <cumlprims/opg/matrix/part_descriptor.hpp>
21 #include <raft/core/handle.hpp>
22 
23 #include <vector>
24 
25 namespace ML {
26 namespace KNN {
27 namespace opg {
28 
29 using namespace MLCommon;
30 
50 void knn(raft::handle_t& handle,
51  std::vector<Matrix::Data<int64_t>*>* out_I,
52  std::vector<Matrix::floatData_t*>* out_D,
53  std::vector<Matrix::floatData_t*>& idx_data,
54  Matrix::PartDescriptor& idx_desc,
55  std::vector<Matrix::floatData_t*>& query_data,
56  Matrix::PartDescriptor& query_desc,
57  bool rowMajorIndex,
58  bool rowMajorQuery,
59  int k,
60  size_t batch_size,
61  bool verbose);
62 
87 void knn_classify(raft::handle_t& handle,
88  std::vector<Matrix::Data<int>*>* out,
89  std::vector<std::vector<float*>>* probas,
90  std::vector<Matrix::floatData_t*>& idx_data,
91  Matrix::PartDescriptor& idx_desc,
92  std::vector<Matrix::floatData_t*>& query_data,
93  Matrix::PartDescriptor& query_desc,
94  std::vector<std::vector<int*>>& y,
95  std::vector<int*>& uniq_labels,
96  std::vector<int>& n_unique,
97  bool rowMajorIndex = false,
98  bool rowMajorQuery = false,
99  bool probas_only = false,
100  int k = 10,
101  size_t batch_size = 1 << 15,
102  bool verbose = false);
103 
125 void knn_regress(raft::handle_t& handle,
126  std::vector<Matrix::Data<float>*>* out,
127  std::vector<Matrix::floatData_t*>& idx_data,
128  Matrix::PartDescriptor& idx_desc,
129  std::vector<Matrix::floatData_t*>& query_data,
130  Matrix::PartDescriptor& query_desc,
131  std::vector<std::vector<float*>>& y,
132  bool rowMajorIndex,
133  bool rowMajorQuery,
134  int k,
135  int n_outputs,
136  size_t batch_size,
137  bool verbose);
138 
139 }; // END namespace opg
140 }; // namespace KNN
141 }; // namespace ML
Definition: kernelparams.h:21
void knn(raft::handle_t &handle, std::vector< Matrix::Data< int64_t > * > *out_I, std::vector< Matrix::floatData_t * > *out_D, std::vector< Matrix::floatData_t * > &idx_data, Matrix::PartDescriptor &idx_desc, std::vector< Matrix::floatData_t * > &query_data, Matrix::PartDescriptor &query_desc, bool rowMajorIndex, bool rowMajorQuery, int k, size_t batch_size, bool verbose)
void knn_classify(raft::handle_t &handle, std::vector< Matrix::Data< int > * > *out, std::vector< std::vector< float * >> *probas, std::vector< Matrix::floatData_t * > &idx_data, Matrix::PartDescriptor &idx_desc, std::vector< Matrix::floatData_t * > &query_data, Matrix::PartDescriptor &query_desc, std::vector< std::vector< int * >> &y, std::vector< int * > &uniq_labels, std::vector< int > &n_unique, bool rowMajorIndex=false, bool rowMajorQuery=false, bool probas_only=false, int k=10, size_t batch_size=1<< 15, bool verbose=false)
void knn_regress(raft::handle_t &handle, std::vector< Matrix::Data< float > * > *out, std::vector< Matrix::floatData_t * > &idx_data, Matrix::PartDescriptor &idx_desc, std::vector< Matrix::floatData_t * > &query_data, Matrix::PartDescriptor &query_desc, std::vector< std::vector< float * >> &y, bool rowMajorIndex, bool rowMajorQuery, int k, int n_outputs, size_t batch_size, bool verbose)
Definition: dbscan.hpp:30