Nickpips

elo_sampling.py

Jul 26th, 2025 (edited)
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.47 KB | None | 0 0
  1. import random
  2.  
  3. # Works, is pretty good
  4. all_pairs: list[tuple[int, int]] = []
  5. for i in range(100):
  6.     for j in range(i+1, 100):
  7.         i2, j2 = random.sample((i, j), 2)
  8.         all_pairs.append((i2, j2))
  9. random.shuffle(all_pairs)
  10. selected_pairs = all_pairs[:600]
  11.  
  12. # But this is more sample efficient
  13. all_pairs = []
  14. indexes = list(range(100))
  15. for K in range(4):
  16.     random.shuffle(indexes)
  17.     for i in range(100):
  18.         all_pairs.append((indexes[i], indexes[(i+1) % 100]))
  19. len(all_pairs) # 400
  20.  
  21. # ~400 samples with random cycles, resolves the ELOs as accurately as ~600 randomly sampled pairs. This makes synthetic training data 50% cheaper, which saves a lot when spending >$10k
  22. # Image Showing Idea: https://private-user-images.githubusercontent.com/8939474/470457008-4731f849-e81f-40bd-a211-fd6f273f1f84.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTM1NjY3NTcsIm5iZiI6MTc1MzU2NjQ1NywicGF0aCI6Ii84OTM5NDc0LzQ3MDQ1NzAwOC00NzMxZjg0OS1lODFmLTQwYmQtYTIxMS1mZDZmMjczZjFmODQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDcyNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTA3MjZUMjE0NzM3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDcwNTQ0NWYyYThmN2E1MmQ2NTI3Y2ZkY2MwYmY1YjVkMTViZThmNTU3MTQxOGY0Y2FlYTlhYjE0YmZiZTMzOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.2xsCZ1cou_nRQRVZnBxxWzsUG21HrA6c6WMGYWPF1kU
Advertisement
Add Comment
Please, Sign In to add comment