-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataProcess.h
107 lines (93 loc) · 2.29 KB
/
DataProcess.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
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
#ifndef DATAPROCESS_H
#define DATAPROCESS_H
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <stdlib.h>
#include <time.h>
using namespace std;
int GetnItem(char *FileName);
class DataItem
{
public:
int nhist;
bool scale;
DataItem();
double GetData(unsigned long i);
void SetData(unsigned long i,double value);
void Add(double value);
// void DeleteData(unsigned long i);
double *Histogram(int n=10);
void Scale( double iminv,double imaxv );
void Scale();
void Swap(unsigned long i1,unsigned long i2);
double GetMin();
void SetMin(double value);
double GetMinV();
void SetMinV(double value);
double GetMax();
void SetMax(double value);
double GetMaxV();
void SetMaxV(double value);
double GetAvg();
virtual ~DataItem();
protected:
double min;
double max;
double minv;
double maxv;
double sum;
double hist[20];
double avg;
double stddev;
vector<double> data;
private:
};
// typedef pDataItem DataItem*;
class DataProcess
{
public:
DataProcess();
bool LoadRawData(char * filename);
bool ParseData();
bool WriteData(char *FileName,int nOut, float pTrain);
bool WriteScaleParameters(char *FileName);
DataItem *GetItem(int i);
unsigned long GetNData(){
return nData;
}
unsigned int GetNItem(){
return nItem;
}
void ScaleAll();
void Shuffle();
virtual ~DataProcess();
protected:
vector<double> line_data;
int ReadLine(string line);
vector<DataItem*> items;
unsigned int nItem;
unsigned long nData;
private:
};
// Time Series Reader
class TimeSeri : public DataItem
{
public:
TimeSeri();
bool shuffle;
bool LoadRawData(char *file);
bool WriteData(char *file,float pTrain);
bool WriteScaleParameters(char *FileName);
unsigned long GetNData(){
return (count-nInput-nOutput);
}
virtual ~TimeSeri();
// protected:
long count;
int nInput;
int nOutput;
private:
};
#endif // DATAPROCESS_H