code: def __call__(self, trial):
      try:
          params = {
              "n_neighbors": trial.suggest_int("n_neighbors", 1, 128),
              "weights": trial.suggest_categorical(
                  "weights", ["uniform", "distance"]
              ),
              "n_jobs": self.n_jobs,
              "rows_limit": 100000,
              "ml_task": self.ml_task,
          }
          Algorithm = (
              KNeighborsRegressorAlgorithm
              if self.ml_task == REGRESSION
              else KNeighborsAlgorithm
          )
          model = Algorithm(params)
          model.fit(
              self.X_train,
              self.y_train,
              sample_weight=self.sample_weight,
          )
          preds = model.predict(self.X_validation)
  
          score = self.eval_metric(self.y_validation, preds)
          if Metric.optimize_negative(self.eval_metric.name):
              score *= -1.0
  
      except optuna.exceptions.TrialPruned as e:
          raise e
      except Exception as e:
          print("Exception in KNNObjective", str(e))
          return None
  
      return score
  
imports: import numpy
  import optuna
  from supervised.algorithms.knn import KNeighborsAlgorithm, KNeighborsRegressorAlgorithm
  from supervised.algorithms.registry import BINARY_CLASSIFICATION, MULTICLASS_CLASSIFICATION, REGRESSION
  from supervised.utils.metric import Metric
label_desc: Use image node_id 2 for calling the KNNObjective obj's underlying member method code with example usage: obj.__call__(trial) and returns: score, None