code: def start_naive_bayes(automated_run, session, path):
      """Starts naive bayes automated run
  
      Args:
          automated_run (xcessiv.models.AutomatedRun): Automated run object
  
          session: Valid SQLAlchemy session
  
          path (str, unicode): Path to project folder
      """
      module = functions.import_string_code_as_module(
          automated_run.source
      )
      random_state = (
          8
          if not hasattr(module, "random_state")
          else module.random_state
      )
      assert (
          module.metric_to_optimize
          in automated_run.base_learner_origin.metric_generators
      )
  
      # get non-searchable parameters
      base_estimator = (
          automated_run.base_learner_origin.return_estimator()
      )
      base_estimator.set_params(**module.default_params)
      default_params = functions.make_serializable(
          base_estimator.get_params()
      )
      non_searchable_params = dict(
          (key, val)
          for key, val in iteritems(default_params)
          if key not in module.pbounds
      )
  
      # get already calculated base learners in search space
      existing_base_learners = []
      for (
          base_learner
      ) in automated_run.base_learner_origin.base_learners:
          if not base_learner.job_status == "finished":
              continue
          in_search_space = True
          for key, val in iteritems(non_searchable_params):
              if base_learner.hyperparameters[key] != val:
                  in_search_space = False
                  break  # If no match, move on to the next base learner
          if in_search_space:
              existing_base_learners.append(base_learner)
  
      # build initialize dictionary
      target = []
      initialization_dict = dict(
          (key, list()) for key in module.pbounds.keys()
      )
      for base_learner in existing_base_learners:
          # check if base learner's searchable hyperparameters are all numerical
          all_numerical = True
          for key in module.pbounds.keys():
              if not isinstance(
                  base_learner.hyperparameters[key], numbers.Number
              ):
                  all_numerical = False
                  break
          if not all_numerical:
              continue  # if there is a non-numerical hyperparameter, skip this.
  
          for key in module.pbounds.keys():
              initialization_dict[key].append(
                  base_learner.hyperparameters[key]
              )
          target.append(
              base_learner.individual_score[module.metric_to_optimize]
          )
      initialization_dict["target"] = (
          target
          if not module.invert_metric
          else list(map(lambda x: -x, target))
      )
      print(
          "{} existing in initialization dictionary".format(
              len(initialization_dict["target"])
          )
      )
  
      # Create function to be optimized
      func_to_optimize = return_func_to_optimize(
          path,
          session,
          automated_run.base_learner_origin,
          module.default_params,
          module.metric_to_optimize,
          module.invert_metric,
          set(module.integers),
      )
  
      # Create Bayes object
      bo = BayesianOptimization(func_to_optimize, module.pbounds)
  
      bo.initialize(initialization_dict)
  
      np.random.seed(random_state)
  
      bo.maximize(**module.maximize_config)
  
file_path: xcessiv/xcessiv/automatedruns.py
imports: from __future__ import absolute_import, print_function, division, unicode_literals
  from rq import get_current_job
  from xcessiv import functions
  from xcessiv import models
  from xcessiv import constants
  import numpy
  import os
  import sys
  import traceback
  from six import iteritems
  import numbers
  from bayes_opt import BayesianOptimization
label_desc: Use image node_id 2 for calling a global function with example usage: start_naive_bayes(automated_run, session, path) without return types