Skip to content

Commit

Permalink
Adds epoch control
Browse files Browse the repository at this point in the history
  • Loading branch information
SrGonao committed Feb 4, 2024
1 parent 8f06bf9 commit 43d689a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/delphi/train/permute.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ def random_number(self, max: int) -> int:

def permute(seed: int, list: list, epoch: int = 0) -> list:
"""
Permute a list in place using Fisher-Yates shuffle
Shuffle a list in place in place using Fisher-Yates shuffle
Epoch will move the seed to the corresponding epoch
The list should be the total training epoch
"""

random = Random(seed)
for i in range(len(list)):
max_index = len(list) - i
j = random.random_number(max_index) + i
list[i], list[j] = list[j], list[i]
for j in range(epoch + 1):
for i in range(len(list)):
max_index = len(list) - i
j = random.random_number(max_index) + i
list[i], list[j] = list[j], list[i]
return list

0 comments on commit 43d689a

Please sign in to comment.