def temp_holdout(y_panel_df, val_periods):
    """Splits the data in train and validation sets.

    Parameters
    ----------
    y_panel_df: pandas df
        Pandas DataFrame with columns ['unique_id', 'ds', 'y']

    Returns
    -------
    Tuple
        - train: pandas df
        - val: pandas df
    """
    val = y_panel_df.groupby('unique_id').tail(val_periods)
    train = y_panel_df.groupby('unique_id').apply(lambda df: df.head(-val_periods)).reset_index(drop=True)

    return train, val