πŸ“„ Zero Vs Many EntitiesΒΆ

operators.balancers.ner.zero_vs_many_entities

LengthBalancer(
    fields=[
        "reference_fields/labels",
    ],
    segments_boundaries=[
        1,
    ],
)
[source]

Explanation about LengthBalancerΒΆ

Balances by a signature that reflects the total length of the fields’ values, quantized into integer segments.

Args:
segments_boundaries (List[int]):

distinct integers sorted in increasing order, that map a given total length into the index of the least of them that exceeds the given total length. (If none exceeds – into one index beyond, namely, the length of segments_boundaries)

fields (Optional, List[str]):

the total length of the values of these fields goes through the quantization described above

Example:

when input [{"a": [1, 3], "b": 0, "id": 0}, {"a": [1, 3], "b": 0, "id": 1}, {"a": [], "b": "a", "id": 2}] is fed into LengthBalancer(fields=["a"], segments_boundaries=[1]), input instances will be counted and balanced against two categories: empty total length (less than 1), and non-empty.

Read more about catalog usage here.