Fix minor typos (#2842)

* Some minor changes to the code style

Some minor changes to the code style in file basic_walkthrough.py

* coding style changes

* coding style changes arrcording PEP8

* Update basic_walkthrough.py

* Fix minor typo

* Minor edits to coding style

Minor edits to coding style following the proposals of PEP8.
This commit is contained in:
LevineHuang 2017-11-30 03:22:09 +08:00 committed by Tianqi Chen
parent 77715d5c62
commit 878f307948
2 changed files with 4 additions and 4 deletions

View File

@ -1,8 +1,8 @@
Binary Classification Binary Classification
===================== =====================
This is the quick start tutorial for xgboost CLI version. This is the quick start tutorial for xgboost CLI version.
Here we demonstrate how to use XGBoost for a binary classification task. Before getting started, make sure you compile xgboost in the root directory of the project by typing ```make``` Here we demonstrate how to use XGBoost for a binary classification task. Before getting started, make sure you compile xgboost in the root directory of the project by typing ```make```.
The script runexp.sh can be used to run the demo. Here we use [mushroom dataset](https://archive.ics.uci.edu/ml/datasets/Mushroom) from UCI machine learning repository. The script 'runexp.sh' can be used to run the demo. Here we use [mushroom dataset](https://archive.ics.uci.edu/ml/datasets/Mushroom) from UCI machine learning repository.
### Tutorial ### Tutorial
#### Generate Input Data #### Generate Input Data
@ -80,7 +80,7 @@ booster = gblinear
# L2 regularization term on weights, default 0 # L2 regularization term on weights, default 0
lambda = 0.01 lambda = 0.01
# L1 regularization term on weights, default 0 # L1 regularization term on weights, default 0
f ```agaricus.txt.test.buffer``` exists, and automatically loads from binary buffer if possible, this can speedup training process when you do training many times. You can disable it by setting ```use_buffer=0```. If ```agaricus.txt.test.buffer``` exists, and automatically loads from binary buffer if possible, this can speedup training process when you do training many times. You can disable it by setting ```use_buffer=0```.
- Buffer file can also be used as standalone input, i.e if buffer file exists, but original agaricus.txt.test was removed, xgboost will still run - Buffer file can also be used as standalone input, i.e if buffer file exists, but original agaricus.txt.test was removed, xgboost will still run
* Deviation from LibSVM input format: xgboost is compatible with LibSVM format, with the following minor differences: * Deviation from LibSVM input format: xgboost is compatible with LibSVM format, with the following minor differences:
- xgboost allows feature index starts from 0 - xgboost allows feature index starts from 0

View File

@ -7,7 +7,7 @@ import xgboost as xgb
# label need to be 0 to num_class -1 # label need to be 0 to num_class -1
data = np.loadtxt('./dermatology.data', delimiter=',', data = np.loadtxt('./dermatology.data', delimiter=',',
converters={33: lambda x:int(x == '?'), 34: lambda x:int(x)-1}) converters={33: lambda x:int(x == '?'), 34: lambda x:int(x) - 1})
sz = data.shape sz = data.shape
train = data[:int(sz[0] * 0.7), :] train = data[:int(sz[0] * 0.7), :]