Machine Learning
지니 계수 (Gini Coefficient)
robin0309
2021. 6. 4. 09:54
지니 계수
* 어떤값의 분배 상태를 표현하기 위해 로렌츠 곡선을 이용하여 값의 분배 정도를 수치화 하는 방법
-> 보통 경제적 불평등을 계수화 한 것이라 표현
-> 머신러닝에서는 Decision Tree model의 성능 평가를 하는데 사용
Gini index =A/(A+B)
코드 구현의 예시
def gini(list_of_values):
sorted_list = sorted(list_of_values) height, area = 0, 0
for value in sorted_list:
height += value area += height - value / 2.
fair_area = height * len(list_of_values) / 2.
return (fair_area - area) / fair_area
반응형