Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-239

Bits per Byte from NLL

Problem

Convert a total negative log-likelihood in nats to bits per byte: total_nll / (ln(2) * num_bytes). Return 0.0 when num_bytes <= 0.

Test cases

case 1
in: [5.545177444479562,8]
expected: 1
case 2
in: [10,0]
expected: 0
case 3
in: [0,4]
expected: 0
case 4
in: [22.18070977791825,4]
expected: 8
Starter codePython
import math
def bits_per_byte(total_nll_nats, num_bytes):
    # Your code here
    pass

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