code: def test_drift_adaptation_hatr():
      dataset = synth.Friedman(seed=7).take(1000)
  
      model = tree.HoeffdingAdaptiveTreeRegressor(
          leaf_prediction="mean",
          grace_period=10,
          delta=0.1,
          drift_detector=drift.ADWIN(0.1),
          drift_window_threshold=10,
          seed=7,
          max_depth=3,
      )
  
      for i, (x, y) in enumerate(dataset):
          y_ = y
          if i > 500:
              # Emulate an abrupt drift
              y_ = 1.5 * y
          model.learn_one(x, y_)
  
      assert model._n_alternate_trees > 0
  
file_path: river/river/tree/test_trees.py
imports: from __future__ import annotations
  import random
  import pytest
  from river import drift, tree
  from river.datasets import synth
label_desc: Use image node_id 8 for calling a global function with example usage: test_drift_adaptation_hatr() without return types