-
Notifications
You must be signed in to change notification settings - Fork 1
/
CTemporal.h
67 lines (54 loc) · 1.56 KB
/
CTemporal.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
#ifndef CTEMPORAL_H
#define CTEMPORAL_H
#include <stdint.h>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <stdint.h>
#include "CTimer.h"
#define MAX_TEMPORAL_MODEL_SIZE 10000
#define MAX_ID_LENGTH 100
using namespace std;
typedef enum{
TT_NONE = 0,
TT_MEAN,
TT_HISTOGRAM,
TT_FREMEN,
TT_HYPER,
TT_PYTHON,
TT_PERGAM,
TT_ADAPTIVE,
TT_MISES,
TT_EXPECTATION,
TT_NUMBER,
}ETemporalType;
class CTemporal
{
public:
//adds a serie of measurements to the data
virtual int add(uint32_t time,float state) = 0;
//initialize
virtual void init(int maxPeriod,int elements,int numActivities) = 0;
//estimates the probability for the given times
virtual float estimate(uint32_t time) = 0;
virtual float predict(uint32_t time) = 0;
virtual void update(int maxOrder,unsigned int* times = NULL,float* signal = NULL,int length = 0) = 0;
virtual void print(bool verbose=true) = 0;
virtual int exportToArray(double* array,int maxLen) = 0;
virtual int importFromArray(double* array,int len) = 0;
virtual int save(FILE* file,bool lossy = false) = 0;
virtual int load(FILE* file) = 0;
virtual int save(const char* name,bool lossy = false) = 0;
virtual int load(const char* name) = 0;
int measurements,order;
int64_t firstTime;
int64_t lastTime;
int numElements;
int maxPeriod;
ETemporalType type;
};
CTemporal* spawnTemporalModel(const char* type,int maxPeriod,int elements,int numClasses);
CTemporal* spawnTemporalModel(ETemporalType type,int maxPeriod,int elements,int numClasses);
#endif