forked from raphaelcampos/stacking-bagged-boosted-forests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cuLazyNN_Broof.cuh
69 lines (53 loc) · 1.38 KB
/
cuLazyNN_Broof.cuh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef _cuLazyNN_BROOF__
#define _cuLazyNN_BROOF__
// Gt-kNN
#include "structs.cuh"
#include "utils.cuh"
#include "inverted_index.cuh"
#include "knn.cuh"
#include "cuda_distances.cuh"
#include "LazyNN_RF.h"
#include "cuNearestNeighbors.cuh"
#include <map>
class cuLazyNN_Boost : LazyNN_RF{
public:
/**
* Default constructor.
*/
cuLazyNN_Boost();
/**
* Constructor. Trains the model based on the given training set.
* \param data - Training set
*/
cuLazyNN_Boost(Dataset &data, float max_features = 0.15, int n_boost_iter = 10, int n_gpus = 1);
/**
* Destructor.
*/
~cuLazyNN_Boost();
/**
* Trains the model based on the given training set.
* \param data - Training set
*/
void train(Dataset &data);
/**
* Classify a given feature vector.
* \param test_sample - Feature vector
* \param K - K nearest neighbors to training the random forest
*/
int classify(const std::map<unsigned int, float> &test_sample, int K);
/**
* Classify a given feature vector.
* \param test_sample - Feature vector
* \param K - K nearest neighbors to training the random forest
*/
std::vector<int> classify(Dataset &test, int K);
private:
Dataset training;
cuNearestNeighbors cuKNN;
float max_features;
int n_boost_iter;
// Dataset statistics
unsigned int num_docs;
unsigned int num_terms;
};
#endif