Probability Matrix Spec

Probability Matrix Spec

Overseed Extension Type

Probability Matrix Field

parent_field_name: #SpecProbability & {
  fields: {
    child_field_name: [...values],
    child_field_name: [...values],
  probabilities: [...number]
or in the general from
field_name: #SpecProbabilityMatrix: {
  nested: bool | *true
  fields: { [string]: [...string] | [...number] | [...bool]  }
  probabilities: [...number]
  • Notes:
    • nested defaults to true.
      • If nested is true fields will appear as a child of the parent field name parent_field_name.child_field_name with their corresponding value.
      • If nested is false fields will be output at the parent field name level instead of the parent field name with their corresponding value.
    • probabilities must be a list of numbers that add up to 100 and have an equal length to the provided values in each field.


Gender and Favorite Color Probability

items: #SpecProbabilityMatrix & { nested: false, fields: { gender: ["male", "male", "male", "female", "female", "female"] color: ["blue", "pink", "purple", "blue", "pink", "purple"] }, probabilities: [30, 5, 15, 20, 20, 10] }
  • The above definition will generate values based on the probabilities assigned in the matrix.
  • For example, "male" and "blue" will be assigned to 30% of the values for the fields "gender" and "color".

CSV Example Output


JSON Example Output

[ { "gender": "female" "color": "pink" }, { "gender": "female" "color": "blue" }, { "gender": "male" "color": "purple" }, { "gender": "male" "color": "blue" } ]