code: def _crossvalidation_with_time_threshold(
      df, n_lags, n_forecasts, k, fold_pct, fold_overlap_pct=0.0
  ):
      """Splits data in k folds for crossvalidation accordingly to time threshold.
  
      Parameters
      ----------
          df : pd.DataFrame
              data with column ``ds``, ``y``, and ``ID``
          n_lags : int
              identical to NeuralProphet
          n_forecasts : int
              identical to NeuralProphet
          k : int
              number of CV folds
          fold_pct : float
              percentage of overall samples to be in each fold
          fold_overlap_pct : float
              percentage of overlap between the validation folds (default: 0.0)
  
      Returns
      -------
          list of k tuples [(df_train, df_val), ...]
  
              training data
  
              validation data
      """
      df_merged = merge_dataframes(df)
      total_samples = len(df_merged) - n_lags + 2 - (2 * n_forecasts)
      samples_fold = max(1, int(fold_pct * total_samples))
      samples_overlap = int(fold_overlap_pct * samples_fold)
      assert samples_overlap < samples_fold
      min_train = (
          total_samples
          - samples_fold
          - (k - 1) * (samples_fold - samples_overlap)
      )
      assert min_train >= samples_fold
      folds = []
      df_fold, _, _, _ = prep_or_copy_df(df)
      for i in range(k, 0, -1):
          threshold_time_stamp = find_time_threshold(
              df_fold,
              n_lags,
              n_forecasts,
              samples_fold,
              inputs_overbleed=True,
          )
          df_train, df_val = split_considering_timestamp(
              df_fold,
              n_lags,
              n_forecasts,
              inputs_overbleed=True,
              threshold_time_stamp=threshold_time_stamp,
          )
          folds.append((df_train, df_val))
          split_idx = len(df_merged) - samples_fold + samples_overlap
          df_merged = df_merged[:split_idx].reset_index(drop=True)
          threshold_time_stamp = df_merged["ds"].iloc[-1]
          df_fold_aux = pd.DataFrame()
          for df_name, df_i in df_fold.groupby("ID"):
              df_aux = (
                  df_i.copy(deep=True)
                  .iloc[
                      : len(df_i[df_i["ds"] < threshold_time_stamp]) + 1
                  ]
                  .reset_index(drop=True)
              )
              df_fold_aux = pd.concat(
                  (df_fold_aux, df_aux), ignore_index=True
              )
          df_fold = df_fold_aux.copy(deep=True)
      folds = folds[::-1]
      return folds
  
imports: from __future__ import annotations
  import logging
  import math
  from collections import OrderedDict
  from dataclasses import dataclass
  from typing import TYPE_CHECKING, List, Optional, Tuple
  import numpy
  import pandas
label_desc: Use image node_id 14 for calling a global function with example usage: _crossvalidation_with_time_threshold(df, n_lags, n_forecasts, k, fold_pct, fold_overlap_pct) and returns: folds