add label encoder/decoder (not finished)
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
class Label:
|
||||||
|
def __init__(self, voc_size=1001, num_codes_per_dim=10, v_min=0.0, v_max=1.0):
|
||||||
|
self.num_codes_per_dim = num_codes_per_dim
|
||||||
|
self.voc_size = voc_size
|
||||||
|
self.v_min = v_min
|
||||||
|
self.v_max = v_max
|
||||||
|
self.num_dim = Label.num_dims(voc_size, num_codes_per_dim)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def num_dims(voc_size, num_codes_per_dim):
|
||||||
|
num_dim_required = 0
|
||||||
|
while voc_size > 1:
|
||||||
|
num_dim_required += 1
|
||||||
|
voc_size /= num_codes_per_dim
|
||||||
|
|
||||||
|
return num_dim_required
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
enc = Label()
|
||||||
|
print("Test: [passed]")
|
||||||
Reference in New Issue
Block a user