hyperparameter_hunter package

Subpackages

Submodules

hyperparameter_hunter.algorithm_handlers module

hyperparameter_hunter.environment module

hyperparameter_hunter.experiment_core module

hyperparameter_hunter.experiments module

hyperparameter_hunter.feature_engineering module

This module organizes and executes feature engineering/preprocessing step functions. The central components of the module are FeatureEngineer and EngineerStep - everything else is built to support those two classes. This module works with a very broad definition of “feature engineering”. The following is a non-exhaustive list of transformations that are considered valid for FeatureEngineer step functions:

  • Manual feature creation

  • Input data scaling/normalization/standardization

  • Target data transformation

  • Re-sampling

  • Data imputation

  • Feature selection/elimination

  • Encoding (one-hot, label, etc.)

  • Binarization/binning/discretization

  • Feature extraction (as for NLP/image recognition tasks)

  • Feature shuffling

hyperparameter_hunter.importer module

This module provides utilities to intercept external imports and load them using custom logic

Related

hyperparameter_hunter.__init__

Executes the import hooks to ensure assets are properly imported prior to starting any real work

hyperparameter_hunter.tracers

Defines tracing metaclasses applied by hyperparameter_hunter.importer to imports

class hyperparameter_hunter.importer.Interceptor(module_name, custom_loader, asset_name=None)

Bases: _frozen_importlib_external.PathFinder

Class to intercept loading of an external module in order to provide custom loading logic

Parameters
module_name: String

The path of the module, for which loading should be handled by custom_loader

custom_loader: Descendant of `importlib.machinery.SourceFileLoader`

Should implement exec_module(), which should call its superclass’s exec_module(), then perform the custom loading logic, and return module

Methods

find_module(fullname[, path])

find the module on sys.path or ‘path’ based on sys.path_hooks and sys.path_importer_cache.

find_spec(full_name[, path, target])

Perform custom loading logic if full_name == module_name

invalidate_caches()

Call the invalidate_caches() method on all path entry finders stored in sys.path_importer_caches (where implemented).

find_spec(full_name, path=None, target=None)

Perform custom loading logic if full_name == module_name

class hyperparameter_hunter.importer.KerasLayerLoader(fullname, path)

Bases: _frozen_importlib_external.SourceFileLoader

Cache the module name and the path to the file found by the finder.

Methods

create_module(spec)

Use default semantics for module creation.

exec_module(module)

Set module.Layer to a traced version of itself via tracers.ArgumentTracer

get_code(fullname)

Concrete implementation of InspectLoader.get_code.

get_data(path)

Return the data from path as raw bytes.

get_filename([name])

Return the path to the source file as found by the finder.

get_source(fullname)

Concrete implementation of InspectLoader.get_source.

is_package(fullname)

Concrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of ‘__init__.py’.

load_module([name])

Load a module from a file.

path_mtime(path)

Optional method that returns the modification time (an int) for the specified path, where path is a str.

path_stats(path)

Return the metadata for the path.

set_data(path, data, *[, _mode])

Write bytes data to a file.

source_to_code(data, path, *[, _optimize])

Return the code object compiled from source.

exec_module(module)

Set module.Layer to a traced version of itself via tracers.ArgumentTracer

hyperparameter_hunter.importer.hook_keras_layer()

If Keras has yet to be imported, modify the inheritance structure of its base Layer class to inject attributes that keep track of the parameters provided to each layer

class hyperparameter_hunter.importer.KerasMultiInitializerLoader(fullname, path)

Bases: _frozen_importlib_external.SourceFileLoader

Cache the module name and the path to the file found by the finder.

Methods

create_module(spec)

Use default semantics for module creation.

exec_module(module)

Execute the module.

get_code(fullname)

Concrete implementation of InspectLoader.get_code.

get_data(path)

Return the data from path as raw bytes.

get_filename([name])

Return the path to the source file as found by the finder.

get_source(fullname)

Concrete implementation of InspectLoader.get_source.

is_package(fullname)

Concrete implementation of InspectLoader.is_package by checking if the path returned by get_filename has a filename of ‘__init__.py’.

load_module([name])

Load a module from a file.

path_mtime(path)

Optional method that returns the modification time (an int) for the specified path, where path is a str.

path_stats(path)

Return the metadata for the path.

set_data(path, data, *[, _mode])

Write bytes data to a file.

source_to_code(data, path, *[, _optimize])

Return the code object compiled from source.

exec_module(module)

Execute the module.

hyperparameter_hunter.importer.hook_keras_initializers()

hyperparameter_hunter.metrics module

hyperparameter_hunter.models module

hyperparameter_hunter.sentinels module

hyperparameter_hunter.settings module

This module is the doorway for other modules to access the information set by the active hyperparameter_hunter.environment.Environment, and to access the appropriate logging methods. Specifically, other modules will most often use hyperparameter_hunter.settings.G to access the aforementioned information. Additionally, this module defines several variables to assist in navigating the ‘HyperparameterHunterAssets’ directory structure

Related

hyperparameter_hunter.environment

This module sets hyperparameter_hunter.settings.G.Env to itself, creating the primary gateway used by other modules to access the active Environment’s information

class hyperparameter_hunter.settings.G

Bases: object

This class defines global attributes that are set upon instantiation of environment.Environment. All attributes contained herein are class variables (not instance variables) because the expectation is for the attributes of this class to be set only once, then referenced by operations that may be executed after instantiating a environment.Environment. This allows functions to be called or classes to be initiated without passing a reference to the currently active Environment, because they check the attributes of this class, instead

Attributes
Env: None

This is set to “self” in environment.Environment.__init__(). This fact allows other modules to check if settings.G.Env is None. If None, a environment.Environment has not yet been instantiated. If not None, any attributes or methods of the instantiated Env may be called

save_transformed_predictions: False

Declares format in which a model’s predictions should be saved, with regard to feature_engineering.FeatureEngineer transformations. If no transformation of the target variable takes place (either through feature_engineering.FeatureEngineer, feature_engineering.EngineerStep, or otherwise), then this setting can be ignored.

If save_transformed_predictions is True, and target transformation does occur, then experiment predictions are saved in the same form as the transformed target, which is the form returned directly by a fitted model’s predict method. For example, if target data is label-encoded, and an feature_engineering.EngineerStep is used to one-hot encode the target, then one-hot-encoded predictions will be saved.

Conversely, if save_transformed_predictions is False (default), and target transformation does occur, then experiment predictions are saved in the inverted form of the transformed target, which is the same form as the original target data. Continuing the example of label-encoded target data, and an feature_engineering.EngineerStep to one-hot encode the target, in this case, label-encoded predictions will be saved.

priority_callbacks: Tuple

Intended for internal use only. The contents of this tuple are inserted at the front of an Experiment’s list of callback bases via experiment_core.ExperimentMeta, ahead of even the Experiment’s original base classes. This is used primarily for testing callbacks, but it can also be used if you absolutely need a callback to be placed before the Experiment’s other ancestors in its MRO

log_: print

debug_: print

warn_: print

import_hooks: List

sentinel_registry: List

Methods

debug(content, *args, **kwargs)

Set in environment.Environment.initialize_reporting() to the updated version of reporting.ReportingHandler.debug()

debug_(value, …[, sep, end, file, flush])

Prints the values to a stream, or to sys.stdout by default.

log(content, *args, **kwargs)

Set in environment.Environment.initialize_reporting() to the updated version of reporting.ReportingHandler.log()

log_(value, …[, sep, end, file, flush])

Prints the values to a stream, or to sys.stdout by default.

reset_attributes()

Return the attributes of settings.G to their original values

warn(content, *args, **kwargs)

Set in environment.Environment.initialize_reporting() to the updated version of reporting.ReportingHandler.warn()

warn_

Issue a warning, or maybe ignore it or raise an exception.

Env = None
save_transformed_predictions = False
priority_callbacks = ()
static log(content, *args, **kwargs)

Set in environment.Environment.initialize_reporting() to the updated version of reporting.ReportingHandler.log()

static debug(content, *args, **kwargs)

Set in environment.Environment.initialize_reporting() to the updated version of reporting.ReportingHandler.debug()

static warn(content, *args, **kwargs)

Set in environment.Environment.initialize_reporting() to the updated version of reporting.ReportingHandler.warn()

log_(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)

Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline. flush: whether to forcibly flush the stream.

debug_(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)

Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline. flush: whether to forcibly flush the stream.

warn_()

Issue a warning, or maybe ignore it or raise an exception.

import_hooks = ['keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling', 'keras_layer', 'keras_initializer', 'keras_variance_scaling']
sentinel_registry = []
classmethod reset_attributes()

Return the attributes of settings.G to their original values

hyperparameter_hunter.tracers module

This module defines metaclasses used to trace the parameters passed through operation-critical classes that are members of other libraries. These are only used in cases where it is impractical or impossible to effectively retrieve the arguments explicitly provided by a user, as well as the default arguments for the classes being traced. Generally, tracer metaclasses will aim to add some attributes to the class, that will collect default values, and provided arguments on the class’s creation, and an instance’s call

Related

hyperparameter_hunter.importer

This module handles the interception of certain imports in order to inject the tracer metaclasses defined in hyperparameter_hunter.tracers into the inheritance structure of objects that need to be traced

class hyperparameter_hunter.tracers.ArgumentTracer(name, bases, namespace, **kwargs)

Bases: type

Metaclass to trace the default arguments and explicitly provided arguments of its descendants. It also has special provisions for instantiating dummy models if directed to

Methods

__call__(*args, **kwargs)

Call self as a function.

mro()

return a type’s method resolution order

class hyperparameter_hunter.tracers.LocationTracer(name, bases, namespace, **kwargs)

Bases: hyperparameter_hunter.tracers.ArgumentTracer

Metaclass to trace the origin of the call to initialize the descending class

Methods

__call__(*args, **kwargs)

Call self as a function.

mro()

return a type’s method resolution order

Module contents