class_docstr: A metric that trains and evaluates an sklearn model.
  
  The evaluation metric is the k-fold "score". The scoring function
  depends on the model type and task type (e.g. classification/regression),
  but higher scores are better.
  
  See sklearn documentation for supported parameters.
  
  In addition, this metric supports tuning the hidden_layer_size
  and the number of hidden layers (num_hidden_layers) of a NN model.
class_docstr_tok: ["A","metric","that","trains","and","evaluates","an","sklearn","model",".","The","evaluation","metric","is","the","k-fold","``","score","''",".","The","scoring","function","depends","on","the","model","type","and","task","type","(","e.g",".","classification\/regression",")",",","but","higher","scores","are","better",".","See","sklearn","documentation","for","supported","parameters",".","In","addition",",","this","metric","supports","tuning","the","hidden_layer_size","and","the","number","of","hidden","layers","(","num_hidden_layers",")","of","a","NN","model","."]
code: def fetch_trial_data(
      self, trial: BaseTrial, noisy: bool = True, **kwargs: Any
  ) -> MetricFetchResult:
      try:
          arm_names = []
          means = []
          sems = []
          for name, arm in trial.arms_by_name.items():
              arm_names.append(name)
              # TODO: Consider parallelizing evaluation of large batches
              # (e.g. via ProcessPoolExecutor)
              mean, sem = self.train_eval(arm=arm)
              means.append(mean)
              sems.append(sem)
          df = pd.DataFrame(
              {
                  "arm_name": arm_names,
                  "metric_name": self._name,
                  "mean": means,
                  "sem": sems,
                  "trial_index": trial.index,
              }
          )
          return Ok(value=Data(df=df))
  
      except Exception as e:
          return Err(
              MetricFetchE(
                  message=f"Failed to fetch {self.name}", exception=e
              )
          )
  
imports: from __future__ import annotations
  from copy import deepcopy
  from enum import Enum
  from functools import lru_cache
  from math import sqrt
  from typing import Any, Dict, Tuple
  import numpy
  import pandas
  from ax.core.arm import Arm
  from ax.core.base_trial import BaseTrial
  from ax.core.data import Data
  from ax.core.metric import Metric, MetricFetchE, MetricFetchResult
  from ax.utils.common.result import Err, Ok
  from ax.utils.common.typeutils import checked_cast
  from sklearn import datasets
  from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
  from sklearn.model_selection import cross_val_score
  from sklearn.neural_network import MLPClassifier, MLPRegressor
label_desc: Use image node_id 3 for calling the SklearnMetric obj's underlying member method code with example usage: obj.fetch_trial_data(trial, noisy) and returns: Ok, Err