Update demo scripts to use installed python library
This commit is contained in:
parent
ceb62e9231
commit
a0e07f16c4
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import sys
|
|
||||||
|
|
||||||
def loadfmap( fname ):
|
def loadfmap( fname ):
|
||||||
fmap = {}
|
fmap = {}
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import sys
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import scipy.sparse
|
import scipy.sparse
|
||||||
# append the path to xgboost, you may need to change the following line
|
|
||||||
# alternatively, you can add the path to PYTHONPATH environment variable
|
|
||||||
sys.path.append('../../wrapper')
|
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
|
|
||||||
### simple example
|
### simple example
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import sys
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
sys.path.append('../../wrapper')
|
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
|
|
||||||
dtrain = xgb.DMatrix('../data/agaricus.txt.train')
|
dtrain = xgb.DMatrix('../data/agaricus.txt.train')
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import sys
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
sys.path.append('../../wrapper')
|
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
|
|
||||||
### load data in do training
|
### load data in do training
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import sys
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
sys.path.append('../../wrapper')
|
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
###
|
###
|
||||||
# advanced: cutomsized loss function
|
# advanced: cutomsized loss function
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import sys
|
|
||||||
sys.path.append('../../wrapper')
|
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
##
|
##
|
||||||
# this script demonstrate how to fit generalized linear model in xgboost
|
# this script demonstrate how to fit generalized linear model in xgboost
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import sys
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
sys.path.append('../../wrapper')
|
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
|
|
||||||
### load data in do training
|
### load data in do training
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import sys
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
sys.path.append('../../wrapper')
|
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
|
|
||||||
### load data in do training
|
### load data in do training
|
||||||
|
|||||||
@ -4,8 +4,6 @@ Created on 1 Apr 2015
|
|||||||
@author: Jamie Hall
|
@author: Jamie Hall
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
|
||||||
sys.path.append('../../wrapper')
|
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import sys
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
sys.path.append('../../wrapper')
|
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
|
|
||||||
### load data in do training
|
### load data in do training
|
||||||
|
|||||||
@ -1,14 +1,6 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# this is the example script to use xgboost to train
|
# this is the example script to use xgboost to train
|
||||||
import inspect
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
# add path of xgboost python module
|
|
||||||
code_path = os.path.join(
|
|
||||||
os.path.split(inspect.getfile(inspect.currentframe()))[0], "../../wrapper")
|
|
||||||
|
|
||||||
sys.path.append(code_path)
|
|
||||||
|
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# make prediction
|
# make prediction
|
||||||
import sys
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
# add path of xgboost python module
|
|
||||||
sys.path.append('../../wrapper/')
|
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
|
|
||||||
# path to where the data lies
|
# path to where the data lies
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# this is the example script to use xgboost to train
|
# this is the example script to use xgboost to train
|
||||||
import sys
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
# add path of xgboost python module
|
|
||||||
sys.path.append('../../wrapper/')
|
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
from sklearn.ensemble import GradientBoostingClassifier
|
from sklearn.ensemble import GradientBoostingClassifier
|
||||||
import time
|
import time
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
#! /usr/bin/python
|
#! /usr/bin/python
|
||||||
import sys
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
sys.path.append('../../wrapper/')
|
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
|
|
||||||
# label need to be 0 to num_class -1
|
# label need to be 0 to num_class -1
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import sys
|
|
||||||
|
|
||||||
fo = open( 'machine.txt', 'w' )
|
fo = open( 'machine.txt', 'w' )
|
||||||
cnt = 6
|
cnt = 6
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user