uber / causalml

Uplift modeling and causal inference with machine learning algorithms
Other
4.87k stars 756 forks source link

IS it Erro in gini()? #772

Open craftsliu opened 1 month ago

craftsliu commented 1 month ago

Describe the bug image To Reproduce import numpy as np

y = np.array([3, 1, 4, 1, 5]) p = np.array([2.5, 0.8, 4.2, 1.2, 4.9])

arr = np.array([y, p]).transpose() print(arr)

true_order = arr[arr[:, 0].argsort()][::-1, 0]

按照预测值从大到小排序

pred_order = arr[arr[:, 1].argsort()][::-1, 0]

打印排序结果

print("按真实值排序:", true_order) print("按预测值排序:", pred_order) then it print : [[3. 2.5] [1. 0.8] [4. 4.2] [1. 1.2] [5. 4.9]] 按真实值排序: [5. 4. 3. 1. 1.] 按预测值排序: [5. 4. 3. 1. 1.] Expected behavior if change

按照预测值从大到小排序

pred_order = arr[arr[:, 1].argsort()][::-1, 1]

then it will print [[3. 2.5] [1. 0.8] [4. 4.2] [1. 1.2] [5. 4.9]] 按真实值排序: [5. 4. 3. 1. 1.] 按预测值排序: [4.9 4.2 2.5 1.2 0.8]

jeongyoonlee commented 1 month ago

@ppstacy, @paullo0106, @zhenyuz0500, @vincewu51, Can you take a look at this issue?