---
title: 'XGBoost with Python'
disqus: hackmd
---
XGBoost with Python
===



## Table of Contents
[TOC]
## Installation
```
$ pip install xgboost
$ pip install --upgrade xgboost
```
Load and Prepare Data
---
Import both pre-made dataset and libraries.
```gherkin=
from numpy import loadtxt
from xgboost import XGBClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
```
Load dataset and hold features
```gherkin=
# load data
dataset = loadtxt('pima-indians-diabetes.csv', delimiter=",")
# get feature patterns into X-input and Y-output
X = dataset[:,0:8]
Y = dataset[:,8]
# display extraction
dataset.head(2)
X.head(1)
Y.head(1)
```
> Read more about Gherkin here: https://docs.cucumber.io/gherkin/reference/
User flows
---
```sequence
Alice->Bob: Hello Bob, how are you?
Note right of Bob: Bob thinks
Bob-->Alice: I am good thanks!
Note left of Alice: Alice responds
Alice->Bob: Where have you been?
```
> Read more about sequence-diagrams here: http://bramp.github.io/js-sequence-diagrams/
Project Timeline
---
```mermaid
gantt
title A Gantt Diagram
section Section
A task :a1, 2014-01-01, 30d
Another task :after a1 , 20d
section Another
Task in sec :2014-01-12 , 12d
anther task : 24d
```
> Read more about mermaid here: http://mermaid-js.github.io/mermaid/
## Appendix and FAQ
:::info
**Find this document incomplete?** Leave a comment!
:::
###### tags: `Templates` `Documentation`