Commit a01cd778 authored by DAUXAIS Yann's avatar DAUXAIS Yann

add discriminant episodes option

parent fb4bc537
......@@ -101,7 +101,8 @@ class Base {
const std::vector<int>&,
const unsigned int&,
std::vector<std::vector<std::vector<int>>>*,
const bool&
const bool,
const bool
) const {return MSetOcc({},{});}
virtual
......
......@@ -262,7 +262,7 @@ class VerticalEventBase : public Base {
const std::vector<int>& episode,
const unsigned int& nb_se
) const {
return compileOccurrences(sub, cepisode, episode, nb_se, NULL, false);
return compileOccurrences(sub, cepisode, episode, nb_se, NULL, false, false);
}
MSetOcc
......@@ -283,7 +283,8 @@ class VerticalEventBase : public Base {
const std::vector<int>& episode,
const unsigned int& nb_se,
std::vector<std::vector<std::vector<int>>>* data,
const bool& p
const bool use_episode,
const bool p
) const {
std::vector<std::vector<std::pair<int,unsigned int>>> occurrences ((episode.size()*(episode.size()-1))/2);
......@@ -295,11 +296,17 @@ class VerticalEventBase : public Base {
std::vector<std::vector<int>> t_res = findAllOccurs(cepisode,episode,nb_se,i,std::vector<int>(),0,0,p);
for (unsigned int a = 0; a < t_res.size(); a++) {
for (unsigned int b = 0; b < t_res[a].size(); b++) {
int duration = t_res[a][b];
if (use_episode) {
if (duration > 0) duration = 1;
else if (duration == 0) duration = 0;
else duration = -1;
}
if (data != NULL) {
t.push_back(t_res[a][b]);
if (p) std::cout << t_res[a][b] << " ";
t.push_back(duration);
if (p) std::cout << duration << " ";
}
occurrences[b].push_back(std::pair<int, unsigned int>(t_res[a][b], i));
occurrences[b].push_back(std::pair<int, unsigned int>(duration, i));
}
if (data != NULL) {
if (p) std::cout << ";" << std::endl;
......
......@@ -102,6 +102,7 @@ CDA::run (
unsigned int maxcs,
bool print,
bool closed,
bool use_episode,
bool irep
) {
std::vector<EMSet> bset;
......@@ -149,8 +150,8 @@ CDA::run (
std::vector<std::vector<std::vector<int>>> data_a;
std::vector<std::vector<std::vector<int>>> data_b;
MSetOcc s1 = trace1.compileOccurrences(ssub1, t.getMSet(), episode, nb_e, &data_a, false);
trace2.compileOccurrences(ssub2, t.getMSet(), episode, nb_e, &data_b, false);
MSetOcc s1 = trace1.compileOccurrences(ssub1, t.getMSet(), episode, nb_e, &data_a, use_episode, false);
trace2.compileOccurrences(ssub2, t.getMSet(), episode, nb_e, &data_b, use_episode, false);
ripper::init(n, data_a, data_b, 1, irep, false);
std::vector<Rule> rules = ripper::run(print, fmin, gmin);
......
......@@ -267,6 +267,7 @@ class CDA {
const unsigned int maxcs,
const bool print,
const bool closed,
const bool use_episode,
const bool irep
);
......
......@@ -53,6 +53,7 @@ public:
po::options_description discriminant("Discriminant chronicles Options");
discriminant.add_options()
("gmin,g", po::value<float>(&gmin), "Minimal growth threshold\ndefault : 2")
("episode,e", "Extract discriminant partially ordered patterns (episodes) instead of chronicles")
;
po::options_description frequent("Frequent chronicles Options");
......@@ -228,6 +229,7 @@ private:
if (vm.count("IBM")) ibm = true;
if (vm.count("all_different")) dif = true;
if (vm.count("close")) close = true;
if (vm.count("episode")) episode = true;
if (vm.count("not_calc_freq")) calc_freq = false;
if (vm.count("json")) txt = false;
if (vm.count("verbose")) verbose = true;
......@@ -360,6 +362,7 @@ public:
bool calc_freq;
bool close;
bool episode;
bool disc;
bool dif;
bool txt;
......@@ -373,7 +376,7 @@ public:
Base* b2;
Options() : gname(""), ibm(false), cwm(0), mincs(0), maxcs(0), gmin(2),
calc_freq(true), close(false), disc(false), dif(false), txt(true), verbose(false),
calc_freq(true), close(false), episode(false), disc(false), dif(false), txt(true), verbose(false),
b(NULL), b2(NULL) {}
};
......@@ -412,7 +415,7 @@ int main(const int argc, char* argv[])
else
disc_exec = algo.run (*options.b, *options.b2, options.minsup, options.gmin,
(int) options.code_events.size(), options.mincs,
options.maxcs, options.verbose, options.close, false);
options.maxcs, options.verbose, options.close, options.episode, false);
delete options.b;
if (options.disc) delete options.b2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment