module mlbatch.cache_model
¶
Classes¶
class |
truncated documentation |
---|---|
Implements a cache to reduce the number of trainings a grid search has to do. |
Static Methods¶
staticmethod |
truncated documentation |
---|---|
Converts a list of parameters into a key. |
|
Creates a new cache. |
|
Gets a cache with a given name. |
|
Tells if cache name is present. |
|
Removes a cache with a given name. |
Methods¶
method |
truncated documentation |
---|---|
Returns the number of cached items. |
|
Caches one object. |
|
Retrieves the number of times an elements was retrieved from the cache. |
|
Retrieves an element from the cache. |
|
Enumerates all cached items. |
|
Enumerates all cached keys. |
Documentation¶
Caches to cache training.
-
class
mlinsights.mlbatch.cache_model.
MLCache
(name)¶ Bases:
object
Implements a cache to reduce the number of trainings a grid search has to do.
- Parameters
name – name of the cache
-
__init__
(name)¶ - Parameters
name – name of the cache
-
__len__
()¶ Returns the number of cached items.
-
static
as_key
(params)¶ Converts a list of parameters into a key.
- Parameters
params – dictionary
- Returns
key as a string
-
cache
(params, value)¶ Caches one object.
- Parameters
params – dictionary of parameters
value – value to cache
-
count
(params)¶ Retrieves the number of times an elements was retrieved from the cache.
- Parameters
params – dictionary of parameters
- Returns
int
-
static
create_cache
(name)¶ Creates a new cache.
- Parameters
name – name
- Returns
created cache
-
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
-
static
get_cache
(name)¶ Gets a cache with a given name.
- Parameters
name – name
- Returns
created cache
-
static
has_cache
(name)¶ Tells if cache name is present.
- Parameters
name – name
- Returns
boolean
-
items
()¶ Enumerates all cached items.
-
keys
()¶ Enumerates all cached keys.
-
static
remove_cache
(name)¶ Removes a cache with a given name.
- Parameters
name – name