MCPcopy Create free account
hub / github.com/Pints-AI/1.5-Pints / Splitter

Class Splitter

util/splitter.py:1–20  ·  view source on GitHub ↗

A class to manage splitting based on a specified ratio, indicating the frequency of False outcomes. A ratio of 0.9 will return 1 True for every 10 steps.

Source from the content-addressed store, hash-verified

1class Splitter:
2
3 """
4 A class to manage splitting based on a specified ratio, indicating the frequency of False outcomes.
5 A ratio of 0.9 will return 1 True for every 10 steps.
6 """
7
8 ratio: float
9 numerator = 0
10 denominator = 0
11
12 def __init__(self, ratio: float) -> None:
13 self.ratio = ratio
14
15 def should_split(self):
16 self.denominator += 1
17 if self.numerator / self.denominator < self.ratio:
18 self.numerator += 1
19 return False
20 return True

Callers 1

process_dataMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected