effspm 0.3.2__cp311-cp311-macosx_11_0_arm64.whl → 0.3.3__cp311-cp311-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 +153 -42
- effspm/_effspm.cpython-311-darwin.so +0 -0
- effspm/btminer/src/load_inst.cpp +10 -1
- {effspm-0.3.2.dist-info → effspm-0.3.3.dist-info}/METADATA +1 -1
- {effspm-0.3.2.dist-info → effspm-0.3.3.dist-info}/RECORD +8 -8
- {effspm-0.3.2.dist-info → effspm-0.3.3.dist-info}/WHEEL +0 -0
- {effspm-0.3.2.dist-info → effspm-0.3.3.dist-info}/licenses/LICENSE +0 -0
- {effspm-0.3.2.dist-info → effspm-0.3.3.dist-info}/top_level.txt +0 -0
effspm/_effspm.cpp
CHANGED
|
@@ -166,7 +166,7 @@ PYBIND11_MODULE(_effspm, m) {
|
|
|
166
166
|
// ─────────────────────────────────────────────────────────────
|
|
167
167
|
// BTMiner (always uses professor's Load_instance)
|
|
168
168
|
// ─────────────────────────────────────────────────────────────
|
|
169
|
-
m.def("BTMiner",
|
|
169
|
+
/*m.def("BTMiner",
|
|
170
170
|
[](py::object data,
|
|
171
171
|
double minsup,
|
|
172
172
|
unsigned int time_limit,
|
|
@@ -250,8 +250,100 @@ m.def("BTMiner",
|
|
|
250
250
|
py::arg("use_dic") = false,
|
|
251
251
|
py::arg("verbose") = false,
|
|
252
252
|
py::arg("out_file") = ""
|
|
253
|
-
);
|
|
253
|
+
); */
|
|
254
|
+
m.def("BTMiner",
|
|
255
|
+
[](py::object data,
|
|
256
|
+
double minsup,
|
|
257
|
+
unsigned int time_limit,
|
|
258
|
+
bool preproc,
|
|
259
|
+
bool use_dic,
|
|
260
|
+
bool verbose,
|
|
261
|
+
const std::string &out_file)
|
|
262
|
+
{
|
|
263
|
+
// 1) Configure professor globals
|
|
264
|
+
btminer::time_limit = static_cast<int>(time_limit);
|
|
265
|
+
btminer::pre_pro = preproc;
|
|
266
|
+
btminer::use_dic = use_dic;
|
|
267
|
+
btminer::b_disp = verbose;
|
|
268
|
+
btminer::b_write = !out_file.empty();
|
|
269
|
+
btminer::out_file = out_file;
|
|
270
|
+
btminer::N_mult = 1;
|
|
271
|
+
btminer::M_mult = 1;
|
|
272
|
+
btminer::just_build = false;
|
|
273
|
+
|
|
274
|
+
// 2) HARD RESET of *known* global state for BTMiner
|
|
275
|
+
btminer::ClearCollected(); // clear collected patterns
|
|
276
|
+
btminer::Tree.clear(); // clear MDD tree
|
|
277
|
+
btminer::DFS.clear(); // clear DFS patterns
|
|
278
|
+
|
|
279
|
+
// clear all frequency / mapping / item structures
|
|
280
|
+
btminer::freq.clear();
|
|
281
|
+
btminer::item_dic.clear();
|
|
282
|
+
btminer::item_map.clear();
|
|
283
|
+
btminer::item_map_rev.clear();
|
|
284
|
+
btminer::items.clear(); // if you have this defined anywhere
|
|
285
|
+
|
|
286
|
+
// reset scalar globals
|
|
287
|
+
btminer::M = 0;
|
|
288
|
+
btminer::L = 0;
|
|
289
|
+
btminer::N = 0;
|
|
290
|
+
btminer::theta = 0;
|
|
291
|
+
btminer::E = 0;
|
|
292
|
+
btminer::num_patt = 0;
|
|
293
|
+
btminer::num_nodes = 0;
|
|
294
|
+
btminer::cur_node = 0;
|
|
295
|
+
// N_mult, M_mult, flags are set just above
|
|
296
|
+
|
|
297
|
+
btminer::start_time = std::clock();
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
// 3) Handle input (path or list-of-lists)
|
|
301
|
+
TempFile tmp;
|
|
302
|
+
std::string path;
|
|
303
|
+
|
|
304
|
+
if (py::isinstance<py::str>(data)) {
|
|
305
|
+
// File path: use directly
|
|
306
|
+
path = data.cast<std::string>();
|
|
307
|
+
} else {
|
|
308
|
+
// Python list → write to a temp file in professor’s format
|
|
309
|
+
auto seqs = data.cast<std::vector<std::vector<int>>>();
|
|
310
|
+
tmp.path = write_temp_seq_file(seqs);
|
|
311
|
+
path = tmp.path;
|
|
312
|
+
}
|
|
254
313
|
|
|
314
|
+
if (verbose) {
|
|
315
|
+
std::cerr << "[BTMiner] path=" << path
|
|
316
|
+
<< " minsup=" << minsup
|
|
317
|
+
<< " preproc=" << preproc
|
|
318
|
+
<< " use_dic=" << use_dic
|
|
319
|
+
<< std::endl;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// 4) Build MDD + run miner
|
|
323
|
+
if (!btminer::Load_instance(path, minsup)) {
|
|
324
|
+
throw std::runtime_error("BTMiner: failed to load instance from: " + path);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
btminer::Freq_miner();
|
|
328
|
+
|
|
329
|
+
// 5) Return results
|
|
330
|
+
py::dict out;
|
|
331
|
+
out["patterns"] = btminer::GetCollected();
|
|
332
|
+
out["num_patterns"] = btminer::num_patt;
|
|
333
|
+
out["time"] = btminer::give_time(std::clock() - btminer::start_time);
|
|
334
|
+
out["N"] = btminer::N;
|
|
335
|
+
out["L"] = btminer::L;
|
|
336
|
+
out["theta"] = btminer::theta;
|
|
337
|
+
return out;
|
|
338
|
+
},
|
|
339
|
+
py::arg("data"),
|
|
340
|
+
py::arg("minsup") = 0.01,
|
|
341
|
+
py::arg("time_limit") = 36000,
|
|
342
|
+
py::arg("preproc") = false,
|
|
343
|
+
py::arg("use_dic") = false,
|
|
344
|
+
py::arg("verbose") = false,
|
|
345
|
+
py::arg("out_file") = ""
|
|
346
|
+
);
|
|
255
347
|
|
|
256
348
|
// ─────────────────────────────────────────────────────────────
|
|
257
349
|
// HTMiner (works on files; we use a temp file for in-memory data)
|
|
@@ -351,49 +443,68 @@ m.def("HTMiner",
|
|
|
351
443
|
// ─────────────────────────────────────────────────────────────
|
|
352
444
|
// LargePrefixProjection (already has its own Load_py)
|
|
353
445
|
// ─────────────────────────────────────────────────────────────
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
largepp::ClearCollected();
|
|
373
|
-
largepp::start_time = std::clock();
|
|
446
|
+
m.def("LargePrefixProjection",
|
|
447
|
+
[](py::object data,
|
|
448
|
+
double minsup,
|
|
449
|
+
unsigned int time_limit,
|
|
450
|
+
bool preproc,
|
|
451
|
+
bool use_dic,
|
|
452
|
+
bool verbose,
|
|
453
|
+
const std::string &out_file)
|
|
454
|
+
{
|
|
455
|
+
// 1) Configure global flags
|
|
456
|
+
largepp::time_limit = time_limit;
|
|
457
|
+
largepp::pre_pro = preproc;
|
|
458
|
+
largepp::use_dic = use_dic;
|
|
459
|
+
largepp::use_list = true; // LargePrefixProjection is list-based
|
|
460
|
+
largepp::b_disp = verbose;
|
|
461
|
+
largepp::b_write = !out_file.empty();
|
|
462
|
+
largepp::out_file = out_file;
|
|
463
|
+
largepp::just_build = false;
|
|
374
464
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
} else {
|
|
379
|
-
largepp::Load_py(data, minsup);
|
|
380
|
-
}
|
|
465
|
+
// 2) HARD RESET of largepp global state
|
|
466
|
+
// (only touch symbols that actually exist in largepp)
|
|
467
|
+
largepp::ClearCollected(); // clear previously collected patterns
|
|
381
468
|
|
|
382
|
-
|
|
469
|
+
// If these exist in largepp::load_inst.hpp / utility.hpp they’ll compile;
|
|
470
|
+
// if the compiler complains about any of them, just comment that line out.
|
|
471
|
+
largepp::items.clear(); // transaction DB
|
|
472
|
+
largepp::DFS.clear(); // DFS pattern stack, if list-based miner uses it
|
|
383
473
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
py::
|
|
395
|
-
|
|
396
|
-
|
|
474
|
+
largepp::M = 0;
|
|
475
|
+
largepp::L = 0;
|
|
476
|
+
largepp::N = 0;
|
|
477
|
+
largepp::theta = 0;
|
|
478
|
+
largepp::E = 0;
|
|
479
|
+
largepp::num_patt = 0;
|
|
480
|
+
|
|
481
|
+
largepp::start_time = std::clock();
|
|
482
|
+
|
|
483
|
+
// 3) Handle input (path or Python list)
|
|
484
|
+
if (py::isinstance<py::str>(data)) {
|
|
485
|
+
std::string fname = data.cast<std::string>();
|
|
486
|
+
largepp::Load_instance(fname, minsup);
|
|
487
|
+
} else {
|
|
488
|
+
largepp::Load_py(data, minsup);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// 4) Run miner
|
|
492
|
+
largepp::Freq_miner();
|
|
493
|
+
|
|
494
|
+
// 5) Return results
|
|
495
|
+
py::dict out;
|
|
496
|
+
out["patterns"] = largepp::GetCollected();
|
|
497
|
+
out["time"] = largepp::give_time(std::clock() - largepp::start_time);
|
|
498
|
+
return out;
|
|
499
|
+
},
|
|
500
|
+
py::arg("data"),
|
|
501
|
+
py::arg("minsup") = 0.01,
|
|
502
|
+
py::arg("time_limit") = 36000,
|
|
503
|
+
py::arg("preproc") = false,
|
|
504
|
+
py::arg("use_dic") = false,
|
|
505
|
+
py::arg("verbose") = false,
|
|
506
|
+
py::arg("out_file") = ""
|
|
507
|
+
);
|
|
397
508
|
|
|
398
509
|
// ─────────────────────────────────────────────────────────────
|
|
399
510
|
// LargeBTMiner (always uses professor's largebm::Load_instance)
|
|
Binary file
|
effspm/btminer/src/load_inst.cpp
CHANGED
|
@@ -31,7 +31,7 @@ map<int, string> item_map_rev;
|
|
|
31
31
|
|
|
32
32
|
std::vector<int> freq;
|
|
33
33
|
std::vector<int> item_dic;
|
|
34
|
-
|
|
34
|
+
std::vector<std::vector<int>> items;
|
|
35
35
|
// ✅ REAL DEFINITION lives here:
|
|
36
36
|
std::vector<Pattern> DFS;
|
|
37
37
|
|
|
@@ -103,6 +103,15 @@ bool Load_instance(string &items_file, double thresh) {
|
|
|
103
103
|
// preprocessing pass
|
|
104
104
|
// ---------------------------------------------------------------------
|
|
105
105
|
bool Preprocess(string &inst, double thresh) {
|
|
106
|
+
N = 0;
|
|
107
|
+
L = 0;
|
|
108
|
+
freq.clear();
|
|
109
|
+
item_dic.clear();
|
|
110
|
+
item_map.clear();
|
|
111
|
+
item_map_rev.clear();
|
|
112
|
+
// (E is usually for entries during Build_MDD, so we can leave it
|
|
113
|
+
// for the load phase; it’s already reset in the binding)
|
|
114
|
+
|
|
106
115
|
ifstream file(inst);
|
|
107
116
|
|
|
108
117
|
if (file.good()) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
effspm/utility.hpp,sha256=Y_MQVk9AmJWjguKyuyk0LraTi_6VzZFg0StsmVOCkNc,744
|
|
2
|
-
effspm/_effspm.cpython-311-darwin.so,sha256
|
|
2
|
+
effspm/_effspm.cpython-311-darwin.so,sha256=QqUfM26HTe_08BLozPtARMdwAiEmxsnDUQNXpOUmbxA,563856
|
|
3
3
|
effspm/_core.cpp,sha256=S6UsUcl0HQLMQUTy2tMJxcrbLGJo8tjkLskyHqESYyI,3675
|
|
4
4
|
effspm/load_inst.hpp,sha256=VF0o_Ur-mO5xhdWWn1KHrFLu9_bTbd8wcURCVF0A0dM,907
|
|
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=
|
|
7
|
+
effspm/_effspm.cpp,sha256=NkxFvVVbR5CAsSUZO5Z_Z-UwFVCQRhy6_st8_cD-2Us,51027
|
|
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
|
|
@@ -48,13 +48,13 @@ effspm/btminer/src/build_mdd.cpp,sha256=7J5KMNNB3DngB4Bkn1h-zMfAgRvRiXP4MEkPbd3C
|
|
|
48
48
|
effspm/btminer/src/utility.hpp,sha256=5m34T2ATvYY_32Sz6h0Zro4kLolosPwASJF0TiDKhhI,312
|
|
49
49
|
effspm/btminer/src/load_inst.hpp,sha256=Fj72XjlR7ppGi76vc0PMZZAkj_-JklTVuIqzbsZcTAw,987
|
|
50
50
|
effspm/btminer/src/freq_miner.cpp,sha256=sTA-bkUZqgFU9tVtSsUUfaVj7BU8MiFZm3scwRsxMeg,9192
|
|
51
|
-
effspm/btminer/src/load_inst.cpp,sha256=
|
|
51
|
+
effspm/btminer/src/load_inst.cpp,sha256=fquloXEJlmSXYbwstgX_lAO5-ar0CS6Gx1cfHQRQbS0,8366
|
|
52
52
|
effspm/btminer/src/freq_miner.hpp,sha256=sS2CGdNT0zSGtSz0evZZlUkuiKyWlSvrR3-M2YXP7-Q,1055
|
|
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.
|
|
57
|
-
effspm-0.3.
|
|
58
|
-
effspm-0.3.
|
|
59
|
-
effspm-0.3.
|
|
60
|
-
effspm-0.3.
|
|
56
|
+
effspm-0.3.3.dist-info/RECORD,,
|
|
57
|
+
effspm-0.3.3.dist-info/WHEEL,sha256=qxQkdhERtGxJzqnVOBnucx1aUmU2n3HmuzYdln_LyOw,109
|
|
58
|
+
effspm-0.3.3.dist-info/top_level.txt,sha256=2O-AuI0nw0pDmJMo2jzM1wvV2rj48AmkjskkAnsuuQk,7
|
|
59
|
+
effspm-0.3.3.dist-info/METADATA,sha256=0V27Cms7UBjdK62_SOAdqiAhq0bOIByG6oUTTALZEn8,14227
|
|
60
|
+
effspm-0.3.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
File without changes
|
|
File without changes
|
|
File without changes
|