original_docstring: 
          Fit the XGBoost Model to the train data, using valid as the validation set.
          
docstring: Fit the XGBoost Model to the train data, using valid as the validation set.
docstring_tokens: Fit the XGBoost Model to the train data using valid as the validation set .
code: def fit(self, train_x, train_y, valid_x=None, valid_y=None, **kwa):
          """
          Fit the XGBoost Model to the train data, using valid as the validation set.
          """
          params = self.params.copy()
  
          self.feature_names = kwa.get('feature_names', None)
  
          dtrain = xgb.DMatrix(train_x, label=train_y, feature_names=self.feature_names)
  
          if valid_x is None:
              watchlist = [(dtrain, 'train')]
          else:
              dvalid = xgb.DMatrix(valid_x, label=valid_y, feature_names=self.feature_names)
              watchlist = [(dtrain, 'train'), (dvalid, 'validation')]
  
          self.model = xgb.train(params, dtrain, self.n_iter, watchlist,
                                 verbose_eval=50, early_stopping_rounds=100)
code_tokens: def fit ( self , train_x , train_y , valid_x = None , valid_y = None , ** kwa ) : params = self . params . copy ( ) self . feature_names = kwa . get ( 'feature_names' , None ) dtrain = xgb . DMatrix ( train_x , label = train_y , feature_names = self . feature_names ) if valid_x is None : watchlist = [ ( dtrain , 'train' ) ] else : dvalid = xgb . DMatrix ( valid_x , label = valid_y , feature_names = self . feature_names ) watchlist = [ ( dtrain , 'train' ) , ( dvalid , 'validation' ) ] self . model = xgb . train ( params , dtrain , self . n_iter , watchlist , verbose_eval = 50 , early_stopping_rounds = 100 )
short_docstring: Fit the XGBoost Model to the train data, using valid as the validation set.
short_docstring_tokens: Fit the XGBoost Model to the train data using valid as the validation set .
comment: """
          Fit the XGBoost Model to the train data, using valid as the validation set.
          """