-
Notifications
You must be signed in to change notification settings - Fork 1
/
ArffImporter.h
57 lines (41 loc) · 1.17 KB
/
ArffImporter.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef _ARFF_IMPORTER_H_
#define _ARFF_IMPORTER_H_
#include "BasicDataStructures.h"
#include "Helper.h"
#include <stdio.h>
#include <string.h>
using namespace BasicDataStructures;
using namespace MyHelper;
class ArffImporter
{
#define READ_LINE_MAX 5000
#define TOKEN_LENGTH_MAX 35
#define KEYWORD_ATTRIBUTE "@ATTRIBUTE"
#define KEYWORD_DATA "@DATA"
#define KEYWORD_NUMERIC "NUMERIC"
public:
ArffImporter();
~ArffImporter();
void Read( const char* fileName );
std::vector<char*> GetClassAttr();
std::vector<NumericAttr> GetFeatures();
float* GetFeatureMat();
float* GetFeatureMatTrans();
unsigned short* GetClassIndex();
unsigned int GetNumInstances();
unsigned int GetNumFeatures();
private:
void BuildFeatureMatrix();
void Normalize();
void Transpose();
std::vector<char*> classVec;
std::vector<NumericAttr> featureVec;
std::vector<Instance> instanceVec;
float* featureMat = nullptr;
float* featureMatTrans = nullptr;
unsigned short* classArr = nullptr;
unsigned int numFeatures = 0;
unsigned int numInstances = 0;
unsigned short numClasses = 0;
};
#endif