MCPcopy
hub / github.com/pathwaycom/pathway / test_bucketer_cosine

Function test_bucketer_cosine

python/pathway/stdlib/ml/classifiers/test_lsh.py:28–37  ·  view source on GitHub ↗

Verifies that L buckets were indeed created

()

Source from the content-addressed store, hash-verified

26
27
28def test_bucketer_cosine():
29 """Verifies that L buckets were indeed created"""
30 L = 7 # number of ORs
31 bucketer = generate_cosine_lsh_bucketer(d=3, M=5, L=L)
32
33 data_df = pd.DataFrame({"data": [[1, 2, 3], [4, 5, 6]]})
34 data = T(data_df, format="pandas", unsafe_trusted_ids=True)
35 data += data.select(buckets=apply(bucketer, data.data))
36 res_pd = table_to_pandas(data)
37 assert len(res_pd["buckets"].iloc[0]) == L
38
39
40def test_lsh():

Callers

nothing calls this directly

Calls 5

TFunction · 0.90
applyFunction · 0.90
table_to_pandasFunction · 0.90
selectMethod · 0.45

Tested by

no test coverage detected