code: def __init__(self, params):
      BaseValidator.__init__(self, params)
  
      cv_path = self.params.get("cv_path")
  
      if cv_path is None:
          raise AutoMLException(
              "You need to specify `cv` as list or iterable"
          )
  
      self.cv = joblib.load(cv_path)
      self.cv = list(self.cv)
  
      self._results_path = self.params.get("results_path")
      self._X_path = self.params.get("X_path")
      self._y_path = self.params.get("y_path")
      self._sample_weight_path = self.params.get("sample_weight_path")
      self._sensitive_features_path = self.params.get(
          "sensitive_features_path"
      )
  
      if self._X_path is None or self._y_path is None:
          raise AutoMLException(
              "No data path set in CustomValidator params"
          )
  
      folds_path = os.path.join(self._results_path, "folds")
  
      if not os.path.exists(folds_path):
          os.mkdir(folds_path)
  
          print("Custom validation strategy")
          for fold_cnt, (train_index, validation_index) in enumerate(
              self.cv
          ):
              print(f"Split {fold_cnt}.")
              print(f"Train {train_index.shape[0]} samples.")
              print(f"Validation {validation_index.shape[0]} samples.")
              train_index_file = os.path.join(
                  self._results_path,
                  "folds",
                  f"fold_{fold_cnt}_train_indices.npy",
              )
              validation_index_file = os.path.join(
                  self._results_path,
                  "folds",
                  f"fold_{fold_cnt}_validation_indices.npy",
              )
  
              np.save(train_index_file, train_index)
              np.save(validation_index_file, validation_index)
  
      else:
          log.debug("Folds split already done, reuse it")
  
file_path: mljar-supervised/supervised/validation/validator_custom.py
imports: import gc
  import logging
  import os
  import warnings
  import joblib
  import numpy
  import pandas
  import time
  from sklearn.model_selection import KFold, StratifiedKFold
  from supervised.exceptions import AutoMLException
  from supervised.utils.config import mem
  from supervised.utils.utils import load_data
  from supervised.validation.validator_base import BaseValidator
label_desc: Use image node_id 1 to create a new CustomValidator object from inherited base classes: BaseValidator with example: obj = CustomValidator(params)