class_docstr: This class is an abstract model of a Bayesian optimizer algorithm.
  
  Args:
      estimator: The estimator to be used in the Bayesian optimization. (For instance, a
          GaussianProcessRegressor.)
      query_strategy: Function providing the query strategy for Bayesian optimization,
          for instance, modAL.acquisitions.max_EI.
      X_training: Initial training samples, if available.
      y_training: Initial training labels corresponding to initial training samples.
      bootstrap_init: If initial training data is available, bootstrapping can be done during the first training.
          Useful when building Committee models with bagging.
      **fit_kwargs: keyword arguments.
  
  Attributes:
      estimator: The estimator to be used in the Bayesian optimization.
      query_strategy: Function providing the query strategy for Bayesian optimization.
      X_training: If the model hasn't been fitted yet it is None, otherwise it contains the samples
          which the model has been trained on.
      y_training: The labels corresponding to X_training.
      X_max: argmax of the function so far.
      y_max: Max of the function so far.
  
  Examples:
  
      >>> import numpy as np
      >>> from functools import partial
      >>> from sklearn.gaussian_process import GaussianProcessRegressor
      >>> from sklearn.gaussian_process.kernels import Matern
      >>> from modAL.models import BayesianOptimizer
      >>> from modAL.acquisition import optimizer_PI, optimizer_EI, optimizer_UCB, max_PI, max_EI, max_UCB
      >>>
      >>> # generating the data
      >>> X = np.linspace(0, 20, 1000).reshape(-1, 1)
      >>> y = np.sin(X)/2 - ((10 - X)**2)/50 + 2
      >>>
      >>> # assembling initial training set
      >>> X_initial, y_initial = X[150].reshape(1, -1), y[150].reshape(1, -1)
      >>>
      >>> # defining the kernel for the Gaussian process
      >>> kernel = Matern(length_scale=1.0)
      >>>
      >>> tr = 0.1
      >>> PI_tr = partial(optimizer_PI, tradeoff=tr)
      >>> PI_tr.__name__ = 'PI, tradeoff = %1.1f' % tr
      >>> max_PI_tr = partial(max_PI, tradeoff=tr)
      >>>
      >>> acquisitions = zip(
      ...     [PI_tr, optimizer_EI, optimizer_UCB],
      ...     [max_PI_tr, max_EI, max_UCB],
      ... )
      >>>
      >>> for acquisition, query_strategy in acquisitions:
      ...     # initializing the optimizer
      ...     optimizer = BayesianOptimizer(
      ...         estimator=GaussianProcessRegressor(kernel=kernel),
      ...         X_training=X_initial, y_training=y_initial,
      ...         query_strategy=query_strategy
      ...     )
      ...
      ...     for n_query in range(5):
      ...         # query
      ...         query_idx, query_inst = optimizer.query(X)
      ...         optimizer.teach(X[query_idx].reshape(1, -1), y[query_idx].reshape(1, -1))
class_docstr_tok: ["This","class","is","an","abstract","model","of","a","Bayesian","optimizer","algorithm",".","Args",":","estimator",":","The","estimator","to","be","used","in","the","Bayesian","optimization",".","(","For","instance",",","a","GaussianProcessRegressor",".",")","query_strategy",":","Function","providing","the","query","strategy","for","Bayesian","optimization",",","for","instance",",","modAL.acquisitions.max_EI",".","X_training",":","Initial","training","samples",",","if","available",".","y_training",":","Initial","training","labels","corresponding","to","initial","training","samples",".","bootstrap_init",":","If","initial","training","data","is","available",",","bootstrapping","can","be","done","during","the","first","training",".","Useful","when","building","Committee","models","with","bagging",".","*","*","fit_kwargs",":","keyword","arguments",".","Attributes",":","estimator",":","The","estimator","to","be","used","in","the","Bayesian","optimization",".","query_strategy",":","Function","providing","the","query","strategy","for","Bayesian","optimization",".","X_training",":","If","the","model","has","n't","been","fitted","yet","it","is","None",",","otherwise","it","contains","the","samples","which","the","model","has","been","trained","on",".","y_training",":","The","labels","corresponding","to","X_training",".","X_max",":","argmax","of","the","function","so","far",".","y_max",":","Max","of","the","function","so","far",".","Examples",":",">",">",">","import","numpy","as","np",">",">",">","from","functools","import","partial",">",">",">","from","sklearn.gaussian_process","import","GaussianProcessRegressor",">",">",">","from","sklearn.gaussian_process.kernels","import","Matern",">",">",">","from","modAL.models","import","BayesianOptimizer",">",">",">","from","modAL.acquisition","import","optimizer_PI",",","optimizer_EI",",","optimizer_UCB",",","max_PI",",","max_EI",",","max_UCB",">",">",">",">",">",">","#","generating","the","data",">",">",">","X","=","np.linspace","(","0",",","20",",","1000",")",".reshape","(","-1",",","1",")",">",">",">","y","=","np.sin","(","X",")","\/2","-","(","(","10","-","X",")","*","*","2",")","\/50","+","2",">",">",">",">",">",">","#","assembling","initial","training","set",">",">",">","X_initial",",","y_initial","=","X","[","150","]",".reshape","(","1",",","-1",")",",","y","[","150","]",".reshape","(","1",",","-1",")",">",">",">",">",">",">","#","defining","the","kernel","for","the","Gaussian","process",">",">",">","kernel","=","Matern","(","length_scale=1.0",")",">",">",">",">",">",">","tr","=","0.1",">",">",">","PI_tr","=","partial","(","optimizer_PI",",","tradeoff=tr",")",">",">",">","PI_tr.__name__","=","'PI",",","tradeoff","=","%","1.1f","'","%","tr",">",">",">","max_PI_tr","=","partial","(","max_PI",",","tradeoff=tr",")",">",">",">",">",">",">","acquisitions","=","zip","(","...","[","PI_tr",",","optimizer_EI",",","optimizer_UCB","]",",","...","[","max_PI_tr",",","max_EI",",","max_UCB","]",",","...",")",">",">",">",">",">",">","for","acquisition",",","query_strategy","in","acquisitions",":","...","#","initializing","the","optimizer","...","optimizer","=","BayesianOptimizer","(","...","estimator=GaussianProcessRegressor","(","kernel=kernel",")",",","...","X_training=X_initial",",","y_training=y_initial",",","...","query_strategy=query_strategy","...",")","...","...","for","n_query","in","range","(","5",")",":","...","#","query","...","query_idx",",","query_inst","=","optimizer.query","(","X",")","...","optimizer.teach","(","X","[","query_idx","]",".reshape","(","1",",","-1",")",",","y","[","query_idx","]",".reshape","(","1",",","-1",")",")"]
docstr: Adds X and y to the known training data and retrains the predictor with the augmented dataset. This method also
  keeps track of the maximum value encountered in the training data.
  
  Args:
      X: The new samples for which the values are supplied.
      y: Values corresponding to the new instances in X.
      bootstrap: If True, training is done on a bootstrapped dataset. Useful for building Committee models with
          bagging. (Default value = False)
      only_new: If True, the model is retrained using only X and y, ignoring the previously provided examples.
          Useful when working with models where the .fit() method doesn't retrain the model from scratch (for
          example, in tensorflow or keras).
      **fit_kwargs: Keyword arguments to be passed to the fit method of the predictor.
docstr_tok: ["Adds","X","and","y","to","the","known","training","data","and","retrains","the","predictor","with","the","augmented","dataset",".","This","method","also","keeps","track","of","the","maximum","value","encountered","in","the","training","data",".","Args",":","X",":","The","new","samples","for","which","the","values","are","supplied",".","y",":","Values","corresponding","to","the","new","instances","in","X.","bootstrap",":","If","True",",","training","is","done","on","a","bootstrapped","dataset",".","Useful","for","building","Committee","models","with","bagging",".","(","Default","value","=","False",")","only_new",":","If","True",",","the","model","is","retrained","using","only","X","and","y",",","ignoring","the","previously","provided","examples",".","Useful","when","working","with","models","where","the",".fit","(",")","method","does","n't","retrain","the","model","from","scratch","(","for","example",",","in","tensorflow","or","keras",")",".","*","*","fit_kwargs",":","Keyword","arguments","to","be","passed","to","the","fit","method","of","the","predictor","."]
code: def teach(
      self,
      X: modALinput,
      y: modALinput,
      bootstrap: bool = False,
      only_new: bool = False,
      **fit_kwargs,
  ) -> None:
      """
      Adds X and y to the known training data and retrains the predictor with the augmented dataset. This method also
      keeps track of the maximum value encountered in the training data.
  
      Args:
          X: The new samples for which the values are supplied.
          y: Values corresponding to the new instances in X.
          bootstrap: If True, training is done on a bootstrapped dataset. Useful for building Committee models with
              bagging. (Default value = False)
          only_new: If True, the model is retrained using only X and y, ignoring the previously provided examples.
              Useful when working with models where the .fit() method doesn't retrain the model from scratch (for
              example, in tensorflow or keras).
          **fit_kwargs: Keyword arguments to be passed to the fit method of the predictor.
      """
      self._add_training_data(X, y)
  
      if not only_new:
          self._fit_to_known(bootstrap=bootstrap, **fit_kwargs)
      else:
          self._fit_on_new(X, y, bootstrap=bootstrap, **fit_kwargs)
  
      self._set_max(X, y)
  
imports: from typing import Any, Callable, List, Optional, Tuple
  import numpy
  from modAL.acquisition import max_EI
  from modAL.disagreement import max_std_sampling, vote_entropy_sampling
  from modAL.models.base import BaseCommittee, BaseLearner
  from modAL.uncertainty import uncertainty_sampling
  from modAL.utils.data import data_vstack, modALinput, retrieve_rows
  from modAL.utils.validation import check_class_labels, check_class_proba
  from sklearn.base import BaseEstimator
  from sklearn.metrics import accuracy_score
  from sklearn.utils import check_X_y
label_desc: Use image node_id 4 for calling the BayesianOptimizer obj's underlying member method code with example usage: obj.teach(X, y, bootstrap, only_new) without return types