Example #1
0
 def __init__(self,
              radius,
              strategy="random",
              class_weight_method="sqrt",
              center=True):
     self._radius = eval(radius) if isinstance(radius,
                                               str) else float(radius)
     self._sampling_strategy = SamplingStrategy(
         strategy=strategy, class_weight_method=class_weight_method)
     self._center = center
Example #2
0
    def test_random_sampling_strategy(self):
        random_sphere = SamplingStrategy(strategy="RANDOM")

        np.random.seed(42)

        random_labels = []
        for i in range(50):
            random_center = random_sphere(self.data.clone())
            random_labels.append(self.labels[random_center])

        assert len(np.unique(random_labels)) == len(self.labels)