ML-Ensemble

author:Sebastian Flennerhag
license:MIT
copyright:2017-2018

Global backend configurations.

Variables

  1. DTYPE: data type of prediction arrays. Must be a numpy dtype. Default is float32.
  2. TMPDIR: path to directory where temprorary caches will be hosted. Default is to use system tmp structure.
  3. PREFIX: cache prefix. Default is '.mlens_tmp_cache_'
  4. BACKEND: global default backend. Default is 'threading'
  5. START_METHOD: global start method (if backend='multiprocessing') Default is 'fork'
  6. VERBOSE: verbose import. Set to Y for verbose. Needs to be set before import (i.e. export MLENS_VERBOSE=0).
  7. IVALS: load exception handling interval. Default is (0.01, 120).

Environmental variables can be set by

export MLENS_[VARIABLE]=VALUE

For changing defaults during a session, use set_[variable] and get_[variable], where [variable] is replaced with the lower case name of the environmental variable to change.

Changing global configurations in-session is experimental: Please report any unexpected behavior.

mlens.config

dtype

get_dtype

mlens.config.get_dtype()[source]

Return dtype

set_dtype

mlens.config.set_dtype(dtype)[source]

Set the dtype to use during estimation.

Parameters:dtype (object) – numpy dtype

tmpdir

get_tmpdir

mlens.config.get_tmpdir()[source]

Return start method

set_tmpdir

mlens.config.set_tmpdir(tmp)[source]

Set the root directory for temporary caches during estimation.

Parameters:tmp (str) – directory path

backend

get_backend

mlens.config.get_backend()[source]

Return backend

set_backend

mlens.config.set_backend(backend)[source]

Set the parallel backend to use during estimation.

Parameters:backend (str) – backend type, one of ‘multiprocessing’, ‘threading’, ‘sequential’

start_method

get_start_method

mlens.config.get_start_method()[source]

Return start method

set_start_method

mlens.config.set_start_method(method)[source]

Set the method for starting multiprocess worker pool.

Parameters:method (str) – Methods available: ‘fork’, ‘spawn’, ‘forkserver’.

prefix

get_prefix

mlens.config.get_prefix()[source]

Return cache prefix

set_prefix

mlens.config.set_prefix(prefix)[source]

Set the prefix assigned to temporary directories during estimation.

Parameters:prefix (str) – cache file name prefix

ivals

get_ivals

mlens.config.get_ivals()[source]

Return _IVALS

set_ivals

mlens.config.set_ivals(interval, limit)[source]

Set the parallel backend to use during estimation.

Parameters:
  • interval (int) – number of seconds between each check
  • limit (int) – number of seconds to wait.

Utility

clear_cache

mlens.config.clear_cache(tmp)[source]

Check that cache directory is empty.

Checks that a specified directory do not contain any directories with the ML-Ensemble temporary cache signature. Attempts to remove any found directories.

Parameters:tmp (str) – the directory to check for residual caches in.