effspm 0.3.1__cp39-cp39-macosx_11_0_arm64.whl → 0.3.2__cp39-cp39-macosx_11_0_arm64.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.cpp CHANGED
@@ -163,73 +163,95 @@ PYBIND11_MODULE(_effspm, m) {
163
163
  // ─────────────────────────────────────────────────────────────
164
164
  // BTMiner (always uses professor's Load_instance)
165
165
  // ─────────────────────────────────────────────────────────────
166
- m.def("BTMiner",
167
- [](py::object data,
168
- double minsup,
169
- unsigned int time_limit,
170
- bool preproc,
171
- bool use_dic,
172
- bool verbose,
173
- const std::string &out_file)
174
- {
175
- // Configure professor globals
176
- btminer::time_limit = static_cast<int>(time_limit);
177
- btminer::pre_pro = preproc;
178
- btminer::use_dic = use_dic;
179
- btminer::b_disp = verbose;
180
- btminer::b_write = !out_file.empty();
181
- btminer::out_file = out_file;
182
- btminer::N_mult = 1;
183
- btminer::M_mult = 1;
184
- btminer::just_build = false;
185
-
186
- btminer::ClearCollected();
187
- btminer::start_time = std::clock();
166
+ // ─────────────────────────────────────────────────────────────
167
+ // BTMiner (always uses professor's Load_instance)
168
+ // ─────────────────────────────────────────────────────────────
169
+ m.def("BTMiner",
170
+ [](py::object data,
171
+ double minsup,
172
+ unsigned int time_limit,
173
+ bool preproc,
174
+ bool use_dic,
175
+ bool verbose,
176
+ const std::string &out_file)
177
+ {
178
+ // 1) Configure professor globals
179
+ btminer::time_limit = static_cast<int>(time_limit);
180
+ btminer::pre_pro = preproc;
181
+ btminer::use_dic = use_dic;
182
+ btminer::b_disp = verbose;
183
+ btminer::b_write = !out_file.empty();
184
+ btminer::out_file = out_file;
185
+ btminer::N_mult = 1;
186
+ btminer::M_mult = 1;
187
+ btminer::just_build = false;
188
188
 
189
- TempFile tmp;
190
- std::string path;
189
+ // 2) HARD RESET of *known* global state for BTMiner
190
+ // (Only touch what we know exists in btminer namespace)
191
+ btminer::ClearCollected(); // clear collected patterns
192
+ btminer::Tree.clear(); // clear MDD tree
193
+ btminer::DFS.clear(); // clear DFS patterns
191
194
 
192
- if (py::isinstance<py::str>(data)) {
193
- // File path: use directly
194
- path = data.cast<std::string>();
195
- } else {
196
- // Python list → write to a temp file in the same format
197
- auto seqs = data.cast<std::vector<std::vector<int>>>();
198
- tmp.path = write_temp_seq_file(seqs);
199
- path = tmp.path;
200
- }
195
+ btminer::M = 0;
196
+ btminer::L = 0;
197
+ btminer::N = 0;
198
+ btminer::theta = 0;
199
+ btminer::E = 0;
200
+ btminer::num_patt = 0; // reset pattern counter if defined
201
201
 
202
- if (verbose) {
203
- std::cerr << "[BTMiner] path=" << path
204
- << " minsup=" << minsup
205
- << " preproc=" << preproc
206
- << " use_dic=" << use_dic
207
- << std::endl;
208
- }
202
+ // NOTE: we do NOT reinsert root here; btminer::Load_instance()
203
+ // is responsible for calling Tree.emplace_back(0,0,0) as needed.
209
204
 
210
- if (!btminer::Load_instance(path, minsup)) {
211
- throw std::runtime_error("BTMiner: failed to load instance from: " + path);
212
- }
205
+ btminer::start_time = std::clock();
213
206
 
214
- btminer::Freq_miner();
207
+ // 3) Handle input (path or list-of-lists)
208
+ TempFile tmp;
209
+ std::string path;
210
+
211
+ if (py::isinstance<py::str>(data)) {
212
+ // File path: use directly
213
+ path = data.cast<std::string>();
214
+ } else {
215
+ // Python list → write to a temp file in professor’s format
216
+ auto seqs = data.cast<std::vector<std::vector<int>>>();
217
+ tmp.path = write_temp_seq_file(seqs);
218
+ path = tmp.path;
219
+ }
220
+
221
+ if (verbose) {
222
+ std::cerr << "[BTMiner] path=" << path
223
+ << " minsup=" << minsup
224
+ << " preproc=" << preproc
225
+ << " use_dic=" << use_dic
226
+ << std::endl;
227
+ }
228
+
229
+ // 4) Build MDD + run miner
230
+ if (!btminer::Load_instance(path, minsup)) {
231
+ throw std::runtime_error("BTMiner: failed to load instance from: " + path);
232
+ }
233
+
234
+ btminer::Freq_miner();
235
+
236
+ // 5) Return results
237
+ py::dict out;
238
+ out["patterns"] = btminer::GetCollected();
239
+ out["num_patterns"] = btminer::num_patt;
240
+ out["time"] = btminer::give_time(std::clock() - btminer::start_time);
241
+ out["N"] = btminer::N;
242
+ out["L"] = btminer::L;
243
+ out["theta"] = btminer::theta;
244
+ return out;
245
+ },
246
+ py::arg("data"),
247
+ py::arg("minsup") = 0.01,
248
+ py::arg("time_limit") = 36000,
249
+ py::arg("preproc") = false,
250
+ py::arg("use_dic") = false,
251
+ py::arg("verbose") = false,
252
+ py::arg("out_file") = ""
253
+ );
215
254
 
216
- py::dict out;
217
- out["patterns"] = btminer::GetCollected();
218
- out["num_patterns"] = btminer::num_patt;
219
- out["time"] = btminer::give_time(std::clock() - btminer::start_time);
220
- out["N"] = btminer::N;
221
- out["L"] = btminer::L;
222
- out["theta"] = btminer::theta;
223
- return out;
224
- },
225
- py::arg("data"),
226
- py::arg("minsup") = 0.01,
227
- py::arg("time_limit") = 36000,
228
- py::arg("preproc") = false,
229
- py::arg("use_dic") = false,
230
- py::arg("verbose") = false,
231
- py::arg("out_file") = ""
232
- );
233
255
 
234
256
  // ─────────────────────────────────────────────────────────────
235
257
  // HTMiner (works on files; we use a temp file for in-memory data)
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: effspm
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Prefix‑Projection and other sequential pattern mining algorithms
5
5
  Author: Yeswanth Vootla
6
6
  Author-email: yeshu999 <vootlayeswanth20@gmail.com>
@@ -1,10 +1,10 @@
1
1
  effspm/utility.hpp,sha256=Y_MQVk9AmJWjguKyuyk0LraTi_6VzZFg0StsmVOCkNc,744
2
2
  effspm/_core.cpp,sha256=S6UsUcl0HQLMQUTy2tMJxcrbLGJo8tjkLskyHqESYyI,3675
3
3
  effspm/load_inst.hpp,sha256=VF0o_Ur-mO5xhdWWn1KHrFLu9_bTbd8wcURCVF0A0dM,907
4
- effspm/_effspm.cpython-39-darwin.so,sha256=oAHRYIR5ZMe4ovcd0md85bSkgrMt4h0VOKsGnvSV-_k,547424
4
+ effspm/_effspm.cpython-39-darwin.so,sha256=UH0kDg_r2uDm5v0qDE6x0tX7_1wDzsJCYSr3g0FRXqc,547424
5
5
  effspm/__init__.py,sha256=_BkZ8cFlB_l1haxTzxJMgFHhO6LEmF3pIY-nmPTPMj8,246
6
6
  effspm/freq_miner.cpp,sha256=9K-nO_c-vVzbFlmh511vmvypA2fu1TXpiJhyx03owDU,4642
7
- effspm/_effspm.cpp,sha256=a-jgUMb1WY7gyXGYCKG_ncDcMaVgTaxpVqtVOTnOtM0,46304
7
+ effspm/_effspm.cpp,sha256=JC4CPqjV4nyyHRv7EhQPQvXOb7Pj0Ge8Prxo0WCsCAg,47255
8
8
  effspm/load_inst.cpp,sha256=h9pjtvRCIrtqIAt8W1r8SxOb1YViW1pCR52tbxbPdh0,4591
9
9
  effspm/freq_miner.hpp,sha256=XDhydwUFmute6slWwZcFuiBjGZs4Kv5-UvAmcI_IMwI,786
10
10
  effspm/utility.cpp,sha256=luWwBNy7OVWRmam9gz2RjhtrRmx6c37oOobFJaDWqcA,1403
@@ -53,8 +53,8 @@ effspm/btminer/src/freq_miner.hpp,sha256=sS2CGdNT0zSGtSz0evZZlUkuiKyWlSvrR3-M2YX
53
53
  effspm/btminer/src/build_mdd.hpp,sha256=p0pEcNZMD-WqV0UB1WtOn-Soe0105gEL071Ht5okgJM,627
54
54
  effspm/btminer/src/utility.cpp,sha256=YmwdNPCUHFjydwrUAyBLEkFqUecyg7r4HbPdgoD-j3s,1194
55
55
  effspm/btminer/src/main.cpp,sha256=Jh9M5nsZUL3i-iENn7Jh--TOY0F5dnu6CvqZ7udWU3A,2678
56
- effspm-0.3.1.dist-info/RECORD,,
57
- effspm-0.3.1.dist-info/WHEEL,sha256=XDdnntmiCRXNVLdY5WCtwp2KApIYJ413gXaKlPbYNQ4,107
58
- effspm-0.3.1.dist-info/top_level.txt,sha256=2O-AuI0nw0pDmJMo2jzM1wvV2rj48AmkjskkAnsuuQk,7
59
- effspm-0.3.1.dist-info/METADATA,sha256=jG2oHQWgpsHroT6mN4Qx59ujH-PkD-9aruzN3lWtQxU,14227
60
- effspm-0.3.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
56
+ effspm-0.3.2.dist-info/RECORD,,
57
+ effspm-0.3.2.dist-info/WHEEL,sha256=XDdnntmiCRXNVLdY5WCtwp2KApIYJ413gXaKlPbYNQ4,107
58
+ effspm-0.3.2.dist-info/top_level.txt,sha256=2O-AuI0nw0pDmJMo2jzM1wvV2rj48AmkjskkAnsuuQk,7
59
+ effspm-0.3.2.dist-info/METADATA,sha256=JfNcmGZRF3qJbQKDXloeRbOHMw0R8tQNb-80p9KNjW0,14227
60
+ effspm-0.3.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
File without changes