Skip to content

IS it Erro in gini()? #772

@craftsliu

Description

@craftsliu

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions