Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix for detecting change points based on MOA #1613

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion river/drift/adwin_c.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ cdef class AdaptiveWindowing:
break
bucket = self.bucket_deque[idx]

for k in range(bucket.current_idx - 1):
for k in range(bucket.current_idx):
n2 = self._calculate_bucket_size(idx) # length of window 2
u2 = bucket.get_total_at(k) # total of window 2
# Warning: means are calculated inside the loop to get updated values.
Expand Down Expand Up @@ -307,6 +307,7 @@ cdef class AdaptiveWindowing:
+ (1.0 / (n1 - self.min_window_length + 1)))
epsilon = (sqrt(2 * m_recip * self.variance_in_window * delta_prime)
+ 2 / 3 * delta_prime * m_recip)

return fabs(delta_mean) > epsilon


Expand Down
2 changes: 1 addition & 1 deletion river/drift/test_drift_detectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


def test_adwin():
expected_indices = [1055]
expected_indices = [1023]
detected_indices = perform_test(drift.ADWIN(), data_stream_1)

assert detected_indices == expected_indices
Expand Down
2 changes: 1 addition & 1 deletion river/ensemble/streaming_random_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ class SRPClassifier(BaseSRPEnsemble, base.Classifier):
>>> metric = metrics.Accuracy()

>>> evaluate.progressive_val_score(dataset, model, metric)
Accuracy: 71.97%
Accuracy: 72.17%

Notes
-----
Expand Down
4 changes: 2 additions & 2 deletions river/forest/adaptive_random_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ class ARFClassifier(BaseForest, base.Classifier):
>>> metric = metrics.Accuracy()

>>> evaluate.progressive_val_score(dataset, model, metric)
Accuracy: 71.17%
Accuracy: 67.97%

The total number of warnings and drifts detected, respectively
>>> model.n_warnings_detected(), model.n_drifts_detected()
Expand Down Expand Up @@ -849,7 +849,7 @@ class ARFRegressor(BaseForest, base.Regressor):
>>> metric = metrics.MAE()

>>> evaluate.progressive_val_score(dataset, model, metric)
MAE: 0.788619
MAE: 0.772113

"""

Expand Down
2 changes: 1 addition & 1 deletion river/forest/online_extra_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ class OXTRegressor(ExtraTrees, base.Regressor):
>>> metric = metrics.RMSE()

>>> evaluate.progressive_val_score(dataset, model, metric)
RMSE: 3.127311
RMSE: 3.16212

References
----------
Expand Down
8 changes: 4 additions & 4 deletions river/imblearn/chebyshev.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ class ChebyshevOverSampler(base.Wrapper, base.Regressor):
... metrics.MAE(),
... print_every=500
... )
[500] MAE: 1.673902
[1,000] MAE: 1.743046
[1,001] MAE: 1.741335
MAE: 1.741335
[500] MAE: 1.629786
[1,000] MAE: 1.663799
[1,001] MAE: 1.66253
MAE: 1.66253

References
----------
Expand Down
2 changes: 1 addition & 1 deletion river/tree/hoeffding_adaptive_tree_regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class HoeffdingAdaptiveTreeRegressor(HoeffdingTreeRegressor):
>>> metric = metrics.MAE()

>>> evaluate.progressive_val_score(dataset, model, metric)
MAE: 0.823026
MAE: 0.917576

"""

Expand Down
Loading