Skip to content
DeepForgeby svx
All problems
MediumInformation Theoryinfo-269

AIC Weight

Problem

Return the Akaike weights for a list of AIC values:

w_i = exp(-(AIC_i - min(AIC)) / 2), normalized to sum to 1

Subtracting the minimum before exponentiating keeps the computation stable.

Hint

A difference of 2 AIC units gives the better model about 73 percent of the weight.

Test cases

case 1
in: [[0,0]]
expected: [0.5,0.5]
case 2
in: [[0,2]]
expected: [0.7310585786300049,0.2689414213699951]
case 3
in: [[0,4]]
expected: [0.8807970779778823,0.11920292202211755]
case 4
in: [[10,12,14]]
expected: [0.6652409557748218,0.24472847105479764,0.09003057317038046]
Starter codePython
import math
def aic_weight(aic_values):
    # Your code here
    pass

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