TFSimilarity.indexer.Store
Helper class that provides a standard way to create an ABC using
Inherits From: ABC
inheritance.
View source
add (
embedding : < a href = "../../TFSimilarity/callbacks/FloatTensor.md" > TFSimilarity .callbacks .FloatTensor `` `
< / a > ,
label : Optional [int ] = None ,
data : Optional [< a href = "../../TFSimilarity/callbacks/Tensor.md" > TFSimilarity .callbacks .Tensor `` `
< / a > ] = None
) - > int
Add an Embedding record to the key value store.
Args
embedding
Embedding predicted by the model.
label
Class numerical id. Defaults to None.
data
Data associated with the embedding. Defaults to None.
Returns
Associated record id.
View source
batch_add (
embeddings : Sequence [< a href = "../../TFSimilarity/callbacks/FloatTensor.md" > TFSimilarity .callbacks .FloatTensor `` `
< / a > ],
labels : Optional [Sequence [int ]] = None ,
data : Optional [Sequence [Tensor ]] = None
) - > List [int ]
Add a set of embedding records to the key value store.
Args
embeddings
Embeddings predicted by the model.
labels
Class numerical ids. Defaults to None.
data
Data associated with the embeddings. Defaults to None.
add() for what a record contains.
Returns
List of associated record id.
View source
batch_get (
idxs : Sequence [int ]
) - > Tuple [List [FloatTensor ], List [Optional [int ]], List [Optional [Tensor ]]]
Get embedding records from the key value store.
Args
idxs
ids of the records to fetch.
Returns
List of records associated with the requested ids.
View source
get (
idx : int
) - > Tuple [FloatTensor , Optional [int ], Optional [Tensor ]]
Get an embedding record from the key value store.
Args
idx
Id of the record to fetch.
Returns
record associated with the requested id.
View source
Load index on disk
Args
path
where to store the data
Returns
Number of records reloaded.
View source
save (
path : str , compression : bool = True
) - > None
Serializes index on disk.
Args
path
Directory where to store the data.
compression
Compress index data. Defaults to True.
View source
Number of record in the key value store.
View source
to_data_frame (
num_records : int = 0
) - > < a href = "../../TFSimilarity/indexer/PandasDataFrame.md" > TFSimilarity .indexer .PandasDataFrame `` `
< / a >
Export data as a Pandas dataframe.
Args
num_records
Number of records to export to the dataframe.
Defaults to 0 (unlimited).
Returns
pd.DataFrame
a pandas dataframe.