Skip to content

Commit 4fd4e4d

Browse files
authored
Merge pull request #21 from fidelity/drop_frequency_by_default
drop frequency for encoding by default
2 parents 9f01dab + ff74ae0 commit 4fd4e4d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

notebooks/dichotomic_pattern_mining.ipynb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@
374374
"name": "stdout",
375375
"output_type": "stream",
376376
"text": [
377-
"DPM finished! Runtime: 13.4088 sec\n",
377+
"DPM finished! Runtime: 13.9297 sec\n",
378378
"Aggregation: intersection with number of patterns: 215\n",
379379
"Aggregation: union with number of patterns: 498\n",
380380
"Aggregation: unique_negative with number of patterns: 29\n",
@@ -421,7 +421,7 @@
421421
"output_type": "stream",
422422
"text": [
423423
"Aggregation: intersection\n",
424-
"Encoding finished! Runtime: 211.6533 sec\n"
424+
"Encoding finished! Runtime: 212.4152 sec\n"
425425
]
426426
},
427427
{
@@ -641,7 +641,7 @@
641641
"output_type": "stream",
642642
"text": [
643643
"Aggregation: union\n",
644-
"Encoding finished! Runtime: 408.2286 sec\n"
644+
"Encoding finished! Runtime: 396.5205 sec\n"
645645
]
646646
},
647647
{
@@ -861,7 +861,7 @@
861861
"output_type": "stream",
862862
"text": [
863863
"Aggregation: unique_negative\n",
864-
"Encoding finished! Runtime: 17.7938 sec\n"
864+
"Encoding finished! Runtime: 17.2031 sec\n"
865865
]
866866
},
867867
{
@@ -1074,7 +1074,7 @@
10741074
"output_type": "stream",
10751075
"text": [
10761076
"Aggregation: unique_positive\n",
1077-
"Encoding finished! Runtime: 178.5864 sec\n"
1077+
"Encoding finished! Runtime: 175.8174 sec\n"
10781078
]
10791079
},
10801080
{
@@ -1308,7 +1308,8 @@
13081308
" \n",
13091309
" t = time()\n",
13101310
" # find one hot encoding of each sequence for each pattern subject to constraints\n",
1311-
" encodings = get_one_hot_encodings(sequences, patterns, constraints, args['rolling_window_size'])\n",
1311+
" encodings = get_one_hot_encodings(sequences, patterns, constraints, args['rolling_window_size'],\n",
1312+
" drop_pattern_frequency=False)\n",
13121313
" \n",
13131314
" print(f'Encoding finished! Runtime: {time()-t:.4f} sec')\n",
13141315
" display(encodings.head())"

sequential/dpm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def dichotomic_pattern_mining(seq2pat_pos: Seq2Pat, seq2pat_neg: Seq2Pat,
7676

7777
def get_one_hot_encodings(sequences: List[list], patterns: List[list],
7878
constraints: Union[List[_Constraint], None] = None,
79-
rolling_window_size: Union[int, None] = 10, drop_pattern_frequency=False) -> pd.DataFrame:
79+
rolling_window_size: Union[int, None] = 10, drop_pattern_frequency=True) -> pd.DataFrame:
8080
"""
8181
Create a data frame having one-hot encoding of sequences.
8282
@@ -93,7 +93,7 @@ def get_one_hot_encodings(sequences: List[list], patterns: List[list],
9393
sequence subject to the pattern detection, to speed up the encodings generation.
9494
(rolling_window_size=10 by default). When rolling_window_size=None, patterns are detected globally.
9595
drop_pattern_frequency: bool
96-
Drop the frequency appended in the end of each input pattern, drop_pattern_frequency=False by default.
96+
Drop the frequency appended in the end of each input pattern, drop_pattern_frequency=True by default.
9797
9898
Returns
9999
-------

0 commit comments

Comments
 (0)