MCPcopy Create free account
hub / github.com/imrahulr/hat / __init__

Method __init__

core/data/semisup.py:126–142  ·  view source on GitHub ↗
(self, sup_inds, unsup_inds, batch_size, unsup_fraction=0.5, num_batches=None)

Source from the content-addressed store, hash-verified

124 Balanced sampling from the labeled and unlabeled data.
125 """
126 def __init__(self, sup_inds, unsup_inds, batch_size, unsup_fraction=0.5, num_batches=None):
127 if unsup_fraction is None or unsup_fraction < 0:
128 self.sup_inds = sup_inds + unsup_inds
129 unsup_fraction = 0.0
130 else:
131 self.sup_inds = sup_inds
132 self.unsup_inds = unsup_inds
133
134 self.batch_size = batch_size
135 unsup_batch_size = int(batch_size * unsup_fraction)
136 self.sup_batch_size = batch_size - unsup_batch_size
137
138 if num_batches is not None:
139 self.num_batches = num_batches
140 else:
141 self.num_batches = int(np.ceil(len(self.sup_inds) / self.sup_batch_size))
142 super().__init__(None)
143
144 def __iter__(self):
145 batch_counter = 0

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected