Decision Tree

Plot Tree 색상 변경

개요 skleran.tree.plot_tree의 색상을 바꿔보도록 한다. matplotlib 객체지향의 구조를 알면 어렵지(?) 않게 바꿀 수 있다. 간단하게 plot_tree 시각화를 구현해본다. 언제나 예제로 희생당하는 iris 데이터에게 애도를 표한다. 구글코랩에서 실행 시, 다음 코드를 실행하여 최신 라이브러리로 업그레이드 한다. !pip install -U matplotlib Requirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (3.2.2) Collecting matplotlib Downloading matplotlib-3.5.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (11.2 MB)  |████████████████████████████████| 11.2 MB 27.0 MB/s [?25hRequirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib) (1.4.0) Requirement already satisfied: python-dateutil>=2.

결정 트리 학습 이론

개요 현대 머신러닝 이론의 백본(Backbone)이 되는 결정 트리에 대해 이론적으로 살짝 정리한다. 주요 수식은 Python Machine Learning Second Edition 교재를 주로 참고 하였다. (Page: 90 ~ 94) 교재 출처: https://www.amazon.com/Python-Machine-Learning-scikit-learn-TensorFlow/dp/1787125939 결정 트리의 예 결정 트리는 여러가지 연속된 질문을 학습하여 분류하는 것이 원칙이다. 다음의 간단한 예를 들어본다. 결정 트리는 크게 3가지로 구성이 되어 있다. 트리 내부 노드, 리프 노드, 그리고 가지로 구성이 되어 있다. 어떻게 질문을 하느냐에 따라서 분류가 결정된다. 결정 트리는 숫자에도 적용할 수 있다.

Validation schemes for 2-nd level models

There are a number of ways to validate second level models (meta-models). In this reading material you will find a description for the most popular ones. If not specified, we assume that the data does not have a time component. We also assume we already validated and fixed hyperparameters for the first level models (models). Simple holdout scheme Split train data into three parts: partA and partB and partC. Fit N diverse models on partA, predict for partB, partC, test_data getting meta-features partB_meta, partC_meta and test_meta respectively.

입문자를 위한 머신러닝 분류 튜토리얼 - Decision Tree

개요 사이킷런(scikit-learn)은 파이썬 머신러닝 라이브러리이다. 파이썬에서 나오는 최신 알고리즘들도 이제는 사이킷런에 통합하는 형태로 취하고 있다. 구글 코랩은 기본적으로 사이킷런까지 설치가 완료되기에 별도의 설치가 필요없는 장점이 있다. Note: 본 포스트는 머신러닝 자체를 처음 접하는 분들을 위한 것이기 때문에, 어느정도 경험이 있으신 분들은 필자의 다른 포스트를 읽어주시기를 바랍니다. 패키지 불러오기 패키지는 시간에 지남에 따라 계속 업그레이드가 되기 때문에 꼭 버전 체크를 하는 것을 권장한다. 필자가 글을 남겼을 때는 2020년 8월 16일에 작성했음을 기억하자.