Softmax Transition Probabilities
Convert frame similarities to transition probabilities using softmax.
For varied video texture playback, we use probabilistic transitions instead of always jumping to the best match. The transition probability from frame to frame is:
where:
- is the dissimilarity from to
- is a temperature parameter
- Lower dissimilarity = higher probability
This creates smooth random playback that prefers good transitions but allows variety.
Return the probabilities as a list in the same order as the input, with each probability rounded to 4 decimal places.
Example
transition_probs([0, 10, 10], 10)
[0.5761, 0.2119, 0.2119]
- Inputs:
similarities=[0, 10, 10]holds the dissimilarity from the current frame to each of 3 candidate frames (0 means a perfect match), andsigma=10is the temperature. - Scale and negate: each score becomes , giving . The negative sign is what makes a small dissimilarity produce a large weight.
- Weights: and (twice), so the denominator is .
- Normalise: for the matching frame and for each of the other two, each rounded to 4 decimal places:
[0.5761, 0.2119, 0.2119]. - Notice: the two frames with equal dissimilarity get equal probability, and the rounded values add to , not exactly 1. A larger would shrink the gaps and push all three toward .
Constraints
- similarities: list of similarity scores from current frame to all frames
- sigma: temperature parameter (higher = more uniform)
- Return probability distribution (sums to 1)