Skip to content

Commit

Permalink
feat: Add pipeline for running time (#54)
Browse files Browse the repository at this point in the history
feat: Add pipeline for rt
  • Loading branch information
kajanan1212 authored May 26, 2024
1 parent 6c577a3 commit 67eafdf
Show file tree
Hide file tree
Showing 187 changed files with 514 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/pipeline.py → examples/pipeline/dwell_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def datetime_from_string(datetime_string: str) -> datetime:
)
incremental_learning = True
is_buffer_enabled = False
folder_path_to_save_result = "../experiments"
folder_path_to_save_result = "../../experiments"
experiment_label = "m-xgb-s-xgb_model"

run_dt_exp(
Expand Down
51 changes: 51 additions & 0 deletions examples/pipeline/running_time.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from datetime import datetime

from ibat.concept_drift_detector.strategies import DDM
from ibat.datasets import BUS_654_FEATURES_ADDED_RUNNING_TIMES
from ibat.pipeline import run_rt_exp


def datetime_from_string(datetime_string: str) -> datetime:
return datetime.strptime(datetime_string, "%Y-%m-%d")


if __name__ == "__main__":
running_time_df = BUS_654_FEATURES_ADDED_RUNNING_TIMES.dataframe
running_time_df = running_time_df.dropna(subset=["start_time"])
running_time_df = running_time_df[running_time_df["direction"] == 1]
running_time_df[["direction", "segment"]] = running_time_df[
["direction", "segment"]
].astype(int)

historical_data_starting_from = datetime_from_string("2021-10-01")
historical_data_ending_at = datetime_from_string("2022-02-01")
streaming_data_starting_from = datetime_from_string("2022-02-01")
streaming_data_ending_at = datetime_from_string("2022-11-01")
time_interval = 60 * 2
chunk_size = 100
active_strategy = True
cdd_strategy = DDM(
warning_level=0.1,
drift_level=1.5,
min_num_instances=1,
)
incremental_learning = True
is_buffer_enabled = False
folder_path_to_save_result = "../../experiments"
experiment_label = "m-xgb-s-xgb_model"

run_rt_exp(
rt_df=running_time_df,
hist_start=historical_data_starting_from,
hist_end=historical_data_ending_at,
stream_start=streaming_data_starting_from,
stream_end=streaming_data_ending_at,
interval_min=time_interval,
chunk_size=chunk_size,
active_strategy=active_strategy,
cdd_strategy=cdd_strategy,
incremental_learning=incremental_learning,
is_buffer_enabled=is_buffer_enabled,
output_parent_dir=folder_path_to_save_result,
label=experiment_label,
)
35 changes: 35 additions & 0 deletions experiments/ex-m-xgb-s-xgb_model-2024-05-26_15-38-31/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

# Experiment: m-xgb-s-xgb_model

## Parameters
- Historical data starting from: 2021-10-01 00:00:00
- Historical data ending at: 2022-02-01 00:00:00
- Streaming data starting from: 2022-02-01 00:00:00
- Streaming data ending at: 2022-11-01 00:00:00
- Minimum waiting time: 120 minutes
- Minimum required amount of data: 100
- Batch processing technique: HYBRID
- Concept drift handling strategy: ACTIVE
- Concept drift detection algorithm: DDM
- Strategy to update the outdated model: INCREMENTAL LEARNING
- Is buffer enabled: False
- DDM:

| Attribute | Value |
|---|---|
| Warning level factor | 0.1 |
| Drift level factor | 1.5 |
| Minimum numbers of instances/batches to start looking for changes | 1 |


## Results
- Model performance metrics:

| Model | MAE (s) | RMSE (s) | MAPE (%) |
|-------------------------------------------|----------------------|-----------------------|-----------------------|
| Base model without concept drift handling | 38.827 | 63.670 | 0.284 |
| Base model with concept drift handling | 36.461 | 59.327 | 0.242 |

- Error reduction percentage in terms of MAE: 6.094 %
- Average processing time after the batch preparation: 25.202 ms

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions ibat/pipeline/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .dwell_time import run_dt_exp
from .running_time import run_rt_exp
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 67eafdf

Please sign in to comment.