-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
136 lines (119 loc) · 4.95 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
124
125
126
127
128
129
130
131
132
133
134
135
136
#include <iostream>
#include <QSqlDatabase>
#include <fstream>
#include "twitteruser.h"
#include "evaluation.h"
#include "utils.h"
using namespace casimiro;
QDateTime START_PROFILE = QDateTime::fromString("2013-01-01 00:00:00", "yyyy-MM-dd HH:mm:ss");
QDateTime END_PROFILE = QDateTime::fromString("2013-07-01 00:00:00", "yyyy-MM-dd HH:mm:ss");
QDateTime START_RETWEETS = QDateTime::fromString("2013-07-01 00:00:01", "yyyy-MM-dd HH:mm:ss");
QDateTime END_RETWEETS = QDateTime::fromString("2013-08-01 00:00:00", "yyyy-MM-dd HH:mm:ss");
int CANDIDATE_PERIOD_IN_HOURS = 48;
void mainTopics()
{
std::cout << "Evaluating regular topics system" << std::endl;
StringIntMaps topicLifeSpanMaps;
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_10"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_20"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_30"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_40"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_50"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_60"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_70"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_80"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_90"));
bool ignoreRetweetsWithNoTimedTopic = false;
bool usePersonalisedLifeSpanMaps = true;
Evaluation evaluation;
evaluation.evaluateSystem(
"data/users.csv",
TopicProfile,
START_PROFILE,
END_PROFILE,
START_RETWEETS,
END_RETWEETS,
CANDIDATE_PERIOD_IN_HOURS,
"data/results20140623.csv",
topicLifeSpanMaps,
ignoreRetweetsWithNoTimedTopic,
usePersonalisedLifeSpanMaps
);
}
void mainBOW()
{
std::cout << "Evaluating BOW system" << std::endl;
StringIntMaps topicLifeSpanMaps;
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/bow_timings_10"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/bow_timings_20"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/bow_timings_30"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/bow_timings_40"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/bow_timings_50"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/bow_timings_60"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/bow_timings_70"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/bow_timings_80"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/bow_timings_90"));
bool ignoreRetweetsWithNoTimedTopic = true;
bool usePersonalisedLifeSpanMaps = true;
Evaluation evaluation;
evaluation.evaluateSystem(
"data/users.csv",
BOWProfile,
START_PROFILE,
END_PROFILE,
START_RETWEETS,
END_RETWEETS,
CANDIDATE_PERIOD_IN_HOURS,
"data/bow_results.csv",
topicLifeSpanMaps,
ignoreRetweetsWithNoTimedTopic,
usePersonalisedLifeSpanMaps
);
}
void mainSVM()
{
std::cout << "Evaluating SVM system" << std::endl;
StringIntMaps topicLifeSpanMaps;
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_10"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_20"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_30"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_40"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_50"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_60"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_70"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_80"));
topicLifeSpanMaps.push_back(BuildTopicLifeSpanMapFromFile("data/timings_90"));
bool ignoreRetweetsWithNoTimedTopic = true;
bool usePersonalisedLifeSpanMaps = false;
Evaluation evaluation;
evaluation.evaluateSystem(
"data/users.csv",
SVMProfile,
START_PROFILE,
END_PROFILE,
START_RETWEETS,
END_RETWEETS,
CANDIDATE_PERIOD_IN_HOURS,
"data/svm_results.csv",
topicLifeSpanMaps,
ignoreRetweetsWithNoTimedTopic,
usePersonalisedLifeSpanMaps
);
}
int main(int /*argc*/, char** /* argv*/)
{
QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
db.setHostName("192.168.1.150");
db.setDatabaseName("tweets");
db.setUserName("tweets");
db.setPassword("zxc123");
if(!db.open())
{
std::cerr << "Could not open database" << std::endl;
return -1;
}
//mainBOW();
//mainTopics();
mainSVM();
return 0;
}