docstr: ResultFinder for locating saved Keras Experiments compatible with the given constraints
  
  Parameters
  ----------
  algorithm_name: String
      Name of the algorithm whose hyperparameters are being optimized
  module_name: String
      Name of the module from whence the algorithm being used came
  cross_experiment_key: String
      :attr:`hyperparameter_hunter.environment.Environment.cross_experiment_key` produced by
      the current `Environment`
  target_metric: Tuple
      Path denoting the metric to be used. The first value should be one of {"oof",
      "holdout", "in_fold"}, and the second value should be the name of a metric supplied in
      :attr:`hyperparameter_hunter.environment.Environment.metrics_params`
  space: Space
      Instance of :class:`~hyperparameter_hunter.space.space_core.Space`, defining
      hyperparameter search space constraints
  leaderboard_path: String
      Path to a leaderboard file, whose listed Experiments will be tested for compatibility
  descriptions_dir: String
      Path to a directory containing the description files of saved Experiments
  model_params: Dict
      Concrete hyperparameters for the model. Common keys include "model_init_params" and
      "model_extra_params", both of which can be pointers to dicts of hyperparameters.
      Additionally, "feature_engineer" may be included with an instance of
      :class:`~hyperparameter_hunter.feature_engineering.FeatureEngineer`
  sort: {"target_asc", "target_desc", "chronological", "reverse_chronological"}, or int
      ... Experimental...
      How to sort the experiment results that fit within the given constraints
  
      * "target_asc": Sort from experiments with the lowest value for `target_metric` to
        those with the greatest
      * "target_desc": Sort from experiments with the highest value for `target_metric` to
        those with the lowest
      * "chronological": Sort from oldest experiments to newest
      * "reverse_chronological": Sort from newest experiments to oldest
      * int: Random seed with which to shuffle experiments
docstr_tok: ["ResultFinder","for","locating","saved","Keras","Experiments","compatible","with","the","given","constraints","Parameters","--","--","--","--","--","algorithm_name",":","String","Name","of","the","algorithm","whose","hyperparameters","are","being","optimized","module_name",":","String","Name","of","the","module","from","whence","the","algorithm","being","used","came","cross_experiment_key",":","String",":","attr",":","`","hyperparameter_hunter.environment.Environment.cross_experiment_key","`","produced","by","the","current","`","Environment","`","target_metric",":","Tuple","Path","denoting","the","metric","to","be","used",".","The","first","value","should","be","one","of","{","``","oof","''",",","``","holdout","''",",","``","in_fold","''","}",",","and","the","second","value","should","be","the","name","of","a","metric","supplied","in",":","attr",":","`","hyperparameter_hunter.environment.Environment.metrics_params","`","space",":","Space","Instance","of",":","class",":","`","~hyperparameter_hunter.space.space_core.Space","`",",","defining","hyperparameter","search","space","constraints","leaderboard_path",":","String","Path","to","a","leaderboard","file",",","whose","listed","Experiments","will","be","tested","for","compatibility","descriptions_dir",":","String","Path","to","a","directory","containing","the","description","files","of","saved","Experiments","model_params",":","Dict","Concrete","hyperparameters","for","the","model",".","Common","keys","include","``","model_init_params","''","and","``","model_extra_params","''",",","both","of","which","can","be","pointers","to","dicts","of","hyperparameters",".","Additionally",",","``","feature_engineer","''","may","be","included","with","an","instance","of",":","class",":","`","~hyperparameter_hunter.feature_engineering.FeatureEngineer","`","sort",":","{","``","target_asc","''",",","``","target_desc","''",",","``","chronological","''",",","``","reverse_chronological","''","}",",","or","int","...","Experimental","...","How","to","sort","the","experiment","results","that","fit","within","the","given","constraints","*","``","target_asc","''",":","Sort","from","experiments","with","the","lowest","value","for","`","target_metric","`","to","those","with","the","greatest","*","``","target_desc","''",":","Sort","from","experiments","with","the","highest","value","for","`","target_metric","`","to","those","with","the","lowest","*","``","chronological","''",":","Sort","from","oldest","experiments","to","newest","*","``","reverse_chronological","''",":","Sort","from","newest","experiments","to","oldest","*","int",":","Random","seed","with","which","to","shuffle","experiments"]
code: def __init__(
      self,
      algorithm_name,
      module_name,
      cross_experiment_key,
      target_metric,
      space,
      leaderboard_path,
      descriptions_dir,
      model_params,
      sort=None,  # TODO: Unfinished - To be used in `get_scored_params`/`experiment_ids`
  ):
      """ResultFinder for locating saved Keras Experiments compatible with the given constraints
  
      Parameters
      ----------
      algorithm_name: String
          Name of the algorithm whose hyperparameters are being optimized
      module_name: String
          Name of the module from whence the algorithm being used came
      cross_experiment_key: String
          :attr:`hyperparameter_hunter.environment.Environment.cross_experiment_key` produced by
          the current `Environment`
      target_metric: Tuple
          Path denoting the metric to be used. The first value should be one of {"oof",
          "holdout", "in_fold"}, and the second value should be the name of a metric supplied in
          :attr:`hyperparameter_hunter.environment.Environment.metrics_params`
      space: Space
          Instance of :class:`~hyperparameter_hunter.space.space_core.Space`, defining
          hyperparameter search space constraints
      leaderboard_path: String
          Path to a leaderboard file, whose listed Experiments will be tested for compatibility
      descriptions_dir: String
          Path to a directory containing the description files of saved Experiments
      model_params: Dict
          Concrete hyperparameters for the model. Common keys include "model_init_params" and
          "model_extra_params", both of which can be pointers to dicts of hyperparameters.
          Additionally, "feature_engineer" may be included with an instance of
          :class:`~hyperparameter_hunter.feature_engineering.FeatureEngineer`
      sort: {"target_asc", "target_desc", "chronological", "reverse_chronological"}, or int
          ... Experimental...
          How to sort the experiment results that fit within the given constraints
  
          * "target_asc": Sort from experiments with the lowest value for `target_metric` to
            those with the greatest
          * "target_desc": Sort from experiments with the highest value for `target_metric` to
            those with the lowest
          * "chronological": Sort from oldest experiments to newest
          * "reverse_chronological": Sort from newest experiments to oldest
          * int: Random seed with which to shuffle experiments"""
      super().__init__(
          algorithm_name=algorithm_name,
          module_name=module_name,
          cross_experiment_key=cross_experiment_key,
          target_metric=target_metric,
          space=space,
          leaderboard_path=leaderboard_path,
          descriptions_dir=descriptions_dir,
          model_params=model_params,
          sort=sort,
      )
  
      from keras.callbacks import Callback as BaseKerasCallback
      from keras.initializers import Initializer as BaseKerasInitializer
  
      # noinspection PyUnusedLocal
      def _visit(path, key, value):
          """If `value` is `BaseKerasCallback` or `BaseKerasInitializer`, return dict
          representation. Else default_visit"""
          if isinstance(value, BaseKerasCallback):
              return (key, keras_callback_to_dict(value))
          if isinstance(value, BaseKerasInitializer):
              return (key, keras_initializer_to_dict(value))
          return (key, value)
  
      self.model_params = remap(self.model_params, visit=_visit)
  
      # Below cleans out the temporary "params" dict built by `keras_optimization_helper`.
      #   It exists in order to pass concrete values for choices during optimization through the
      #   Keras model `build_fn`. However, at this stage, it just gets in the way since
      #   :attr:`space` defines the choices, and their `location`s point to where they are within
      #   :attr:`model_params`. Not deleting them would basically duplicate all choice Dimensions
      try:
          del self.model_params["model_extra_params"]["params"]
      except KeyError:
          pass
  
imports: from hyperparameter_hunter.feature_engineering import EngineerStep, FeatureEngineer
  from hyperparameter_hunter.i_o.exceptions import IncompatibleCandidateError
  from hyperparameter_hunter.compat.keras_helper import keras_callback_to_dict, keras_initializer_to_dict
  from hyperparameter_hunter.settings import G
  from hyperparameter_hunter.space.dimensions import Categorical, RejectedOptional
  from hyperparameter_hunter.space.space_core import Space
  from hyperparameter_hunter.utils.boltons_utils import remap, get_path
  from hyperparameter_hunter.utils.general_utils import multi_visit
  from hyperparameter_hunter.utils.optimization_utils import does_fit_in_space, get_ids_by, get_scored_params
  from copy import deepcopy
  from numbers import Number
  from pathlib import Path
  from typing import Dict, List, Tuple, Union
  import wrapt
label_desc: Use image node_id 1 to create a new KerasResultFinder object from inherited base classes: ResultFinder with example: obj = KerasResultFinder(algorithm_name, module_name, cross_experiment_key, target_metric, space, leaderboard_path, descriptions_dir, model_params, sort)