All problems
AIC vs BIC Delta
Problem
Return the difference AIC - BIC for a model with k parameters fitted to n samples. The likelihood terms cancel, leaving
delta = k * (2 - ln(n))
Hint
AIC and BIC only differ in their complexity penalty for the same model.
Test cases
case 1
in: [8,2]
expected: -0.1588830833596715
case 2
in: [16,3]
expected: -2.3177661667193434
case 3
in: [2,5]
expected: 6.534264097200273
case 4
in: [100,1]
expected: -2.605170185988092
Starter codePython
import math
def aic_bic_delta(n_samples, n_params):
# Your code here
pass4 test cases · run your code against them in the editor