로딩
요청 처리 중입니다...

[필기] Decision Tree 모델_머신러닝 with Python

 [필기] Decision Tree 모델_머신러닝 with Python

Decision Tree에 대한 기본 개념에 대한 글이다. Decision Tree Classification 샘플 데이터는 개념 설명 글에서 사용했던 데이터를 사용하려고 한다. data = { "value": [30, 120, 150, 390, 400, 300, 500], "label": [0, 0, 1, 0, 0, 1, 0] } data = pd.DataFrame(data) Decision Tree 연속형 변수 나누는 STEP 에 맞춰서 코드를 진행하려고 한다. 1.

변수 값에 따라 데이터를 정렬한다. sorted_data = data.sort_values(by="value") sorted_data = sorted_data.reset_index(drop=True) 2. 정답이 바뀌는 경계 지점을 찾는다. boundary = sorted_data["label"].diff() !

= 0 boundary[0] = False #첫번째 값 boundary_idx = boundary.loc[...

# DecisionTree # decisiontreeregressor