Skip to content

Commit

Permalink
feat: Introduce use case for dwell time
Browse files Browse the repository at this point in the history
  • Loading branch information
kajanan1212 committed May 11, 2024
1 parent e4b94d7 commit 2c4b26c
Show file tree
Hide file tree
Showing 9 changed files with 568 additions and 94 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Temporary Items
### PyCharm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
.idea/

# User-specific stuff
.idea/**/workspace.xml
Expand Down
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ Output:
3. `pipeline` can be used to run experiments with the all the steps by simply running one function with some parameters.
```py
from datetime import datetime
from ibat.pipeline import run_exp

from ibat.concept_drift_detector.strategies import DDM
from ibat.datasets import BUS_654_FEATURES_ENCODED_DWELL_TIMES
from ibat.pipeline import run_dt_exp


def datetime_from_string(datetime_string: str) -> datetime:
Expand All @@ -86,19 +88,24 @@ def datetime_from_string(datetime_string: str) -> datetime:

if __name__ == "__main__":
cdd_strategy = DDM(
drift_level=2,
min_num_instances=2,
warning_level=0.1,
drift_level=1.5,
min_num_instances=1,
)
run_exp(
run_dt_exp(
dt_df=BUS_654_FEATURES_ENCODED_DWELL_TIMES.dataframe,
hist_start=datetime_from_string("2021-10-01"),
hist_end=datetime_from_string("2022-01-01"),
stream_start=datetime_from_string("2022-01-01"),
hist_end=datetime_from_string("2022-02-01"),
stream_start=datetime_from_string("2022-02-01"),
stream_end=datetime_from_string("2022-11-01"),
interval_min=60,
interval_min=60 * 2,
chunk_size=100,
active_strategy=True,
is_buffer_enabled=False,
cdd_strategy=cdd_strategy,
output_parent_dir="../experiments",
label="m-xgb-s-xgb_model",
incremental_learning=True,
output_parent_dir="./demo",
label="demo-dt-exp-for-hbp",
)
```

Expand Down
4 changes: 2 additions & 2 deletions examples/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from src.concept_drift_detector.strategies import DDM
from src.datasets import BUS_654_FEATURES_ENCODED_DWELL_TIMES
from src.pipeline import run_exp
from src.pipeline import run_dt_exp


def datetime_from_string(datetime_string: str) -> datetime:
Expand All @@ -28,7 +28,7 @@ def datetime_from_string(datetime_string: str) -> datetime:
folder_path_to_save_result = "../experiments"
experiment_label = "m-xgb-s-xgb_model-d-batch_r2"

run_exp(
run_dt_exp(
dt_df=dwell_time_df,
hist_start=historical_data_starting_from,
hist_end=historical_data_ending_at,
Expand Down
Loading

0 comments on commit 2c4b26c

Please sign in to comment.