-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathknn.h
33 lines (26 loc) · 768 Bytes
/
knn.h
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
#ifndef __KNN_H
#define __KNN_H
#include <vector>
#include "data.h"
class knn{
int k;
//std::vector<data *> *neighbors;
data ** neighbors; //k neighbors for the query point
std::vector<data *> *training_data;
std::vector<data *> *testing_data;
std::vector<data *> *validation_data;
public:
knn() = default;
knn(int);
~knn();
void find_knearest(data *query_point);
void set_training_data(std::vector<data *> *vect);
void set_testing_data(std::vector<data *> *vect);
void set_validaiton_data(std::vector<data *> *vect);
void set_k(int val);
int predict();
double calculate_distance(data* query_point, data* input);
double validate_performance();
double test_performance();
};
#endif