-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
35 lines (29 loc) · 902 Bytes
/
main.cpp
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
#include "perceptron.h"
using namespace std;
int main(int argc, char const *argv[])
{
double **x = new double *[MAX_TAB]; // learning data
double *w = new double[MAX_COL - 1]; // weight vector
double **baseTest = new double *[MAX_TAB]; // test data
int n;
int m;
char fic[] = "baseApprentissage.csv";
char ficTest[] = "baseTest.csv";
chargerBaseExcel(x, fic, n); // load the learning data
chargerBaseExcel(baseTest, ficTest, m); // load the test data
perceptron(w, x, n); // train the perceptron
// print the weight vector
cout << endl
<< "Resulting perceptron : ";
for (int i = 0; i < MAX_COL - 1; i++)
{
cout << w[i] << "\t";
}
cout << endl;
cout << "Test data : " << endl;
testBase(w, baseTest, m);
free(baseTest);
free(x);
free(w);
return 0;
}