Skip to content

Commit

Permalink
increased coverage of node order features
Browse files Browse the repository at this point in the history
  • Loading branch information
maniospas committed Jun 13, 2024
1 parent 524097a commit dcf2988
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pygrank/algorithms/convergence.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,17 @@ def __init__(
self._conf_ppf = norm.ppf(self.confidence)
self._targeting_fraction = 0
if isinstance(criterion, int):
if criterion<4:
raise Exception(f"When initializing `clever_gap` with the number of node samples, "
f"provide at least 2 node samples instead of {criterion}")
if criterion < 4:
raise Exception(
f"When initializing `clever_gap` with the number of node samples, "
f"provide at least 2 node samples instead of {criterion}"
)
elif criterion not in ["fraction_of_walks", "clever_gap", "rank_gap"]:
raise Exception(f"RankOrderConvergenceManager got argument criterion='{criterion}'"
f"but one of 'fraction_of_walks', 'clever_gap', 'rank_gap' or an int"
f"should be provided")
raise Exception(
f"RankOrderConvergenceManager got argument criterion='{criterion}'"
f"but one of 'fraction_of_walks', 'clever_gap', 'rank_gap' or an int"
f"should be provided"
)

def start(self, restart_timer: bool = True):
if restart_timer or self._start_time is None:
Expand Down
1 change: 1 addition & 0 deletions tests/test_filter_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def test_rank_order_convergence():
)
algorithm.rank(graph, {"A": 1})


def test_rank_order_convergence_large():
graph = next(pg.load_datasets_graph(["blockmodel"]))
algorithm1 = pg.Ordinals(pg.PageRank(0.85, tol=1.0e-20, max_iters=1000))
Expand Down

0 comments on commit dcf2988

Please sign in to comment.