-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKNN.h
39 lines (35 loc) · 775 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
34
35
36
37
38
39
#ifndef _KNN
#define _KNN
#define NumATT 150
#define NumClasses 3
#define TestSetSize 0.4
#define N (int)(NumATT * (1 - TestSetSize))
//#define N 150
typedef struct Data_Pts
{
int ID;
double SL, SW, PL, PW, distance;
int y; // type
int y_hat; // il est vide (new type)
} Data_Pts;
typedef struct Table_T
{
int n; // taille
Data_Pts *Pts;
} Table_T;
enum Iris
{
setosa,
versicolor,
virginica
};
typedef Data_Pts *Tab_Pts;
void CreateTablePts(Table_T *);
void PrintDPData(const Data_Pts *);
void EucDistance(Data_Pts *, const Data_Pts *);
void EucDistanceAll(Table_T *, const Data_Pts *);
void selectionSort(Table_T *);
void Split_TrainTest(Tab_Pts, Table_T *, Table_T *);
void KNN(Table_T *, Data_Pts *, int);
double Accuracy(Table_T *, Table_T *, int);
#endif