{"version":"1.0","type":"rich","title":"Xgboost cross validation functions for time series data + gridsearch functions in R","description":"This example shows a custom cross-validation function for XGBoost models on time-series data, using explicitly defined training and test index lists rather than random folds. The R code implements `xgb.ts.cv`, which extends the standard `xgb.cv` API by accepting separate `traininds` and `testinds` parameters, enabling chronological splits. It internally uses `xgb.ts.cv.mkfold` to create fold-specific boosters and watchlists, then iterates through boosting rounds with `xgb.iter.update` and `xgb.iter.eval`, aggregating results via `xgb.cv.aggcv`. The function supports early stopping, custom metrics, and prediction output, mirroring the original xgboost package’s cross-validation workflow.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-92d0dc3d6d5ae1c7e70b5767dd6802bf?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}