Skip to content
DeepForgeby svx
All problems
MediumInformation Theoryinfo-237

Solomonoff Prior Weight

Problem

Return the Solomonoff universal prior weight of a string with the given description length K:

M(x) = 2^(-K)

Shorter programs contribute exponentially more probability mass.

Hint

Each extra bit halves the prior weight.

Test cases

case 1
in: [0]
expected: 1
case 2
in: [1]
expected: 0.5
case 3
in: [10]
expected: 0.0009765625
case 4
in: [3]
expected: 0.125
Starter codePython
def solomonoff_prior_weight(description_length):
    # Your code here
    pass

4 test cases · run your code against them in the editor