Skip to content

[FEATURE] Change fractional custom op from percentage-based to relative weighting. #1282

@toddbaert

Description

@toddbaert

Requirements

Currently, the fractional operator is percentage-based; meaning you must specify the relative distribution of the variants in terms of a percentage. I believe we should change this instead to be a relative weight, meaning that the integers do not need to sum to 100. For example, this fractional:

"fractional": [
          [
            "red",
            25
          ],
          [
            "blue",
            25
          ],
          [
            "green",
            25
          ],
          [
            "grey",
            25
          ]
        ]

Would remain valid, but could also be expressed as:

"fractional": [
          [
            "red",
            1
          ],
          [
            "blue",
            1
          ],
          [
            "green",
            1
          ],
          [
            "grey",
            1
          ]
        ]

We could even make the number in the bucket optional, so that an even split would be assumed if none was provided (we could simply default to 1).

Benefits:

  • adding new buckets becomes easy, there's no need to alter previous buckets
  • supports much finer targeting
    • clear and consistent support across implementations for targeting finer than a single percentage (I don't believe all impls currently support non-integer distributions)
    • easy a clear support for fractions that aren't factors of 100 (1/1/1 vs 33/33/34)
  • non breaking (current percentage based rules will still work)

Challenges:

  • we should specify max values for the integers, and perhaps a max array length for the bucket array

If there's a general consensus to this, I will create some child issues in the relevant repositories and use this issue as the parent "tracking" issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions