All problems
Monotonicity Check
Problem
Check model-agnostic monotonicity: sort samples by the feature value and return True when predictions are non-decreasing.
Empty input returns True.
Hint
Monotonicity checks are used to validate regulated or explainable models.
Test cases
case 1
in: [[1,2,3],[1,2,3]]
expected: true
case 2
in: [[1,2,3],[1,3,2]]
expected: false
case 3
in: [[1,1,2],[2,1,3]]
expected: true
Starter codePython
def monotonicity_check(feature_values, predictions):
# Your code here
pass3 test cases · run your code against them in the editor