parameters: (self, data: DMatrix)
docstring: Validate Booster and data's feature_names are identical.
          Set feature_names and feature_types from DMatrix
docstring_summary: Validate Booster and data's feature_names are identical.
          Set feature_names and feature_types from DMatrix
docstring_tokens: Validate Booster and data s feature_names are identical . Set feature_names and feature_types from DMatrix
function: def _validate_features(self, data: DMatrix) -> None:
          """
          Validate Booster and data's feature_names are identical.
          Set feature_names and feature_types from DMatrix
          """
          if data.num_row() == 0:
              return
  
          if self.feature_names is None:
              self.feature_names = data.feature_names
              self.feature_types = data.feature_types
          if data.feature_names is None and self.feature_names is not None:
              raise ValueError(
                  "training data did not have the following fields: " +
                  ", ".join(self.feature_names)
              )
          # Booster can't accept data with different feature names
          if self.feature_names != data.feature_names:
              dat_missing = set(self.feature_names) - set(data.feature_names)
              my_missing = set(data.feature_names) - set(self.feature_names)
  
              msg = 'feature_names mismatch: {0} {1}'
  
              if dat_missing:
                  msg += ('\nexpected ' + ', '.join(
                      str(s) for s in dat_missing) + ' in input data')
  
              if my_missing:
                  msg += ('\ntraining data did not have the following fields: ' +
                          ', '.join(str(s) for s in my_missing))
  
              raise ValueError(msg.format(self.feature_names, data.feature_names))
function_tokens: def _validate_features ( self , data : DMatrix ) -> None : if data . num_row ( ) == 0 : return if self . feature_names is None : self . feature_names = data . feature_names self . feature_types = data . feature_types if data . feature_names is None and self . feature_names is not None : raise ValueError ( "training data did not have the following fields: " + ", " . join ( self . feature_names ) ) # Booster can't accept data with different feature names if self . feature_names != data . feature_names : dat_missing = set ( self . feature_names ) - set ( data . feature_names ) my_missing = set ( data . feature_names ) - set ( self . feature_names ) msg = 'feature_names mismatch: {0} {1}' if dat_missing : msg += ( '\nexpected ' + ', ' . join ( str ( s ) for s in dat_missing ) + ' in input data' ) if my_missing : msg += ( '\ntraining data did not have the following fields: ' + ', ' . join ( str ( s ) for s in my_missing ) ) raise ValueError ( msg . format ( self . feature_names , data . feature_names ) )