code: def optimize_rfc(data, targets):
      """Apply Bayesian Optimization to Random Forest parameters."""
  
      def rfc_crossval(n_estimators, min_samples_split, max_features):
          """Wrapper of RandomForest cross validation.
  
          Notice how we ensure n_estimators and min_samples_split are casted
          to integer before we pass them along. Moreover, to avoid max_features
          taking values outside the (0, 1) range, we also ensure it is capped
          accordingly.
          """
          return rfc_cv(
              n_estimators=int(n_estimators),
              min_samples_split=int(min_samples_split),
              max_features=max(min(max_features, 0.999), 1e-3),
              data=data,
              targets=targets,
          )
  
      optimizer = BayesianOptimization(
          f=rfc_crossval,
          pbounds={
              "n_estimators": (10, 250),
              "min_samples_split": (2, 25),
              "max_features": (0.1, 0.999),
          },
          random_state=1234,
          verbose=2,
      )
      optimizer.maximize(n_iter=10)
  
      print("Final result:", optimizer.max)
  
file_path: BayesianOptimization/examples/sklearn_example.py
imports: from sklearn.datasets import make_classification
  from sklearn.model_selection import cross_val_score
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.svm import SVC
  from bayes_opt import BayesianOptimization
  from bayes_opt.util import Colours
label_desc: Use image node_id 5 for calling a global function with example usage: optimize_rfc(data, targets) and returns: rfc_cv