module mlbatch.cache_model#

Inheritance diagram of mlinsights.mlbatch.cache_model

Short summary#

module mlinsights.mlbatch.cache_model

Caches to cache training.

source on GitHub

Classes#

class

truncated documentation

MLCache

Implements a cache to reduce the number of trainings a grid search has to do.

Static Methods#

staticmethod

truncated documentation

as_key

Converts a list of parameters into a key.

create_cache

Creates a new cache.

get_cache

Gets a cache with a given name.

has_cache

Tells if cache name is present.

remove_cache

Removes a cache with a given name.

Methods#

method

truncated documentation

__init__

__len__

Returns the number of cached items.

cache

Caches one object.

count

Retrieves the number of times an elements was retrieved from the cache.

get

Retrieves an element from the cache.

items

Enumerates all cached items.

keys

Enumerates all cached keys.

Documentation#

Caches to cache training.

source on GitHub

class mlinsights.mlbatch.cache_model.MLCache(name)#

Bases: object

Implements a cache to reduce the number of trainings a grid search has to do.

source on GitHub

Parameters:

name – name of the cache

source on GitHub

__init__(name)#
Parameters:

name – name of the cache

source on GitHub

__len__()#

Returns the number of cached items.

source on GitHub

static as_key(params)#

Converts a list of parameters into a key.

Parameters:

params – dictionary

Returns:

key as a string

source on GitHub

cache(params, value)#

Caches one object.

Parameters:
  • params – dictionary of parameters

  • value – value to cache

source on GitHub

count(params)#

Retrieves the number of times an elements was retrieved from the cache.

Parameters:

params – dictionary of parameters

Returns:

int

source on GitHub

static create_cache(name)#

Creates a new cache.

Parameters:

name – name

Returns:

created cache

source on GitHub

get(params, default=None)#

Retrieves an element from the cache.

Parameters:
  • params – dictionary of parameters

  • default – if not found

Returns:

value or None if it does not exists

source on GitHub

static get_cache(name)#

Gets a cache with a given name.

Parameters:

name – name

Returns:

created cache

source on GitHub

static has_cache(name)#

Tells if cache name is present.

Parameters:

name – name

Returns:

boolean

source on GitHub

items()#

Enumerates all cached items.

source on GitHub

keys()#

Enumerates all cached keys.

source on GitHub

static remove_cache(name)#

Removes a cache with a given name.

Parameters:

name – name

source on GitHub