Skip to content

Commit

Permalink
remove getE and getEforOccs from pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasbtnfr committed Mar 20, 2023
1 parent e5188e1 commit 0798172
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 42 deletions.
34 changes: 0 additions & 34 deletions skmine/periodic/pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,6 @@ def getEDict(oStar, E=[]):
return dict(zip(*[oids, Ex]))


def getEforOccs(map_occs, occs):
"""
FIXME : to be explained
Constructs the list of errors
# TODO : WARNING! WRONG, this is using absolute errors...
Parameters
----------
map_occs
occs
Returns
-------
"""
return [t - map_occs.get(oid, t) for (t, alpha, oid) in occs]


def codeLengthE(E):
"""
L(E) = 2 |E| + ∑_{e∈E} |e|
Expand Down Expand Up @@ -1406,21 +1387,6 @@ def cardO(self, nid=0):
else:
return 1

def getE(self, map_occs, nid=0):
"""
Compute the errors by assuming perfect periodicity (occsStar) and differentiating from the actual occurrences.
Parameters
----------
map_occs
nid
Returns
-------
"""
return getEforOccs(map_occs, self.getOccsStar(nid, time=map_occs[None]))

def codeLengthPTop(self, deltaT, EC_za=None, nid=0):
"""
L(p) = log (⌊(∆(S)−σ(E))/(r−1)⌋) where σ(E) = sum(E)
Expand Down
9 changes: 1 addition & 8 deletions skmine/periodic/tests/test_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pytest

from skmine.periodic.pattern import Pattern, getEDict, codeLengthE, getEforOccs
from skmine.periodic.pattern import Pattern, getEDict, codeLengthE


@pytest.fixture
Expand Down Expand Up @@ -816,13 +816,6 @@ def test_getKeyFromNid(tree_data_complex):
assert pattern.getKeyFromNid(nid=4, rep=-1) == "2,4;0,2"


def test_getEforOccs():
map_occs = {1: 2, 2: 3, 4: 6}
occs = [(1, 0.1, 1), (4, 0.2, 2), (5, 0.3, 3)]
expected_output = [-1, 1, 0]
assert getEforOccs(map_occs, occs) == expected_output


def test_codeLength():
pattern = Pattern({0: {'p': 150, 'r': 3, 'children': [(1, 0), (2, 72)], 'parent': None},
1: {'parent': 0, 'event': 3}, 2: {'parent': 0, 'event': 3}})
Expand Down

0 comments on commit 0798172

Please sign in to comment.