class_docstr: Class for all standard transformation steps.
class_docstr_tok: ["Class","for","all","standard","transformation","steps","."]
docstr: Assign the fold strategy.
docstr_tok: ["Assign","the","fold","strategy","."]
code: def _prepare_folds(
      self,
      fold_strategy,
      fold,
      fold_shuffle,
      fold_groups,
      data_split_shuffle,
  ):
      """Assign the fold strategy."""
      self.logger.info("Set up folding strategy.")
      allowed_fold_strategy = [
          "kfold",
          "stratifiedkfold",
          "groupkfold",
          "timeseries",
      ]
  
      if isinstance(fold_strategy, str):
          if fold_strategy == "groupkfold":
              if fold_groups is None or len(fold_groups) == 0:
                  raise ValueError(
                      "Invalid value for the fold_strategy parameter. 'groupkfold' "
                      "requires 'fold_groups' to be a non-empty array-like object."
                  )
          elif fold_strategy not in allowed_fold_strategy:
              raise ValueError(
                  "Invalid value for the fold_strategy parameter. "
                  f"Choose from: {', '.join(allowed_fold_strategy)}."
              )
  
      if fold_strategy == "timeseries" or isinstance(
          fold_strategy, TimeSeriesSplit
      ):
          if fold_shuffle or data_split_shuffle:
              raise ValueError(
                  "Invalid value for the fold_strategy parameter. 'timeseries' "
                  "requires 'data_split_shuffle' and 'fold_shuffle' to be False "
                  "as it can lead to unexpected data split."
              )
  
      if isinstance(fold_groups, str):
          if fold_groups in self.X.columns:
              if pd.isna(self.X[fold_groups]).any():
                  raise ValueError(
                      "The 'fold_groups' column cannot contain NaNs."
                  )
              else:
                  self.fold_groups_param = self.X[fold_groups]
          else:
              raise ValueError(
                  "Invalid value for the fold_groups parameter. "
                  f"Column {fold_groups} is not present in the dataset."
              )
  
      if fold_strategy == "kfold":
          self.fold_generator = KFold(
              fold,
              shuffle=fold_shuffle,
              random_state=self.seed if fold_shuffle else None,
          )
      elif fold_strategy == "stratifiedkfold":
          self.fold_generator = StratifiedKFold(
              fold,
              shuffle=fold_shuffle,
              random_state=self.seed if fold_shuffle else None,
          )
      elif fold_strategy == "groupkfold":
          self.fold_generator = GroupKFold(fold)
      elif fold_strategy == "timeseries":
          self.fold_generator = TimeSeriesSplit(fold)
      else:
          self.fold_generator = fold_strategy
  
imports: from copy import deepcopy
  import numpy
  import pandas
  from category_encoders.basen import BaseNEncoder
  from category_encoders.one_hot import OneHotEncoder
  from category_encoders.ordinal import OrdinalEncoder
  from category_encoders.target_encoder import TargetEncoder
  from imblearn.combine import SMOTEENN, SMOTETomek
  from imblearn.over_sampling import ADASYN, SMOTE, SMOTEN, SMOTENC, SVMSMOTE, BorderlineSMOTE, KMeansSMOTE, RandomOverSampler
  from imblearn.under_sampling import AllKNN, CondensedNearestNeighbour, EditedNearestNeighbours, InstanceHardnessThreshold, NearMiss, NeighbourhoodCleaningRule, OneSidedSelection, RandomUnderSampler, RepeatedEditedNearestNeighbours, TomekLinks
  from sklearn.decomposition import PCA, IncrementalPCA, KernelPCA
  from sklearn.feature_selection import SelectFromModel, SelectKBest, SequentialFeatureSelector, VarianceThreshold, f_classif, f_regression
  from sklearn.impute import KNNImputer, SimpleImputer
  from sklearn.model_selection import GroupKFold, KFold, StratifiedKFold, TimeSeriesSplit, train_test_split
  from sklearn.preprocessing import KBinsDiscretizer, LabelEncoder, MaxAbsScaler, MinMaxScaler, PolynomialFeatures, PowerTransformer, QuantileTransformer, RobustScaler, StandardScaler
  from pycaret.containers.models.classification import get_all_model_containers
  from pycaret.containers.models.regression import get_all_model_containers
  from pycaret.internal.preprocess.iterative_imputer import IterativeImputer
  from pycaret.internal.preprocess.transformers import CleanColumnNames, DropImputer, EmbedTextFeatures, ExtractDateTimeFeatures, FixImbalancer, GroupFeatures, RareCategoryGrouping, RemoveMulticollinearity, RemoveOutliers, TargetTransformer, TransformerWrapper, TransformerWrapperWithInverse
  from pycaret.utils.constants import SEQUENCE
  from pycaret.utils.generic import MLUsecase, check_features_exist, df_shrink_dtypes, get_columns_to_stratify_by, normalize_custom_transformers, to_df, to_series
label_desc: Use image node_id 5 for calling the Preprocessor obj's underlying member method code with example usage: obj._prepare_folds(fold_strategy, fold, fold_shuffle, fold_groups, data_split_shuffle) without return types