Skip to content

Commit

Permalink
CLN: Remove unused import. Fix comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
jseabold committed May 11, 2015
1 parent a4de0eb commit 932af82
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions wrapper/xgboost.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import ctypes
import platform
import collections
from io import BytesIO

import numpy as np
import scipy.sparse
Expand Down Expand Up @@ -492,7 +491,7 @@ def save_model(self, fname):
def save_raw(self):
"""
Save the model to a in memory buffer represetation
Returns
-------
a in memory buffer represetation of the model
Expand Down Expand Up @@ -876,12 +875,12 @@ def __init__(self, max_depth=3, learning_rate=0.1, n_estimators=100, silent=True
self._Booster = None

def __getstate__(self):
# can't pickle ctypes pointers so put _Booster in a BytesIO obj
this = self.__dict__.copy() # don't modify in place
# can't pickle ctypes pointers so put _Booster in a bytearray object
this = self.__dict__.copy() # don't modify in place
bst = this["_Booster"]
if bst is not None:
raw = this["_Booster"].save_raw()
this["_Booster"] = raw
this["_Booster"] = raw
return this

def __setstate__(self, state):
Expand All @@ -894,15 +893,15 @@ def booster(self):
"""
get the underlying xgboost Booster of this model
will raise an exception when fit was not called
Returns
-------
booster : a xgboost booster of underlying model
"""
if self._Booster is None:
raise XGBError('need to call fit beforehand')
return self._Booster

def get_xgb_params(self):
xgb_params = self.get_params()

Expand Down

0 comments on commit 932af82

Please sign in to comment.