Parameters#

Management of runtime parameters.

gismo.parameters.ALPHA = 0.5#

Default value for damping factor. Controls the trade-off between closeness and centrality.

gismo.parameters.BALANCE = 0.5#

Default documents/features trade-off in Landmarks.

gismo.parameters.DEFAULT_LANDMARKS_PARAMETERS = {'balance': 0.5, 'distortion': 1.0, 'max_k': 100, 'post': True, 'rank': <function <lambda>>, 'resolution': 0.7, 'stretch': 2.0, 'target_k': 1.0, 'wide': True, 'x_density': 1000, 'y_density': 1000}#

Dictionary of default runtime Landmarks parameters.

gismo.parameters.DEFAULT_PARAMETERS = {'alpha': 0.5, 'distortion': 1.0, 'max_k': 100, 'memory': 0.0, 'n_iter': 4, 'offset': 1.0, 'post': True, 'resolution': 0.7, 'stretch': 2.0, 'target_k': 1.0, 'wide': True}#

Dictionary of default runtime Gismo parameters.

gismo.parameters.DISTORTION = 1.0#

Default distortion. Controls how much of diteration relevance is mixed into the embedding for similarity computation.

gismo.parameters.MAX_K = 100#

Default top population size for estimating k.

gismo.parameters.MEMORY = 0.0#

Default memory value. Controls how much of previous computation is kept when performing a new diffusion.

gismo.parameters.N_ITER = 4#

Default value for the number of round-trip diffusions to perform. Higher value means better precision but longer execution time.

gismo.parameters.OFFSET = 1.0#

Default offset value. Controls how much of the initial fluid should be deduced from the relevance.

gismo.parameters.POST = True#

Default post policy. If True, post function is applied on items and clusters.

class gismo.parameters.Parameters(parameter_list=None, **kwargs)[source]#

Manages Gismo runtime parameters. When called, an instance will yield a dictionary of parameters. Is also used for other Gismo classes like Landmarks.

Parameters:
  • parameter_list (dict, optional) – Indicates which paramaters to manage. Default to Gismo runtime parameter.

  • kwargs (dict) – Parameters that need to be distinct from default values.

Examples

Use default parameters.

>>> p = Parameters()
>>> p() 
{'alpha': 0.5, 'n_iter': 4, 'offset': 1.0, 'memory': 0.0,
'stretch': 2.0, 'resolution': 0.7, 'max_k': 100, 'target_k': 1.0,
'wide': True, 'post': True, 'distortion': 1.0}

Use default parameters with changed stretch.

>>> p = Parameters(stretch=1.7)
>>> p()['stretch']
1.7

Note that parameters that do not exist will be ignored and (a warning will be issued)

>>> p = Parameters(strech=1.7)
>>> p() 
{'alpha': 0.5, 'n_iter': 4, 'offset': 1.0, 'memory': 0.0,
'stretch': 2.0, 'resolution': 0.7, 'max_k': 100, 'target_k': 1.0,
'wide': True, 'post': True, 'distortion': 1.0}

You can change the value of an attribute to alter the returned parameter.

>>> p.alpha = 0.85
>>> p()['alpha']
0.85

You can also apply on-the-fly parameters by passing them when calling the instance.

>>> p(resolution=0.9)['resolution']
0.9

Like for construction, parameters that do not exist are ignored and a warning is issued.

>>> p(resolutio = .9) 
{'alpha': 0.85, 'n_iter': 4, 'offset': 1.0, 'memory': 0.0,
'stretch': 2.0, 'resolution': 0.7, 'max_k': 100, 'target_k': 1.0,
'wide': True, 'post': True, 'distortion': 1.0}

Note the possibility to store a custom set of parameters if one uses parameter_list in construction.

>>> p = Parameters(parameter_list={'a': 1.0, 'b': True}, a=1.5)
>>> p()
{'a': 1.5, 'b': True}
gismo.parameters.RESOLUTION = 0.7#

Default resolution value. Defines how strict the merging of cluster is during recursive clustering.

gismo.parameters.STRETCH = 2.0#

Default stretch value. When performing covering, defines the ratio between considered pages and selected covering pages.

gismo.parameters.TARGET_K = 1.0#

Default threshold for estimating k.

gismo.parameters.WIDE = True#

Default Covering behavior for covering. True for wide variant, false for core variant.

gismo.parameters.X_DENSITY = 1000#

Default number of documents representing a Landmarks entry.

gismo.parameters.Y_DENSITY = 1000#

Default number of features representing a Landmarks entry.