effspm 0.2.8__cp39-cp39-win_amd64.whl → 0.3.3__cp39-cp39-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- effspm/_effspm.cp39-win_amd64.pyd +0 -0
- effspm/_effspm.cpp +961 -210
- effspm/btminer/src/build_mdd.cpp +42 -17
- effspm/btminer/src/build_mdd.hpp +13 -19
- effspm/btminer/src/freq_miner.cpp +134 -49
- effspm/btminer/src/freq_miner.hpp +16 -0
- effspm/btminer/src/load_inst.cpp +211 -126
- effspm/btminer/src/load_inst.hpp +22 -4
- effspm/btminer/src/main.cpp +83 -0
- effspm/btminer/src/utility.cpp +26 -41
- effspm/btminer/src/utility.hpp +6 -30
- effspm/freq_miner.hpp +2 -1
- effspm/htminer/src/build_mdd.cpp +46 -124
- effspm/htminer/src/build_mdd.hpp +56 -49
- effspm/htminer/src/freq_miner.cpp +341 -307
- effspm/htminer/src/freq_miner.hpp +39 -40
- effspm/htminer/src/load_inst.cpp +287 -336
- effspm/htminer/src/load_inst.hpp +23 -6
- effspm/htminer/src/main.cpp +97 -0
- effspm/htminer/src/utility.cpp +38 -57
- effspm/htminer/src/utility.hpp +9 -64
- effspm/largebm/src/build_mdd.cpp +69 -110
- effspm/largebm/src/build_mdd.hpp +22 -37
- effspm/largebm/src/freq_miner.cpp +241 -291
- effspm/largebm/src/freq_miner.hpp +25 -36
- effspm/largebm/src/load_inst.cpp +20 -26
- effspm/largebm/src/load_inst.hpp +24 -34
- effspm/largebm/src/main.cpp +95 -0
- effspm/largebm/src/utility.cpp +11 -21
- effspm/largebm/src/utility.hpp +7 -10
- effspm/largehm/src/build_mdd.cpp +75 -110
- effspm/largehm/src/build_mdd.hpp +53 -73
- effspm/largehm/src/freq_miner.cpp +134 -191
- effspm/largehm/src/freq_miner.hpp +37 -60
- effspm/largehm/src/load_inst.cpp +137 -174
- effspm/largehm/src/load_inst.hpp +13 -50
- effspm/largehm/src/main.cpp +95 -0
- effspm/largehm/src/utility.cpp +46 -28
- effspm/largehm/src/utility.hpp +18 -16
- effspm/largepp/src/freq_miner.cpp +184 -156
- effspm/largepp/src/freq_miner.hpp +11 -36
- effspm/largepp/src/load_inst.cpp +32 -12
- effspm/largepp/src/load_inst.hpp +15 -9
- effspm/largepp/src/main.cpp +108 -0
- effspm/largepp/src/pattern.hpp +31 -0
- effspm/load_inst.cpp +8 -8
- effspm/load_inst.hpp +1 -1
- effspm/main.cpp +103 -0
- {effspm-0.2.8.dist-info → effspm-0.3.3.dist-info}/METADATA +1 -1
- effspm-0.3.3.dist-info/RECORD +60 -0
- effspm-0.2.8.dist-info/RECORD +0 -53
- {effspm-0.2.8.dist-info → effspm-0.3.3.dist-info}/WHEEL +0 -0
- {effspm-0.2.8.dist-info → effspm-0.3.3.dist-info}/licenses/LICENSE +0 -0
- {effspm-0.2.8.dist-info → effspm-0.3.3.dist-info}/top_level.txt +0 -0
effspm/largehm/src/build_mdd.cpp
CHANGED
|
@@ -1,173 +1,138 @@
|
|
|
1
|
-
// ─── effspm/largehm/src/build_mdd.cpp ─────────────────────────────────────────
|
|
2
|
-
|
|
3
|
-
#include "build_mdd.hpp"
|
|
4
|
-
|
|
5
|
-
// ─── Definitions of the extern globals declared in build_mdd.hpp ─────────────
|
|
6
|
-
std::vector<largehm::Arc> largehm::Tree;
|
|
7
|
-
std::vector<largehm::VArc> largehm::VTree;
|
|
8
|
-
std::vector<largehm::CArc> largehm::CTree;
|
|
9
|
-
|
|
10
1
|
#include <vector>
|
|
11
2
|
#include <iostream>
|
|
12
|
-
#include <cmath> // for std::abs
|
|
13
3
|
#include <unordered_map>
|
|
14
|
-
#include <cstdint> // for std::uint64_t
|
|
15
4
|
#include "load_inst.hpp"
|
|
5
|
+
#include "build_mdd.hpp"
|
|
16
6
|
#include "freq_miner.hpp"
|
|
17
7
|
#include "utility.hpp"
|
|
18
8
|
|
|
19
9
|
namespace largehm {
|
|
20
10
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
std::unordered_map<int, std::uint64_t> ancest_map;
|
|
28
|
-
std::uint64_t last_arc = 0;
|
|
29
|
-
int itmset = 0;
|
|
11
|
+
using namespace std;
|
|
12
|
+
|
|
13
|
+
int Add_arc(int item,
|
|
14
|
+
unsigned long long int last_arc,
|
|
15
|
+
int& itmset,
|
|
16
|
+
unordered_map<int, unsigned long long int>& ancest_map);
|
|
30
17
|
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
void Add_vec(vector<int>& items_lim,
|
|
19
|
+
unordered_map<int, unsigned long long int>& ancest_map,
|
|
20
|
+
unsigned long long int last_arc,
|
|
21
|
+
int itmset);
|
|
22
|
+
|
|
23
|
+
vector<Arc> Tree;
|
|
24
|
+
vector<VArc> VTree;
|
|
25
|
+
vector<CArc> CTree;
|
|
26
|
+
|
|
27
|
+
void Build_MDD(vector<int>& items, vector<int>& items_lim) {
|
|
28
|
+
|
|
29
|
+
unordered_map<int, unsigned long long int> ancest_map;
|
|
30
|
+
|
|
31
|
+
unsigned long long int last_arc = 0;
|
|
32
|
+
int itmset = 0;
|
|
33
|
+
for (vector<int>::iterator it = items.begin(); it != items.end(); ++it)
|
|
33
34
|
last_arc = Add_arc(*it, last_arc, itmset, ancest_map);
|
|
34
|
-
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
if (!items_lim.empty()) {
|
|
36
|
+
if (!items_lim.empty())
|
|
38
37
|
Add_vec(items_lim, ancest_map, last_arc, itmset);
|
|
39
|
-
}
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
//
|
|
44
|
-
// ─── Add_arc: insert a single “item” into the MDD under parent last_arc. ──────
|
|
45
|
-
//
|
|
46
40
|
int Add_arc(int item,
|
|
47
|
-
|
|
41
|
+
unsigned long long int last_arc,
|
|
48
42
|
int& itmset,
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
// Ensure DFS is at least size |item|
|
|
52
|
-
size_t needed = static_cast<size_t>(std::abs(item));
|
|
53
|
-
if (DFS.size() < needed) {
|
|
54
|
-
size_t old = DFS.size();
|
|
55
|
-
DFS.resize(needed);
|
|
56
|
-
for (size_t i = old; i < needed; ++i) {
|
|
57
|
-
DFS[i] = Pattern(-static_cast<int>(i) - 1);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
43
|
+
unordered_map<int, unsigned long long int>& ancest_map) {
|
|
60
44
|
|
|
61
|
-
unsigned int anct
|
|
62
|
-
|
|
63
|
-
if (p
|
|
45
|
+
unsigned int anct;
|
|
46
|
+
unordered_map<int, unsigned long long int>::iterator p = ancest_map.find(abs(item));
|
|
47
|
+
if (p == ancest_map.end())
|
|
48
|
+
anct = 0;
|
|
49
|
+
else
|
|
64
50
|
anct = p->second;
|
|
65
|
-
}
|
|
66
51
|
|
|
67
|
-
if (item < 0)
|
|
52
|
+
if (item < 0)
|
|
68
53
|
++itmset;
|
|
69
|
-
}
|
|
70
54
|
|
|
71
|
-
|
|
55
|
+
unsigned long long int last_sibl = Tree[last_arc].chld;
|
|
56
|
+
|
|
72
57
|
if (last_sibl == 0) {
|
|
73
|
-
// No child yet: create a new Arc
|
|
74
58
|
Tree.emplace_back(item, itmset, anct);
|
|
75
59
|
last_sibl = Tree.size() - 1;
|
|
76
60
|
Tree[last_arc].chld = last_sibl;
|
|
77
|
-
if (anct == 0)
|
|
78
|
-
DFS[
|
|
79
|
-
|
|
61
|
+
if (anct == 0)
|
|
62
|
+
DFS[abs(item) - 1].str_pnt.push_back(last_sibl);
|
|
63
|
+
|
|
80
64
|
}
|
|
81
65
|
else {
|
|
82
|
-
// Traverse siblings until we find a match or append
|
|
83
66
|
while (Tree[last_sibl].item != item) {
|
|
84
67
|
if (Tree[last_sibl].sibl == 0) {
|
|
85
68
|
Tree.emplace_back(item, itmset, anct);
|
|
86
69
|
Tree[last_sibl].sibl = Tree.size() - 1;
|
|
87
70
|
last_sibl = Tree.size() - 1;
|
|
88
|
-
if (anct == 0)
|
|
89
|
-
DFS[
|
|
90
|
-
}
|
|
71
|
+
if (anct == 0)
|
|
72
|
+
DFS[abs(item) - 1].str_pnt.push_back(last_sibl);
|
|
91
73
|
break;
|
|
92
74
|
}
|
|
93
75
|
last_sibl = Tree[last_sibl].sibl;
|
|
94
76
|
}
|
|
95
77
|
}
|
|
96
78
|
|
|
97
|
-
if (anct == 0)
|
|
98
|
-
++DFS[
|
|
99
|
-
|
|
79
|
+
if (anct == 0)
|
|
80
|
+
++DFS[abs(item) - 1].freq;
|
|
81
|
+
|
|
100
82
|
++Tree[last_sibl].freq;
|
|
101
|
-
ancest_map[std::abs(item)] = last_sibl;
|
|
102
|
-
return static_cast<int>(last_sibl);
|
|
103
|
-
}
|
|
104
83
|
|
|
84
|
+
ancest_map[abs(item)] = last_sibl;
|
|
105
85
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
void Add_vec(
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
int itmset)
|
|
113
|
-
{
|
|
114
|
-
// Ensure VDFS and DFS are at least size L
|
|
115
|
-
if (VDFS.size() < static_cast<size_t>(L)) {
|
|
116
|
-
size_t old = VDFS.size();
|
|
117
|
-
VDFS.resize(static_cast<size_t>(L));
|
|
118
|
-
for (size_t i = old; i < VDFS.size(); ++i) {
|
|
119
|
-
VDFS[i] = VPattern(static_cast<int>(i));
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (DFS.size() < static_cast<size_t>(L)) {
|
|
123
|
-
size_t old = DFS.size();
|
|
124
|
-
DFS.resize(static_cast<size_t>(L));
|
|
125
|
-
for (size_t i = old; i < DFS.size(); ++i) {
|
|
126
|
-
DFS[i] = Pattern(-static_cast<int>(i) - 1);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
86
|
+
return last_sibl;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
void Add_vec(vector<int>& items_lim,
|
|
90
|
+
unordered_map<int, unsigned long long int>& ancest_map,
|
|
91
|
+
unsigned long long int last_arc,
|
|
92
|
+
int itmset) {
|
|
129
93
|
|
|
130
94
|
items_lim.shrink_to_fit();
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
ancest[
|
|
138
|
-
counted[
|
|
95
|
+
vector<bool> counted(L, 0);
|
|
96
|
+
|
|
97
|
+
if (Tree[last_arc].itmset > 0) {
|
|
98
|
+
vector<unsigned long long int> ancest(L + 1, 0); // last element is CArc child
|
|
99
|
+
for (unordered_map<int, unsigned long long int>::iterator p = ancest_map.begin();
|
|
100
|
+
p != ancest_map.end(); ++p) {
|
|
101
|
+
ancest[p->first - 1] = p->second;
|
|
102
|
+
counted[p->first - 1] = 1;
|
|
139
103
|
}
|
|
140
|
-
for (int i = 0; i <
|
|
141
|
-
int cur_itm =
|
|
104
|
+
for (int i = 0; i < (int)items_lim.size(); ++i) {
|
|
105
|
+
int cur_itm = abs(items_lim[i]);
|
|
142
106
|
if (!counted[cur_itm - 1]) {
|
|
143
|
-
if (i + 1 <
|
|
144
|
-
VDFS[cur_itm - 1].str_pnt.push_back(-i - 1);
|
|
107
|
+
if (i + 1 < (int)items_lim.size()) {
|
|
108
|
+
VDFS[cur_itm - 1].str_pnt.push_back(-i - 1); // negative = CTree
|
|
145
109
|
VDFS[cur_itm - 1].seq_ID.push_back(CTree.size());
|
|
146
110
|
}
|
|
147
111
|
++DFS[cur_itm - 1].freq;
|
|
148
|
-
counted[cur_itm - 1] =
|
|
112
|
+
counted[cur_itm - 1] = 1;
|
|
149
113
|
}
|
|
150
114
|
}
|
|
151
115
|
CTree.emplace_back(ancest, items_lim);
|
|
152
|
-
Tree[last_arc].chld
|
|
153
|
-
Tree[last_arc].itmset = -itmset;
|
|
116
|
+
Tree[last_arc].chld = CTree.size() - 1;
|
|
117
|
+
Tree[last_arc].itmset = -itmset; // negative itmset = connection to CTree
|
|
154
118
|
}
|
|
155
119
|
else {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (i + 1 < static_cast<int>(items_lim.size())) {
|
|
120
|
+
vector<unsigned long long int>& ancest = CTree[Tree[last_arc].chld].ancest;
|
|
121
|
+
for (int i = 0; i < (int)items_lim.size(); ++i) {
|
|
122
|
+
int cur_itm = abs(items_lim[i]);
|
|
123
|
+
if (!counted[cur_itm - 1] && ancest[cur_itm - 1] == 0) {
|
|
124
|
+
if (i + 1 < (int)items_lim.size()) {
|
|
162
125
|
VDFS[cur_itm - 1].str_pnt.push_back(i + 1);
|
|
163
126
|
VDFS[cur_itm - 1].seq_ID.push_back(VTree.size());
|
|
164
127
|
}
|
|
165
128
|
++DFS[cur_itm - 1].freq;
|
|
166
|
-
counted[cur_itm - 1] =
|
|
129
|
+
counted[cur_itm - 1] = 1;
|
|
167
130
|
}
|
|
168
131
|
}
|
|
169
|
-
VTree.emplace_back(items_lim,
|
|
170
|
-
|
|
132
|
+
VTree.emplace_back(items_lim,
|
|
133
|
+
CTree[Tree[last_arc].chld].ancest.back());
|
|
134
|
+
// VTree siblings and CTree children are +1 of their actual position
|
|
135
|
+
CTree[Tree[last_arc].chld].ancest.back() = VTree.size();
|
|
171
136
|
}
|
|
172
137
|
}
|
|
173
138
|
|
effspm/largehm/src/build_mdd.hpp
CHANGED
|
@@ -1,93 +1,73 @@
|
|
|
1
|
-
#
|
|
2
|
-
#define LARGEHM_BUILD_MDD_HPP
|
|
1
|
+
#pragma once
|
|
3
2
|
|
|
4
3
|
#include <vector>
|
|
5
|
-
#include <
|
|
6
|
-
#include
|
|
7
|
-
#include <cstdint> // for uint64_t
|
|
8
|
-
|
|
9
|
-
#include "load_inst.hpp" // defines L, DFS, VDFS, Tree, etc.
|
|
10
|
-
#include "freq_miner.hpp" // for Pattern, VPattern
|
|
11
|
-
#include "utility.hpp" // if you need check_parent or collected
|
|
4
|
+
#include <cmath>
|
|
5
|
+
#include "load_inst.hpp"
|
|
12
6
|
|
|
13
7
|
namespace largehm {
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
int Add_arc(int item,
|
|
39
|
-
std::uint64_t last_arc,
|
|
40
|
-
int& itmset,
|
|
41
|
-
std::unordered_map<int, std::uint64_t>& ancest_map);
|
|
42
|
-
|
|
43
|
-
void Add_vec(std::vector<int>& items_lim,
|
|
44
|
-
std::unordered_map<int, std::uint64_t>& ancest_map,
|
|
45
|
-
std::uint64_t last_arc,
|
|
46
|
-
int itmset);
|
|
47
|
-
|
|
48
|
-
//
|
|
49
|
-
// ─── Struct Definitions ───────────────────────────────────────────────────────
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
struct Arc {
|
|
53
|
-
int item;
|
|
54
|
-
int itmset;
|
|
55
|
-
std::uint64_t anct;
|
|
56
|
-
std::uint64_t chld;
|
|
57
|
-
std::uint64_t sibl;
|
|
58
|
-
unsigned long long freq;
|
|
9
|
+
using namespace std;
|
|
10
|
+
|
|
11
|
+
void Build_MDD(vector<int>& items, vector<int>& items_lim);
|
|
12
|
+
|
|
13
|
+
class Arc {
|
|
14
|
+
public:
|
|
15
|
+
unsigned long long int chld;
|
|
16
|
+
unsigned long long int sibl;
|
|
17
|
+
unsigned long long int freq;
|
|
18
|
+
unsigned long long int anct;
|
|
19
|
+
int itmset;
|
|
20
|
+
int item;
|
|
21
|
+
|
|
22
|
+
Arc(unsigned int _itm, int _itmset, unsigned long long int _anc) {
|
|
23
|
+
chld = 0;
|
|
24
|
+
sibl = 0;
|
|
25
|
+
freq = 0;
|
|
26
|
+
itmset = _itmset;
|
|
27
|
+
anct = _anc;
|
|
28
|
+
item = _itm;
|
|
29
|
+
}
|
|
59
30
|
|
|
60
|
-
Arc(
|
|
61
|
-
|
|
62
|
-
|
|
31
|
+
Arc() {
|
|
32
|
+
chld = 0;
|
|
33
|
+
sibl = 0;
|
|
34
|
+
freq = 0;
|
|
35
|
+
anct = 0;
|
|
36
|
+
itmset = 0;
|
|
37
|
+
item = 0;
|
|
38
|
+
}
|
|
63
39
|
};
|
|
64
40
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
41
|
+
class VArc {
|
|
42
|
+
public:
|
|
43
|
+
unsigned long long int sibl;
|
|
44
|
+
vector<int> seq;
|
|
69
45
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
{
|
|
46
|
+
VArc(vector<int>& items, unsigned long long int _sib) {
|
|
47
|
+
sibl = _sib;
|
|
73
48
|
seq.swap(items);
|
|
74
49
|
}
|
|
50
|
+
|
|
51
|
+
VArc() {
|
|
52
|
+
sibl = 0;
|
|
53
|
+
}
|
|
75
54
|
};
|
|
76
55
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
unsigned long long
|
|
56
|
+
class CArc {
|
|
57
|
+
public:
|
|
58
|
+
vector<int> seq;
|
|
59
|
+
vector<unsigned long long int> ancest;
|
|
81
60
|
|
|
82
|
-
|
|
83
|
-
std::vector<int>& items)
|
|
84
|
-
: ancest(), seq(), freq(0u)
|
|
85
|
-
{
|
|
61
|
+
CArc(vector<unsigned long long int>& _anc, vector<int>& items) {
|
|
86
62
|
ancest.swap(_anc);
|
|
87
63
|
seq.swap(items);
|
|
88
64
|
}
|
|
65
|
+
|
|
66
|
+
CArc() = default;
|
|
89
67
|
};
|
|
90
68
|
|
|
91
|
-
|
|
69
|
+
extern vector<Arc> Tree;
|
|
70
|
+
extern vector<VArc> VTree;
|
|
71
|
+
extern vector<CArc> CTree;
|
|
92
72
|
|
|
93
|
-
|
|
73
|
+
} // namespace largehm
|