multi class

This commit is contained in:
tqchen 2014-05-16 20:12:04 -07:00
parent 2fcd875675
commit d3c0ed14f3
3 changed files with 12 additions and 8 deletions

View File

@ -0,0 +1,9 @@
#!/bin/bash
if [ -f dermatology.data ]
then
echo "use existing data to run multi class classification"
else
echo "getting data from uci, make sure you are connected to internet"
wget https://archive.ics.uci.edu/ml/machine-learning-databases/dermatology/dermatology.data
fi
python train.py

View File

@ -4,9 +4,8 @@ import numpy as np
sys.path.append('../../python/')
import xgboost as xgb
data = np.loadtxt('./dermatology.data', delimiter=',',converters={33: lambda x:int(x == '?'), 34: lambda x:int(x) } )
# label need to be 0 to num_class -1
data = np.loadtxt('./dermatology.data', delimiter=',',converters={33: lambda x:int(x == '?'), 34: lambda x:int(x)-1 } )
sz = data.shape
train = data[:int(sz[0] * 0.7), :]
@ -31,11 +30,9 @@ param['bst:eta'] = 0.1
param['bst:max_depth'] = 6
param['silent'] = 1
param['nthread'] = 4
param['num_class'] = 5
param['num_class'] = 6
watchlist = [ (xg_train,'train'), (xg_test, 'test') ]
num_round = 5
bst = xgb.train(param, xg_train, num_round, watchlist );

View File

@ -1,2 +0,0 @@
#! /bin/bash
wget https://archive.ics.uci.edu/ml/machine-learning-databases/dermatology/dermatology.data