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.
Files changed (54) hide show
  1. effspm/_effspm.cp39-win_amd64.pyd +0 -0
  2. effspm/_effspm.cpp +961 -210
  3. effspm/btminer/src/build_mdd.cpp +42 -17
  4. effspm/btminer/src/build_mdd.hpp +13 -19
  5. effspm/btminer/src/freq_miner.cpp +134 -49
  6. effspm/btminer/src/freq_miner.hpp +16 -0
  7. effspm/btminer/src/load_inst.cpp +211 -126
  8. effspm/btminer/src/load_inst.hpp +22 -4
  9. effspm/btminer/src/main.cpp +83 -0
  10. effspm/btminer/src/utility.cpp +26 -41
  11. effspm/btminer/src/utility.hpp +6 -30
  12. effspm/freq_miner.hpp +2 -1
  13. effspm/htminer/src/build_mdd.cpp +46 -124
  14. effspm/htminer/src/build_mdd.hpp +56 -49
  15. effspm/htminer/src/freq_miner.cpp +341 -307
  16. effspm/htminer/src/freq_miner.hpp +39 -40
  17. effspm/htminer/src/load_inst.cpp +287 -336
  18. effspm/htminer/src/load_inst.hpp +23 -6
  19. effspm/htminer/src/main.cpp +97 -0
  20. effspm/htminer/src/utility.cpp +38 -57
  21. effspm/htminer/src/utility.hpp +9 -64
  22. effspm/largebm/src/build_mdd.cpp +69 -110
  23. effspm/largebm/src/build_mdd.hpp +22 -37
  24. effspm/largebm/src/freq_miner.cpp +241 -291
  25. effspm/largebm/src/freq_miner.hpp +25 -36
  26. effspm/largebm/src/load_inst.cpp +20 -26
  27. effspm/largebm/src/load_inst.hpp +24 -34
  28. effspm/largebm/src/main.cpp +95 -0
  29. effspm/largebm/src/utility.cpp +11 -21
  30. effspm/largebm/src/utility.hpp +7 -10
  31. effspm/largehm/src/build_mdd.cpp +75 -110
  32. effspm/largehm/src/build_mdd.hpp +53 -73
  33. effspm/largehm/src/freq_miner.cpp +134 -191
  34. effspm/largehm/src/freq_miner.hpp +37 -60
  35. effspm/largehm/src/load_inst.cpp +137 -174
  36. effspm/largehm/src/load_inst.hpp +13 -50
  37. effspm/largehm/src/main.cpp +95 -0
  38. effspm/largehm/src/utility.cpp +46 -28
  39. effspm/largehm/src/utility.hpp +18 -16
  40. effspm/largepp/src/freq_miner.cpp +184 -156
  41. effspm/largepp/src/freq_miner.hpp +11 -36
  42. effspm/largepp/src/load_inst.cpp +32 -12
  43. effspm/largepp/src/load_inst.hpp +15 -9
  44. effspm/largepp/src/main.cpp +108 -0
  45. effspm/largepp/src/pattern.hpp +31 -0
  46. effspm/load_inst.cpp +8 -8
  47. effspm/load_inst.hpp +1 -1
  48. effspm/main.cpp +103 -0
  49. {effspm-0.2.8.dist-info → effspm-0.3.3.dist-info}/METADATA +1 -1
  50. effspm-0.3.3.dist-info/RECORD +60 -0
  51. effspm-0.2.8.dist-info/RECORD +0 -53
  52. {effspm-0.2.8.dist-info → effspm-0.3.3.dist-info}/WHEEL +0 -0
  53. {effspm-0.2.8.dist-info → effspm-0.3.3.dist-info}/licenses/LICENSE +0 -0
  54. {effspm-0.2.8.dist-info → effspm-0.3.3.dist-info}/top_level.txt +0 -0
@@ -7,186 +7,108 @@
7
7
 
8
8
  namespace htminer {
9
9
 
10
- // Forward declarations (unchanged)
11
- int Add_arc(int item, unsigned int last_arc, int& itmset, std::vector<unsigned int>& ancest_map);
12
- void Add_vec(std::vector<int>& items_lim, std::vector<unsigned int>& ancest_map, unsigned int last_arc, int itmset);
10
+ using std::vector;
13
11
 
14
- // Global trees (unchanged)
15
- std::vector<Arc> Tree;
16
- std::vector<VArc> VTree;
17
- std::vector<CArc> CTree;
12
+ int Add_arc(int item, unsigned int last_arc, int& itmset, vector<unsigned int>& ancest_map);
13
+ void Add_vec(vector<int>& items_lim, vector<unsigned int>& ancest_map, unsigned int last_arc, int itmset);
18
14
 
19
- void Build_MDD(std::vector<int>& items, std::vector<int>& items_lim) {
20
- // DEBUG: entry into Build_MDD
21
- // std::cerr << "[HTMiner::Build_MDD] called with items.size()=" << items.size()
22
- // << " items_lim.size()=" << items_lim.size() << std::endl;
15
+ vector<Arc> Tree;
16
+ vector<VArc> VTree;
17
+ vector<CArc> CTree;
23
18
 
24
- // // Prepare ancestor map of size L
25
- std::vector<unsigned int> ancest_map(L, 0);
19
+ void Build_MDD(vector<int>& items, vector<int>& items_lim) {
20
+
21
+ vector<unsigned int> ancest_map(L, 0);
26
22
 
27
23
  unsigned int last_arc = 0;
28
24
  int itmset = 0;
25
+ for (vector<int>::iterator it = items.begin(); it != items.end(); ++it)
26
+ last_arc = Add_arc(*it, last_arc, itmset, ancest_map);
29
27
 
30
- // Iterate over items
31
- for (size_t idx = 0; idx < items.size(); ++idx) {
32
- int curr_item = items[idx];
33
- // std::cerr << "[HTMiner::Build_MDD] processing items[" << idx
34
- // << "]=" << curr_item << " last_arc=" << last_arc
35
- // << " itmset=" << itmset << std::endl;
36
-
37
- last_arc = Add_arc(curr_item, last_arc, itmset, ancest_map);
38
-
39
- // std::cerr << "[HTMiner::Build_MDD] returned from Add_arc, new last_arc="
40
- // << last_arc << " itmset=" << itmset << std::endl;
41
- }
42
-
43
- // If there are limited items, handle them
44
- if (!items_lim.empty()) {
45
- // std::cerr << "[HTMiner::Build_MDD] items_lim is not empty; size="
46
- // << items_lim.size() << std::endl;
28
+ if (!items_lim.empty())
47
29
  Add_vec(items_lim, ancest_map, last_arc, itmset);
48
- // std::cerr << "[HTMiner::Build_MDD] returned from Add_vec" << std::endl;
49
- } else {
50
- // std::cerr << "[HTMiner::Build_MDD] items_lim is empty; skipping Add_vec" << std::endl;
51
- }
52
-
53
- // DEBUG: exit Build_MDD
54
- // std::cerr << "[HTMiner::Build_MDD] exiting; Tree.size()=" << Tree.size()
55
- // << " CTree.size()=" << CTree.size()
56
- // << " VTree.size()=" << VTree.size() << std::endl;
57
- //
58
30
  }
59
31
 
60
- int Add_arc(int item, unsigned int last_arc, int& itmset, std::vector<unsigned int>& ancest_map) {
32
+ int Add_arc(int item, unsigned int last_arc, int& itmset, vector<unsigned int>& ancest_map) {
33
+
61
34
  unsigned int anct = ancest_map[std::abs(item) - 1];
62
- if (item < 0) {
35
+
36
+ if (item < 0)
63
37
  ++itmset;
64
- // std::cerr << "[HTMiner::Add_arc] negative item detected; itmset incremented to "
65
- // << itmset << std::endl;
66
- }
67
38
 
68
39
  unsigned int last_sibl = Tree[last_arc].chld;
69
- // std::cerr << "[HTMiner::Add_arc] starting with last_sibl=" << last_sibl
70
- // << " anct=" << anct << std::endl;
71
40
 
72
41
  if (last_sibl == 0) {
73
42
  Tree.emplace_back(item, itmset, anct);
74
- last_sibl = static_cast<unsigned int>(Tree.size() - 1);
43
+ last_sibl = (unsigned int)Tree.size() - 1;
75
44
  Tree[last_arc].chld = last_sibl;
76
- // std::cerr << "[HTMiner::Add_arc] created new arc at index=" << last_sibl
77
- // << " setting Tree[" << last_arc << "].chld=" << last_sibl << std::endl;
78
- if (anct == 0) {
45
+ if (anct == 0)
79
46
  DFS[std::abs(item) - 1].str_pnt.push_back(last_sibl);
80
- // std::cerr << "[HTMiner::Add_arc] appended to DFS[" << (std::abs(item) - 1)
81
- // << "].str_pnt -> " << last_sibl << std::endl;
82
- }
83
47
  }
84
48
  else {
85
- // std::cerr << "[HTMiner::Add_arc] traversing siblings starting at " << last_sibl << std::endl;
86
49
  while (Tree[last_sibl].item != item) {
87
50
  if (Tree[last_sibl].sibl == 0) {
88
51
  Tree.emplace_back(item, itmset, anct);
89
- Tree[last_sibl].sibl = static_cast<unsigned int>(Tree.size() - 1);
90
- last_sibl = static_cast<unsigned int>(Tree.size() - 1);
91
- // std::cerr << "[HTMiner::Add_arc] created sibling arc at index=" << last_sibl
92
- // << " setting Tree[" << (last_sibl - 1) << "].sibl=" << last_sibl << std::endl;
93
- if (anct == 0) {
52
+ Tree[last_sibl].sibl = (unsigned int)Tree.size() - 1;
53
+ last_sibl = (unsigned int)Tree.size() - 1;
54
+ if (anct == 0)
94
55
  DFS[std::abs(item) - 1].str_pnt.push_back(last_sibl);
95
- // std::cerr << "[HTMiner::Add_arc] appended to DFS[" << (std::abs(item) - 1)
96
- // << "].str_pnt -> " << last_sibl << std::endl;
97
- }
98
56
  break;
99
57
  }
100
58
  last_sibl = Tree[last_sibl].sibl;
101
- // std::cerr << "[HTMiner::Add_arc] moving to next sibling: " << last_sibl << std::endl;
102
59
  }
103
60
  }
104
61
 
105
- if (anct == 0) {
62
+ if (anct == 0)
106
63
  ++DFS[std::abs(item) - 1].freq;
107
- // std::cerr << "[HTMiner::Add_arc] incremented DFS[" << (std::abs(item) - 1)
108
- // << "].freq -> " << DFS[std::abs(item) - 1].freq << std::endl;
109
- }
110
64
 
111
65
  ++Tree[last_sibl].freq;
112
- // std::cerr << "[HTMiner::Add_arc] incremented Tree[" << last_sibl << "].freq -> "
113
- // << Tree[last_sibl].freq << std::endl;
114
66
 
115
67
  ancest_map[std::abs(item) - 1] = last_sibl;
116
- // std::cerr << "[HTMiner::Add_arc] updated ancest_map[" << (std::abs(item) - 1)
117
- // << "] -> " << last_sibl << std::endl;
118
68
 
119
- return static_cast<int>(last_sibl);
69
+ return (int)last_sibl;
120
70
  }
121
71
 
122
- void Add_vec(std::vector<int>& items_lim, std::vector<unsigned int>& ancest, unsigned int last_arc, int itmset) {
123
- items_lim.shrink_to_fit();
124
- // std::cerr << "[HTMiner::Add_vec] called with items_lim.size()=" << items_lim.size()
125
- // << " last_arc=" << last_arc << " itmset=" << itmset << std::endl;
72
+ void Add_vec(vector<int>& items_lim, vector<unsigned int>& ancest, unsigned int last_arc, int itmset) {
126
73
 
127
- std::vector<bool> counted(L, false);
74
+ items_lim.shrink_to_fit();
75
+ vector<bool> counted(L, 0);
128
76
 
129
77
  if (Tree[last_arc].itmset > 0) {
130
- ancest.push_back(0);
78
+ ancest.push_back(0); // last element of ancest is CArc child
131
79
  ancest.shrink_to_fit();
132
- // std::cerr << "[HTMiner::Add_vec] Tree[" << last_arc << "].itmset > 0; pushing 0 to ancest" << std::endl;
133
-
134
- for (size_t i = 0; i < items_lim.size(); ++i) {
80
+ for (int i = 0; i < (int)items_lim.size(); ++i) {
135
81
  int cur_itm = std::abs(items_lim[i]);
136
82
  if (ancest[cur_itm - 1] == 0 && !counted[cur_itm - 1]) {
137
- if (i + 1 < static_cast<int>(items_lim.size())) {
138
- VDFS[cur_itm - 1].str_pnt.push_back(-static_cast<int>(i) - 1);
139
- VDFS[cur_itm - 1].seq_ID.push_back(static_cast<unsigned int>(CTree.size()));
140
- // std::cerr << "[HTMiner::Add_vec] appended negative str_pnt to VDFS["
141
- // << (cur_itm - 1) << "] -> " << (-static_cast<int>(i) - 1) << std::endl;
83
+ if (i + 1 < (int)items_lim.size()) {
84
+ VDFS[cur_itm - 1].str_pnt.push_back(-i - 1); // CTree positions: negative pointers
85
+ VDFS[cur_itm - 1].seq_ID.push_back((unsigned int)CTree.size());
142
86
  }
143
87
  ++DFS[cur_itm - 1].freq;
144
- counted[cur_itm - 1] = true;
145
- // std::cerr << "[HTMiner::Add_vec] incremented DFS[" << (cur_itm - 1)
146
- // << "].freq -> " << DFS[cur_itm - 1].freq << std::endl;
88
+ counted[cur_itm - 1] = 1;
147
89
  }
148
90
  }
149
-
150
91
  CTree.emplace_back(ancest, items_lim);
151
- //std::cerr << "[HTMiner::Add_vec] added new CTree node; CTree.size()=" << CTree.size() << std::endl;
152
-
153
- Tree[last_arc].chld = static_cast<unsigned int>(CTree.size() - 1);
154
- Tree[last_arc].itmset = -itmset;
155
- // std::cerr << "[HTMiner::Add_vec] updated Tree[" << last_arc
156
- // << "].chld=" << Tree[last_arc].chld
157
- // << " Tree[" << last_arc << "].itmset=" << Tree[last_arc].itmset << std::endl;
158
- //
159
- }
92
+ Tree[last_arc].chld = (unsigned int)CTree.size() - 1;
93
+ Tree[last_arc].itmset = -itmset; // Tree→CTree edge is marked by negative itmset
94
+ }
160
95
  else {
161
- std::vector<unsigned int>& ancest_ct = CTree[Tree[last_arc].chld].ancest;
162
- // std::cerr << "[HTMiner::Add_vec] Tree[" << last_arc << "].itmset <= 0; using existing CTree node "
163
- // << Tree[last_arc].chld << std::endl;
164
-
165
- for (size_t i = 0; i < items_lim.size(); ++i) {
96
+ vector<unsigned int>& ancest_ref = CTree[Tree[last_arc].chld].ancest;
97
+ for (int i = 0; i < (int)items_lim.size(); ++i) {
166
98
  int cur_itm = std::abs(items_lim[i]);
167
- if (!counted[cur_itm - 1] && ancest_ct[cur_itm - 1] == 0) {
168
- if (i + 1 < static_cast<int>(items_lim.size())) {
169
- VDFS[cur_itm - 1].str_pnt.push_back(static_cast<unsigned int>(i) + 1);
170
- VDFS[cur_itm - 1].seq_ID.push_back(static_cast<unsigned int>(VTree.size()));
171
- // std::cerr << "[HTMiner::Add_vec] appended positive str_pnt to VDFS["
172
- // << (cur_itm - 1) << "] -> " << (static_cast<unsigned int>(i) + 1) << std::endl;
99
+ if (!counted[cur_itm - 1] && ancest_ref[cur_itm - 1] == 0) {
100
+ if (i + 1 < (int)items_lim.size()) {
101
+ VDFS[cur_itm - 1].str_pnt.push_back(i + 1);
102
+ VDFS[cur_itm - 1].seq_ID.push_back((unsigned int)VTree.size());
173
103
  }
174
104
  ++DFS[cur_itm - 1].freq;
175
- counted[cur_itm - 1] = true;
176
- // std::cerr << "[HTMiner::Add_vec] incremented DFS[" << (cur_itm - 1)
177
- // << "].freq -> " << DFS[cur_itm - 1].freq << std::endl;
105
+ counted[cur_itm - 1] = 1;
178
106
  }
179
107
  }
180
-
181
- VTree.emplace_back(items_lim, ancest_ct.back());
182
- // std::cerr << "[HTMiner::Add_vec] added new VTree node; VTree.size()=" << VTree.size() << std::endl;
183
-
184
- CTree[Tree[last_arc].chld].ancest.back() = static_cast<unsigned int>(VTree.size());
185
- // std::cerr << "[HTMiner::Add_vec] updated CTree[" << Tree[last_arc].chld
186
- // << "].ancest.back()=" << CTree[Tree[last_arc].chld].ancest.back() << std::endl;
108
+ VTree.emplace_back(items_lim, CTree[Tree[last_arc].chld].ancest.back());
109
+ CTree[Tree[last_arc].chld].ancest.back() = (unsigned int)VTree.size();
110
+ // VTree siblings and CTree children are +1 of actual index to mark end
187
111
  }
188
-
189
- //std::cerr << "[HTMiner::Add_vec] exiting" << std::endl;
190
112
  }
191
113
 
192
- } // namespace htminer
114
+ } // namespace htminer
@@ -5,60 +5,67 @@
5
5
  #include "load_inst.hpp"
6
6
 
7
7
  namespace htminer {
8
- void Build_MDD(std::vector<int>& items, std::vector<int>& items_lim);
9
8
 
10
- class Arc {
11
- public:
12
- unsigned int chld;
13
- unsigned int sibl;
14
- unsigned int freq;
15
- unsigned int anct;
16
- int itmset;
17
- int item;
9
+ using std::vector;
18
10
 
19
- Arc(unsigned int _itm, int _itmset, unsigned int _anc) {
20
- chld = 0;
21
- sibl = 0;
22
- freq = 0;
23
- itmset = _itmset;
24
- anct = _anc;
25
- item = _itm;
26
- }
11
+ void Build_MDD(vector<int>& items, vector<int>& items_lim);
27
12
 
28
- Arc() {
29
- chld = 0;
30
- sibl = 0;
31
- freq = 0;
32
- }
33
- };
13
+ class Arc {
14
+ public:
15
+ unsigned int chld;
16
+ unsigned int sibl;
17
+ unsigned int freq;
18
+ unsigned int anct;
19
+ int itmset;
20
+ int item;
34
21
 
35
- class VArc {
36
- public:
37
- unsigned int sibl;
38
- std::vector<int> seq;
22
+ Arc(unsigned int _itm, int _itmset, unsigned int _anc) {
23
+ chld = 0;
24
+ sibl = 0;
25
+ freq = 0;
26
+ itmset = _itmset;
27
+ anct = _anc;
28
+ item = _itm;
29
+ }
39
30
 
40
- VArc(std::vector<int>& items, unsigned int _sib) {
41
- sibl = _sib;
42
- seq.swap(items);
43
- }
44
-
45
- VArc() {
46
- sibl = 0;
47
- }
48
- };
31
+ Arc() {
32
+ chld = 0;
33
+ sibl = 0;
34
+ freq = 0;
35
+ itmset = 0;
36
+ anct = 0;
37
+ item = 0;
38
+ }
39
+ };
49
40
 
50
- class CArc {
51
- public:
52
- std::vector<int> seq;
53
- std::vector<unsigned int> ancest;
41
+ class VArc {
42
+ public:
43
+ unsigned int sibl;
44
+ vector<int> seq;
54
45
 
55
- CArc(std::vector<unsigned int>& _anc, std::vector<int>& items) {
56
- ancest.swap(_anc);
57
- seq.swap(items);
58
- }
59
- };
46
+ VArc(vector<int>& items, unsigned int _sib) {
47
+ sibl = _sib;
48
+ seq.swap(items);
49
+ }
60
50
 
61
- extern std::vector<Arc> Tree;
62
- extern std::vector<VArc> VTree;
63
- extern std::vector<CArc> CTree;
64
- }
51
+ VArc() {
52
+ sibl = 0;
53
+ }
54
+ };
55
+
56
+ class CArc {
57
+ public:
58
+ vector<int> seq;
59
+ vector<unsigned int> ancest;
60
+
61
+ CArc(vector<unsigned int>& _anc, vector<int>& items) {
62
+ ancest.swap(_anc);
63
+ seq.swap(items);
64
+ }
65
+ };
66
+
67
+ extern vector<Arc> Tree;
68
+ extern vector<VArc> VTree;
69
+ extern vector<CArc> CTree;
70
+
71
+ } // namespace htminer