class_docstr: Bandit-based model selection for regression.
  
  Each model is associated with an arm. At each `learn_one` call, the policy decides which
  arm/model to pull. The reward is the performance of the model on the provided sample. The
  `predict_one` method uses the current best model.
  
  Parameters
  ----------
  models
      The models to select from.
  metric
      The metric that is used to measure the performance of each model.
  policy
      The bandit policy to use.
  
  Examples
  --------
  
  >>> from river import bandit
  >>> from river import datasets
  >>> from river import evaluate
  >>> from river import linear_model
  >>> from river import metrics
  >>> from river import model_selection
  >>> from river import optim
  >>> from river import preprocessing
  
  >>> models = [
  ...     linear_model.LinearRegression(optimizer=optim.SGD(lr=lr))
  ...     for lr in [0.0001, 0.001, 1e-05, 0.01]
  ... ]
  
  >>> dataset = datasets.TrumpApproval()
  >>> model = (
  ...     preprocessing.StandardScaler() |
  ...     model_selection.BanditRegressor(
  ...         models,
  ...         metric=metrics.MAE(),
  ...         policy=bandit.EpsilonGreedy(
  ...             epsilon=0.1,
  ...             decay=0.001,
  ...             burn_in=100,
  ...             seed=42
  ...         )
  ...     )
  ... )
  >>> metric = metrics.MAE()
  
  >>> evaluate.progressive_val_score(dataset, model, metric)
  MAE: 3.134089
  
  Here's another example using the UCB policy. The latter is more sensitive to the target scale,
  and usually works better when the target is rescaled.
  
  >>> models = [
  ...     linear_model.LinearRegression(optimizer=optim.SGD(lr=lr))
  ...     for lr in [0.0001, 0.001, 1e-05, 0.01]
  ... ]
  
  >>> model = (
  ...     preprocessing.StandardScaler() |
  ...     preprocessing.TargetStandardScaler(
  ...         model_selection.BanditRegressor(
  ...             models,
  ...             metric=metrics.MAE(),
  ...             policy=bandit.UCB(
  ...                 delta=1,
  ...                 burn_in=100
  ...             )
  ...         )
  ...     )
  ... )
  >>> metric = metrics.MAE()
  
  >>> evaluate.progressive_val_score(dataset, model, metric)
  MAE: 0.875333
class_docstr_tok: ["Bandit-based","model","selection","for","regression",".","Each","model","is","associated","with","an","arm",".","At","each","`","learn_one","`","call",",","the","policy","decides","which","arm\/model","to","pull",".","The","reward","is","the","performance","of","the","model","on","the","provided","sample",".","The","`","predict_one","`","method","uses","the","current","best","model",".","Parameters","--","--","--","--","--","models","The","models","to","select","from",".","metric","The","metric","that","is","used","to","measure","the","performance","of","each","model",".","policy","The","bandit","policy","to","use",".","Examples","--","--","--","--",">",">",">","from","river","import","bandit",">",">",">","from","river","import","datasets",">",">",">","from","river","import","evaluate",">",">",">","from","river","import","linear_model",">",">",">","from","river","import","metrics",">",">",">","from","river","import","model_selection",">",">",">","from","river","import","optim",">",">",">","from","river","import","preprocessing",">",">",">","models","=","[","...","linear_model.LinearRegression","(","optimizer=optim.SGD","(","lr=lr",")",")","...","for","lr","in","[","0.0001",",","0.001",",","1e-05",",","0.01","]","...","]",">",">",">","dataset","=","datasets.TrumpApproval","(",")",">",">",">","model","=","(","...","preprocessing.StandardScaler","(",")","|","...","model_selection.BanditRegressor","(","...","models",",","...","metric=metrics.MAE","(",")",",","...","policy=bandit.EpsilonGreedy","(","...","epsilon=0.1",",","...","decay=0.001",",","...","burn_in=100",",","...","seed=42","...",")","...",")","...",")",">",">",">","metric","=","metrics.MAE","(",")",">",">",">","evaluate.progressive_val_score","(","dataset",",","model",",","metric",")","MAE",":","3.134089","Here","'s","another","example","using","the","UCB","policy",".","The","latter","is","more","sensitive","to","the","target","scale",",","and","usually","works","better","when","the","target","is","rescaled",".",">",">",">","models","=","[","...","linear_model.LinearRegression","(","optimizer=optim.SGD","(","lr=lr",")",")","...","for","lr","in","[","0.0001",",","0.001",",","1e-05",",","0.01","]","...","]",">",">",">","model","=","(","...","preprocessing.StandardScaler","(",")","|","...","preprocessing.TargetStandardScaler","(","...","model_selection.BanditRegressor","(","...","models",",","...","metric=metrics.MAE","(",")",",","...","policy=bandit.UCB","(","...","delta=1",",","...","burn_in=100","...",")","...",")","...",")","...",")",">",">",">","metric","=","metrics.MAE","(",")",">",">",">","evaluate.progressive_val_score","(","dataset",",","model",",","metric",")","MAE",":","0.875333"]
code: def learn_one(self, x, y):
      for arm_id in self._pick_arms():
          model = self[arm_id]
          y_pred = model.predict_one(x)
          self.policy.update(arm_id, y, y_pred)
          model.learn_one(x, y)
  
file_path: river/river/model_selection/bandit.py
imports: from __future__ import annotations
  from river import bandit, metrics, model_selection
label_desc: Use image node_id 2 for calling the BanditRegressor obj's underlying member method code with example usage: obj.learn_one(x, y) without return types