agatha.ml.util.test_embedding_lookup module

agatha.ml.util.test_embedding_lookup.assert_table_contains_embeddings(actual=typing.Dict[str, typing.List[int]], expected=<class 'agatha.ml.util.embedding_lookup.EmbeddingLookupTable'>)
Return type

None

agatha.ml.util.test_embedding_lookup.assert_writable(path)
Return type

None

agatha.ml.util.test_embedding_lookup.make_embedding_hdf5s(part2embs, embedding_dir)

This function creates an embedding hdf5 file for test purposes.

Return type

None

agatha.ml.util.test_embedding_lookup.make_entity_lookup_table(part2names, test_dir)

Writes embedding location database

Return type

Path

agatha.ml.util.test_embedding_lookup.setup_embedding_lookup_data(name2vec, test_name, num_parts, test_root_dir=PosixPath('/tmp'))

Creates an embedding hdf5 file and an entity sqlite3 database for testing

Parameters
  • name2vec (Dict[str, List[int]]) – name2vec[x] = embedding of x

  • test_name (str) – A unique name for this test

  • num_parts (int) – The number of partitions to split this dataset among.

Return type

Tuple[Path, Path]

Returns

embedding_dir, entity_db_path You can run EmbeddingLookupTable(*setup_embedding_lookup_data(…))

agatha.ml.util.test_embedding_lookup.test_embedding_keys()
agatha.ml.util.test_embedding_lookup.test_setup_lookup_data()
agatha.ml.util.test_embedding_lookup.test_setup_lookup_data_two_parts()
agatha.ml.util.test_embedding_lookup.test_typical_embedding_lookup()