add more params
This commit is contained in:
parent
fcb833373b
commit
0058ebac9a
@ -764,20 +764,27 @@ class XGBModel(BaseEstimator):
|
|||||||
|
|
||||||
nthread : int
|
nthread : int
|
||||||
Number of parallel threads used to run xgboost.
|
Number of parallel threads used to run xgboost.
|
||||||
|
gamma : float
|
||||||
|
Minimum loss reduction required to make a further partition on a leaf node of the tree.
|
||||||
min_child_weight : int
|
min_child_weight : int
|
||||||
minimum sum of instance weight(hessian) needed in a child.
|
Minimum sum of instance weight(hessian) needed in a child.
|
||||||
|
max_delta_step : int
|
||||||
|
Maximum delta step we allow each tree's weight estimation to be.
|
||||||
subsample : float
|
subsample : float
|
||||||
Subsample ratio of the training instance.
|
Subsample ratio of the training instance.
|
||||||
colsample_bytree : float
|
colsample_bytree : float
|
||||||
Subsample ratio of columns when constructing each tree.
|
Subsample ratio of columns when constructing each tree.
|
||||||
|
|
||||||
|
base_score:
|
||||||
|
The initial prediction score of all instances, global bias.
|
||||||
eval_metric : string
|
eval_metric : string
|
||||||
Evaluation metrics for validation data.
|
Evaluation metrics for validation data.
|
||||||
seed : int
|
seed : int
|
||||||
Random number seed.
|
Random number seed.
|
||||||
"""
|
"""
|
||||||
def __init__(self, max_depth=3, learning_rate=0.1, n_estimators=100, silent=True, objective="reg:linear",
|
def __init__(self, max_depth=3, learning_rate=0.1, n_estimators=100, silent=True, objective="reg:linear",
|
||||||
nthread=-1, min_child_weight=1, subsample=1, colsample_bytree=1,
|
nthread=-1, gamma=0, min_child_weight=1, max_delta_step=0, subsample=1, colsample_bytree=1,
|
||||||
eval_metric='error', seed=0):
|
base_score=0.5, eval_metric='error', seed=0):
|
||||||
if not SKLEARN_INSTALLED:
|
if not SKLEARN_INSTALLED:
|
||||||
raise Exception('sklearn needs to be installed in order to use this module')
|
raise Exception('sklearn needs to be installed in order to use this module')
|
||||||
self.max_depth = max_depth
|
self.max_depth = max_depth
|
||||||
@ -787,9 +794,13 @@ class XGBModel(BaseEstimator):
|
|||||||
self.objective = objective
|
self.objective = objective
|
||||||
|
|
||||||
self.nthread = nthread
|
self.nthread = nthread
|
||||||
|
self.gamma = gamma
|
||||||
self.min_child_weight = min_child_weight
|
self.min_child_weight = min_child_weight
|
||||||
|
self.max_delta_step = max_delta_step
|
||||||
self.subsample = subsample
|
self.subsample = subsample
|
||||||
self.colsample_bytree = colsample_bytree
|
self.colsample_bytree = colsample_bytree
|
||||||
|
|
||||||
|
self.base_score = base_score
|
||||||
self.eval_metric = eval_metric
|
self.eval_metric = eval_metric
|
||||||
self.seed = seed
|
self.seed = seed
|
||||||
|
|
||||||
@ -816,11 +827,11 @@ class XGBModel(BaseEstimator):
|
|||||||
|
|
||||||
class XGBClassifier(XGBModel, ClassifierMixin):
|
class XGBClassifier(XGBModel, ClassifierMixin):
|
||||||
def __init__(self, max_depth=3, learning_rate=0.1, n_estimators=100, silent=True, objective="binary:logistic",
|
def __init__(self, max_depth=3, learning_rate=0.1, n_estimators=100, silent=True, objective="binary:logistic",
|
||||||
nthread=-1, min_child_weight=1, subsample=1, colsample_bytree=1,
|
nthread=-1, gamma=0, min_child_weight=1, max_delta_step=0, subsample=1, colsample_bytree=1,
|
||||||
eval_metric='error', seed=0):
|
base_score=0.5, eval_metric='error', seed=0):
|
||||||
super(XGBClassifier, self).__init__(max_depth, learning_rate, n_estimators, silent, objective,
|
super(XGBClassifier, self).__init__(max_depth, learning_rate, n_estimators, silent, objective,
|
||||||
nthread, min_child_weight, subsample, colsample_bytree,
|
nthread, gamma, min_child_weight, max_delta_step, subsample, colsample_bytree,
|
||||||
eval_metric, seed)
|
base_score, eval_metric, seed)
|
||||||
|
|
||||||
def fit(self, X, y, sample_weight=None):
|
def fit(self, X, y, sample_weight=None):
|
||||||
y_values = list(np.unique(y))
|
y_values = list(np.unique(y))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user