From bce8056050edc041363f2df8f4875e1c0bb0c02c Mon Sep 17 00:00:00 2001 From: FBruzzesi Date: Fri, 17 May 2024 10:14:04 +0200 Subject: [PATCH] docs --- docs/api/sklearn.md | 6 ++++++ docs/api/timebasedsplit.md | 9 +++------ mkdocs.yml | 9 ++++----- timebasedcv/sklearn.py | 6 ++---- 4 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 docs/api/sklearn.md diff --git a/docs/api/sklearn.md b/docs/api/sklearn.md new file mode 100644 index 0000000..08ee8fd --- /dev/null +++ b/docs/api/sklearn.md @@ -0,0 +1,6 @@ +# Scikit-learn Compatible Time Based Cross Validation + +::: timebasedcv.sklearn.TimeBasedCVSplitter + options: + show_root_full_path: false + show_root_heading: true diff --git a/docs/api/timebasedsplit.md b/docs/api/timebasedsplit.md index 2b21a61..2d66597 100644 --- a/docs/api/timebasedsplit.md +++ b/docs/api/timebasedsplit.md @@ -1,14 +1,11 @@ # TimeBased Cross Validation -::: timebasedcv.timebasedsplit.TimeBasedCVSplitter - options: - show_root_full_path: false - show_root_heading: true - ::: timebasedcv.timebasedsplit.TimeBasedSplit options: show_root_full_path: false show_root_heading: true + members: + - split ::: timebasedcv.timebasedsplit.ExpandingTimeSplit options: @@ -25,6 +22,6 @@ show_root_full_path: false show_root_heading: true members: + - split - _splits_from_period - n_splits_of - - split diff --git a/mkdocs.yml b/mkdocs.yml index 2fd3176..ce54c05 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -15,9 +15,7 @@ watch: use_directory_urls: true theme: name: material - font: - text: Ubuntu - code: Ubuntu Mono + font: false palette: - media: '(prefers-color-scheme: light)' scheme: default @@ -49,11 +47,11 @@ theme: - content.code.copy - content.tooltips - content.tabs.link - + - search.suggest - search.highlight - search.share - + - toc.follow logo: img/timebasedcv-logo.png @@ -114,6 +112,7 @@ nav: - Getting Started: getting-started.md - API: - Time based splits: api/timebasedsplit.md + - Scikit-learn Compatible CV: api/sklearn.md - Split state: api/splitstate.md - Types and protocols: api/types.md - Contributing: contribute.md diff --git a/timebasedcv/sklearn.py b/timebasedcv/sklearn.py index 3f248ed..90239e6 100644 --- a/timebasedcv/sklearn.py +++ b/timebasedcv/sklearn.py @@ -91,7 +91,7 @@ class TimeBasedCVSplitter(BaseCrossValidator): from sklearn.linear_model import Ridge from sklearn.model_selection import RandomizedSearchCV - from timebasedcv import TimeBasedCVSplitter + from timebasedcv.sklearn import TimeBasedCVSplitter start_dt = pd.Timestamp(2023, 1, 1) end_dt = pd.Timestamp(2023, 1, 31) @@ -99,9 +99,7 @@ class TimeBasedCVSplitter(BaseCrossValidator): time_series = pd.Series(pd.date_range(start_dt, end_dt, freq="D")) size = len(time_series) - df = ( - pd.DataFrame(data=np.random.randn(size, 2), columns=["a", "b"]).assign(y=lambda t: t[["a", "b"]].sum(axis=1)), - ) + df = pd.DataFrame(data=np.random.randn(size, 2), columns=["a", "b"]).assign(y=lambda t: t[["a", "b"]].sum(axis=1)) X, y = df[["a", "b"]], df["y"]