code: def __inner_predict(self, data_idx):
          
          if data_idx >= self.__num_dataset:
              raise ValueError("Data_idx should be smaller than number of dataset")
          if self.__inner_predict_buffer[data_idx] is None:
              if data_idx == 0:
                  n_preds = self.train_set.num_data() * self.__num_class
              else:
                  n_preds = self.valid_sets[data_idx - 1].num_data() * self.__num_class
              self.__inner_predict_buffer[data_idx] = np.zeros(n_preds, dtype=np.float64)
          # avoid to predict many time in one iteration
          if not self.__is_predicted_cur_iter[data_idx]:
              tmp_out_len = ctypes.c_int64(0)
              data_ptr = self.__inner_predict_buffer[data_idx].ctypes.data_as(ctypes.POINTER(ctypes.c_double))
              _safe_call(_LIB.LGBM_BoosterGetPredict(
                  self.handle,
                  ctypes.c_int(data_idx),
                  ctypes.byref(tmp_out_len),
                  data_ptr))
              if tmp_out_len.value != len(self.__inner_predict_buffer[data_idx]):
                  raise ValueError("Wrong length of predict results for data %d" % (data_idx))
              self.__is_predicted_cur_iter[data_idx] = True
          return self.__inner_predict_buffer[data_idx]
docs: Predict for training and validation dataset.