class_docstr: Hard sampling regressor.
  
  This wrapper enables a model to retrain on past samples who's output was hard to predict.
  This works by storing the hardest samples in a buffer of a fixed size. When a new sample
  arrives, the wrapped model is either trained on one of the buffered samples with a probability
  p or on the new sample with a probability (1 - p).
  
  The hardness of an observation is evaluated with a loss function that compares the sample's
  ground truth with the wrapped model's prediction. If the buffer is not full, then the sample
  is added to the buffer. If the buffer is full and the new sample has a bigger loss than the
  lowest loss in the buffer, then the sample takes it's place.
  
  Parameters
  ----------
  regressor
  size
      Size of the buffer.
  p
      Probability of updating the model with a sample from the buffer instead of a new incoming
      sample.
  loss
      Criterion used to evaluate the hardness of a sample.
  seed
      Random seed.
  
  Examples
  --------
  
  >>> from river import datasets
  >>> from river import evaluate
  >>> from river import imblearn
  >>> from river import linear_model
  >>> from river import metrics
  >>> from river import optim
  >>> from river import preprocessing
  
  >>> model = (
  ...     preprocessing.StandardScaler() |
  ...     imblearn.HardSamplingRegressor(
  ...         regressor=linear_model.LinearRegression(),
  ...         p=.2,
  ...         size=30,
  ...         seed=42,
  ...     )
  ... )
  
  >>> evaluate.progressive_val_score(
  ...     datasets.TrumpApproval(),
  ...     model,
  ...     metrics.MAE(),
  ...     print_every=500
  ... )
  [500] MAE: 2.274021
  [1,000] MAE: 1.392399
  [1,001] MAE: 1.391246
  MAE: 1.391246
code: def _unit_test_params(cls):
      yield {
          "regressor": linear_model.LinearRegression(),
          "p": 0.1,
          "size": 40,
      }
  
imports: from __future__ import annotations
  import collections
  import random
  import typing
  from river import base, linear_model, optim, utils
label_desc: Use image node_id 3 for calling the HardSamplingRegressor obj's underlying member method code with example usage: obj._unit_test_params(cls) without return types