All problems
Monotonic Binning Check
Problem
Check whether a sequence of WOE values is monotonic: either non-decreasing or non-increasing throughout.
Sequences with fewer than two values return True.
Hint
Monotonic WOE across bins is a common scorecard requirement.
Test cases
case 1
in: [[0.1,0.2,0.3]]
expected: true
case 2
in: [[0.3,0.2,0.1]]
expected: true
case 3
in: [[0.1,0.3,0.2]]
expected: false
case 4
in: [[]]
expected: true
case 5
in: [[0.5]]
expected: true
Starter codePython
def is_monotonic(woe_values):
# Your code here
pass5 test cases · run your code against them in the editor