Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
The bug with the degrees of freedom should be fixed now, for any data…
… size.
  • Loading branch information
Luka Petrović committed Nov 20, 2019
1 parent 36ee9c2 commit 92c133d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions pathpy/classes/higher_order_network.py
Expand Up @@ -235,12 +235,18 @@ def __init__(self, paths, k=1, null_model=False, separator=None):
# subtract one degree of freedom for every node of the k-order network
# that has non-zero degree.

non_zero = 0
for hon_node in self.nodes:
if len(self.successors[hon_node])>0:
non_zero += 1


if null_model or k==1:
non_zero = 0
for hon_node in self.nodes:
if len(self.successors[hon_node])>0:
non_zero += 1
else:
null_model_hon = HigherOrderNetwork(paths, k=k, null_model=True, separator=separator)
non_zero = 0
for hon_node in null_model_hon.nodes:
if len(null_model_hon.successors[hon_node])>0:
non_zero += 1

# The degrees of freedom of the higher-order model, under the paths
# assumption
self.dof_paths = paths_k - non_zero
Expand Down

0 comments on commit 92c133d

Please sign in to comment.