imspy.algorithm package

Subpackages

Submodules

imspy.algorithm.hashing module

class imspy.algorithm.hashing.CosimHasher(target_vector_length, trials=32, len_trial=20, seed=42)

Bases: object

calculate_keys(W)
Return type:

Tensor

class imspy.algorithm.hashing.TimsHasher(trials=32, len_trial=20, seed=5671, resolution=1, num_dalton=10)

Bases: CosimHasher

Class to create hash keys from a given set of weights.

Parameters:
  • trials (int) – number of trials to use for random projection.

  • len_trial (int) – length of each trial.

  • seed (int) – seed for random projection.

  • resolution (int) – resolution of the random projection.

  • num_dalton (int) – number of dalton to use for random projection.

imspy.algorithm.mixture module

imspy.algorithm.utility module

class imspy.algorithm.utility.InMemoryCheckpoint(validation_target='val_loss')

Bases: Callback

on_epoch_end(epoch, logs=None)

Called at the end of an epoch.

Subclasses should override for any actions to run. This function should only be called during TRAIN mode.

Parameters:
  • epoch – Integer, index of epoch.

  • logs – Dict, metric results for this training epoch, and for the validation epoch if validation is performed. Validation result keys are prefixed with val_. For training epoch, the values of the Model’s metrics are returned. Example: {‘loss’: 0.2, ‘accuracy’: 0.7}.

on_train_begin(logs=None)

Called at the beginning of training.

Subclasses should override for any actions to run.

Parameters:

logs – Dict. Currently no data is passed to this argument for this method but that may change in the future.

on_train_end(logs=None)

Called at the end of training.

Subclasses should override for any actions to run.

Parameters:

logs – Dict. Currently the output of the last call to on_epoch_end() is passed to this argument for this method but that may change in the future.

imspy.algorithm.utility.get_model_path(model_name)

Get the path to a pretrained model

Parameters:

model_name (str) – The name of the model to load

Return type:

Traversable

Returns:

The path to the pretrained model

imspy.algorithm.utility.load_tokenizer_from_resources(tokenizer_name)

Load a tokenizer from resources

Return type:

Tokenizer

Returns:

The pretrained tokenizer

Module contents