class_docstr: Base class that is inherited by the majority of classes in River.
  
  This base class allows us to handle the following tasks in a uniform manner:
  
  - Getting and setting parameters
  - Displaying information
  - Mutating/cloning
docstr: Modify attributes.
  
  This changes parameters inplace. Although you can change attributes yourself, this is the
  recommended way to proceed. By default, all attributes are immutable, meaning they
  shouldn't be mutated. Calling `mutate` on an immutable attribute raises a `ValueError`.
  Mutable attributes are specified via the `_mutable_attributes` property, and are thus
  specified on a per-estimator basis.
  
  Parameters
  ----------
  new_attrs
  
  Examples
  --------
  
  >>> from river import linear_model
  >>> from river import optim
  
  >>> model = linear_model.LinearRegression(
  ...     optimizer=optim.SGD(0.042),
  ... )
  
  >>> new_params = {
  ...     'optimizer': {'lr': optim.schedulers.Constant(0.001)}
  ... }
  
  >>> model.mutate(new_params)
  >>> model
  LinearRegression (
    optimizer=SGD (
      lr=Constant (
        learning_rate=0.001
      )
    )
    loss=Squared ()
    l2=0.
    l1=0.
    intercept_init=0.
    intercept_lr=Constant (
      learning_rate=0.01
    )
    clip_gradient=1e+12
    initializer=Zeros ()
  )
  
  The algorithm is recursively called down `Pipeline`s and `TransformerUnion`s.
  
  >>> from river import compose
  >>> from river import preprocessing
  
  >>> model = compose.Pipeline(
  ...     preprocessing.StandardScaler(),
  ...     linear_model.LinearRegression(
  ...         optimizer=optim.SGD(lr=0.042),
  ...     )
  ... )
  
  >>> new_params = {
  ...     'LinearRegression': {
  ...         'l2': 5,
  ...         'optimizer': {'lr': optim.schedulers.Constant(0.03)}
  ...     }
  ... }
  
  >>> model.mutate(new_params)
  >>> model
  Pipeline (
    StandardScaler (
      with_std=True
    ),
    LinearRegression (
      optimizer=SGD (
        lr=Constant (
          learning_rate=0.03
        )
      )
      loss=Squared ()
      l2=5
      l1=0.
      intercept_init=0.
      intercept_lr=Constant (
        learning_rate=0.01
      )
      clip_gradient=1e+12
      initializer=Zeros ()
    )
  )
docstr_tok: ["Modify","attributes",".","This","changes","parameters","inplace",".","Although","you","can","change","attributes","yourself",",","this","is","the","recommended","way","to","proceed",".","By","default",",","all","attributes","are","immutable",",","meaning","they","should","n't","be","mutated",".","Calling","`","mutate","`","on","an","immutable","attribute","raises","a","`","ValueError","`",".","Mutable","attributes","are","specified","via","the","`","_mutable_attributes","`","property",",","and","are","thus","specified","on","a","per-estimator","basis",".","Parameters","--","--","--","--","--","new_attrs","Examples","--","--","--","--",">",">",">","from","river","import","linear_model",">",">",">","from","river","import","optim",">",">",">","model","=","linear_model.LinearRegression","(","...","optimizer=optim.SGD","(","0.042",")",",","...",")",">",">",">","new_params","=","{","...","'optimizer","'",":","{","'lr","'",":","optim.schedulers.Constant","(","0.001",")","}","...","}",">",">",">","model.mutate","(","new_params",")",">",">",">","model","LinearRegression","(","optimizer=SGD","(","lr=Constant","(","learning_rate=0.001",")",")","loss=Squared","(",")","l2=0",".","l1=0",".","intercept_init=0",".","intercept_lr=Constant","(","learning_rate=0.01",")","clip_gradient=1e+12","initializer=Zeros","(",")",")","The","algorithm","is","recursively","called","down","`","Pipeline","`","s","and","`","TransformerUnion","`","s",".",">",">",">","from","river","import","compose",">",">",">","from","river","import","preprocessing",">",">",">","model","=","compose.Pipeline","(","...","preprocessing.StandardScaler","(",")",",","...","linear_model.LinearRegression","(","...","optimizer=optim.SGD","(","lr=0.042",")",",","...",")","...",")",">",">",">","new_params","=","{","...","'LinearRegression","'",":","{","...","'l2","'",":","5",",","...","'optimizer","'",":","{","'lr","'",":","optim.schedulers.Constant","(","0.03",")","}","...","}","...","}",">",">",">","model.mutate","(","new_params",")",">",">",">","model","Pipeline","(","StandardScaler","(","with_std=True",")",",","LinearRegression","(","optimizer=SGD","(","lr=Constant","(","learning_rate=0.03",")",")","loss=Squared","(",")","l2=5","l1=0",".","intercept_init=0",".","intercept_lr=Constant","(","learning_rate=0.01",")","clip_gradient=1e+12","initializer=Zeros","(",")",")",")"]
code: def mutate(self, new_attrs: dict):
      """Modify attributes.
  
      This changes parameters inplace. Although you can change attributes yourself, this is the
      recommended way to proceed. By default, all attributes are immutable, meaning they
      shouldn't be mutated. Calling `mutate` on an immutable attribute raises a `ValueError`.
      Mutable attributes are specified via the `_mutable_attributes` property, and are thus
      specified on a per-estimator basis.
  
      Parameters
      ----------
      new_attrs
  
      Examples
      --------
  
      >>> from river import linear_model
      >>> from river import optim
  
      >>> model = linear_model.LinearRegression(
      ...     optimizer=optim.SGD(0.042),
      ... )
  
      >>> new_params = {
      ...     'optimizer': {'lr': optim.schedulers.Constant(0.001)}
      ... }
  
      >>> model.mutate(new_params)
      >>> model
      LinearRegression (
        optimizer=SGD (
          lr=Constant (
            learning_rate=0.001
          )
        )
        loss=Squared ()
        l2=0.
        l1=0.
        intercept_init=0.
        intercept_lr=Constant (
          learning_rate=0.01
        )
        clip_gradient=1e+12
        initializer=Zeros ()
      )
  
      The algorithm is recursively called down `Pipeline`s and `TransformerUnion`s.
  
      >>> from river import compose
      >>> from river import preprocessing
  
      >>> model = compose.Pipeline(
      ...     preprocessing.StandardScaler(),
      ...     linear_model.LinearRegression(
      ...         optimizer=optim.SGD(lr=0.042),
      ...     )
      ... )
  
      >>> new_params = {
      ...     'LinearRegression': {
      ...         'l2': 5,
      ...         'optimizer': {'lr': optim.schedulers.Constant(0.03)}
      ...     }
      ... }
  
      >>> model.mutate(new_params)
      >>> model
      Pipeline (
        StandardScaler (
          with_std=True
        ),
        LinearRegression (
          optimizer=SGD (
            lr=Constant (
              learning_rate=0.03
            )
          )
          loss=Squared ()
          l2=5
          l1=0.
          intercept_init=0.
          intercept_lr=Constant (
            learning_rate=0.01
          )
          clip_gradient=1e+12
          initializer=Zeros ()
        )
      )
  
      """
  
      def _mutate(obj, new_attrs):
          def is_class_attr(name, attr):
              return hasattr(
                  getattr(obj, name), "mutate"
              ) and isinstance(attr, dict)
  
          for name, attr in new_attrs.items():
              if not hasattr(obj, name):
                  raise ValueError(
                      f"'{name}' is not an attribute of {obj.__class__.__name__}"
                  )
  
              # Check the attribute is mutable
              if name not in obj._mutable_attributes:
                  raise ValueError(
                      f"'{name}' is not a mutable attribute of {obj.__class__.__name__}"
                  )
  
              if is_class_attr(name, attr):
                  _mutate(obj=getattr(obj, name), new_attrs=attr)
              else:
                  setattr(obj, name, attr)
  
      _mutate(obj=self, new_attrs=new_attrs)
  
imports: from __future__ import annotations
  import collections
  import contextlib
  import copy
  import inspect
  import itertools
  import logging
  import sys
  import types
  import typing
label_desc: Use image node_id 7 for calling the Base obj's underlying member method code with example usage: obj.mutate(new_attrs) and returns: unknown