-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cpp
123 lines (95 loc) · 2.65 KB
/
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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//
// Copyright 2011 by
//
#include "HyperNetwork.h"
#include "DataSet.h"
#include "TestLoader.h"
#include "ConventionalBinary.h"
#include "DataSetForConventionalBinary.h"
#include "DataLoaderForConventionalBinary.h"
#include "EEGLoader.h"
#include "EEGSpatioTemporalLM.h"
#include <ctime>
#include <iostream>
#include <fstream>
using namespace std;
using namespace HN;
enum {
HN_ConventionalBinary = 0,
HN_EEGSpatioTemporal = 1,
};
bool ConventionalBinary_Main();
bool EEGSpatioTemporal_Main();
int main()
{
cout << "Select the Hypernetwork." << endl;
cout << "0. Conventional Binary" << endl;
cout << "1. EEG Spatio-Temporal Analysis" << endl;
int HNcase;
cin >> HNcase;
switch( HNcase )
{
case HN_ConventionalBinary:
ConventionalBinary_Main();
break;
case HN_EEGSpatioTemporal:
EEGSpatioTemporal_Main();
break;
}
return 0;
}
bool ConventionalBinary_Main()
{
HyperNetwork* hn = new HyperNetwork();
DataSet* ds1 = new ConvBinDataSet();
DataSet* ds2 = new ConvBinDataSet();
IDataLoader* dataLoader = new TestConvBinLoader( 5, 5, 10, 10 );
dataLoader->LoadData( ds1 );
ofstream fout( "profile.txt" );
clock_t before, after;
IDataLoader* convBinLoader = new ConvBinLoader( "ConvBin_Input.txt" );
before = clock();
//convBinLoader->LoadData( ds2 );
after = clock();
fout << "ConvBinLoader::LoadData(): " << (after - before) / CLOCKS_PER_SEC << " secs" << endl;
ILearningMachine* convBin = new ConvBinLM();
convBin->SetTrainingSet( HDataSet( ds1 ) );
//convBin->SetTrainingSet( HDataSet( ds2 ) );
convBin->Training();
delete convBin;
delete convBinLoader;
delete dataLoader;
before = clock();
// [04/21/2011 kslee]
// There is a severe non-linear temporal behavior during delete.
// Temporarily, delete process is blocked.
//delete ds2;
after = clock();
fout << "DataSet::~DataSet(): " << (after - before) / CLOCKS_PER_SEC << " secs" << endl;
delete ds1;
delete hn;
return true;
}
bool EEGSpatioTemporal_Main()
{
HyperNetwork* hn = new HyperNetwork();
DataSet* ds = new DataSet();
IDataLoader* dataLoader = new EEGLoader( );
dataLoader->LoadData( ds );
//vector<HData> trainingSet;
//for( int i = 0; i < ds->GetNumData(); ++i )
//{
// trainingSet.push_back( ds->GetData( i ) );
//}
ILearningMachine* eegSpatioTemporalLM = new EEGSpatioTemporalLM();
HDataSet trainingSet( ds );
eegSpatioTemporalLM->SetTrainingSet( trainingSet );
eegSpatioTemporalLM->Training();
delete dataLoader;
delete ds;
delete hn;
return true;
return true;
}