parameters: (self, model_name, model_base_path)
docstring: Initialize the service.
          
      Args:
        model_name: The name of the model.
        model_base_path: The file path of the model.
      Return:
        None
docstring_summary: Initialize the service.
          
      Args:
        model_name: The name of the model.
        model_base_path: The file path of the model.
      Return:
        None
docstring_tokens: Initialize the service . Args : model_name : The name of the model . model_base_path : The file path of the model . Return : None
function: def __init__(self, model_name, model_base_path):
      """
      Initialize the service.
          
      Args:
        model_name: The name of the model.
        model_base_path: The file path of the model.
      Return:
        None
      """
  
      super(XgboostInferenceService, self).__init__()
  
      local_model_base_path = filesystem_util.download_hdfs_moels(
          model_base_path)
  
      self.model_name = model_name
      self.model_base_path = local_model_base_path
      self.model_version_list = [1]
      self.model_graph_signature = ""
      self.platform = "XGBoost"
  
      self.preprocess_function, self.postprocess_function = preprocess_util.get_preprocess_postprocess_function_from_model_path(
          self.model_base_path)
  
      # TODO: Import as needed and only once
      import xgboost as xgb
      from sklearn.externals import joblib
  
      self.bst = xgb.Booster()
  
      # Load model
      if self.model_base_path.endswith(".joblib"):
        self.bst = joblib.load(self.model_base_path)
      elif self.model_base_path.endswith(
          ".pkl") or self.model_base_path.endswith(".pickle"):
        with open(self.model_base_path, 'rb') as f:
          self.bst = pickle.load(f)
      elif self.model_base_path.endswith(
          ".bst") or self.model_base_path.endswith(".bin"):
        self.bst.load_model(self.model_base_path)
      else:
        logger.error(
            "Unsupported model file format: {}".format(self.model_base_path))
  
      self.model_graph_signature = "score: {}\nfscore: {}".format(
          self.bst.get_score(), self.bst.get_fscore())
function_tokens: def __init__ ( self , model_name , model_base_path ) : super ( XgboostInferenceService , self ) . __init__ ( ) local_model_base_path = filesystem_util . download_hdfs_moels ( model_base_path ) self . model_name = model_name self . model_base_path = local_model_base_path self . model_version_list = [ 1 ] self . model_graph_signature = "" self . platform = "XGBoost" self . preprocess_function , self . postprocess_function = preprocess_util . get_preprocess_postprocess_function_from_model_path ( self . model_base_path ) # TODO: Import as needed and only once import xgboost as xgb from sklearn . externals import joblib self . bst = xgb . Booster ( ) # Load model if self . model_base_path . endswith ( ".joblib" ) : self . bst = joblib . load ( self . model_base_path ) elif self . model_base_path . endswith ( ".pkl" ) or self . model_base_path . endswith ( ".pickle" ) : with open ( self . model_base_path , 'rb' ) as f : self . bst = pickle . load ( f ) elif self . model_base_path . endswith ( ".bst" ) or self . model_base_path . endswith ( ".bin" ) : self . bst . load_model ( self . model_base_path ) else : logger . error ( "Unsupported model file format: {}" . format ( self . model_base_path ) ) self . model_graph_signature = "score: {}\nfscore: {}" . format ( self . bst . get_score ( ) , self . bst . get_fscore ( ) )