|
12 | 12 | rm -rf datasets/cc_3M/*.usearch datasets/arxiv_2M/*.usearch
|
13 | 13 | python python/scripts/join.py
|
14 | 14 | """
|
| 15 | + |
15 | 16 | from numpy import dot
|
16 | 17 | from numpy.linalg import norm
|
17 | 18 | from tqdm import tqdm
|
18 | 19 | from simsimd import cos_f32x4_neon, to_int
|
19 | 20 |
|
| 21 | +import usearch |
20 | 22 | from usearch.index import Index, MetricKind, CompiledMetric, MetricSignature
|
21 | 23 | from usearch.io import load_matrix
|
22 | 24 | from usearch.eval import measure_seconds
|
|
70 | 72 | b.save()
|
71 | 73 |
|
72 | 74 |
|
73 |
| -print( |
74 |
| - f"Loaded two indexes of size: {len(a):,} for {a_name} and {len(b):,} for {b_name}" |
75 |
| -) |
| 75 | +print(f"Loaded two indexes of size: {len(a):,} for {a_name} and {len(b):,} for {b_name}") |
76 | 76 | min_elements = min(len(a), len(b))
|
77 | 77 |
|
78 | 78 | run_diagnostics = input("Would you like to run diagnostics? [Y/n]: ")
|
|
111 | 111 | )
|
112 | 112 |
|
113 | 113 | secs, a_self_recall = dt(lambda: a.search(a.vectors, **args).recall(a.keys))
|
114 |
| - print( |
115 |
| - "Self-recall @{} of {} index: {:.2f}%, took {:.2f}s".format( |
116 |
| - count, a_name, a_self_recall * 100, secs |
117 |
| - ) |
118 |
| - ) |
| 114 | + print("Self-recall @{} of {} index: {:.2f}%, took {:.2f}s".format(count, a_name, a_self_recall * 100, secs)) |
119 | 115 |
|
120 | 116 | secs, b_self_recall = dt(lambda: b.search(b.vectors, **args).recall(b.keys))
|
121 |
| - print( |
122 |
| - "Self-recall @{} of {} index: {:.2f}%, took {:.2f}s".format( |
123 |
| - count, b_name, b_self_recall * 100, secs |
124 |
| - ) |
125 |
| - ) |
| 117 | + print("Self-recall @{} of {} index: {:.2f}%, took {:.2f}s".format(count, b_name, b_self_recall * 100, secs)) |
126 | 118 |
|
127 | 119 | secs, ab_recall = dt(lambda: b.search(a.vectors, **args).recall(b.keys))
|
128 |
| - print( |
129 |
| - "Cross-recall @{} of {} in {}: {:.2f}%, took {:.2f}s".format( |
130 |
| - count, a_name, b_name, ab_recall * 100, secs |
131 |
| - ) |
132 |
| - ) |
| 120 | + print("Cross-recall @{} of {} in {}: {:.2f}%, took {:.2f}s".format(count, a_name, b_name, ab_recall * 100, secs)) |
133 | 121 |
|
134 | 122 | secs, ba_recall = dt(lambda: a.search(b.vectors, **args).recall(a.keys))
|
135 |
| - print( |
136 |
| - "Cross-recall @{} of {} in {}: {:.2f}%, took {:.2f}s".format( |
137 |
| - count, b_name, a_name, ba_recall * 100, secs |
138 |
| - ) |
139 |
| - ) |
| 123 | + print("Cross-recall @{} of {} in {}: {:.2f}%, took {:.2f}s".format(count, b_name, a_name, ba_recall * 100, secs)) |
140 | 124 |
|
141 | 125 |
|
142 | 126 | print("--------------------------------------")
|
|
150 | 134 | recall += i == j
|
151 | 135 |
|
152 | 136 | recall *= 100.0 / min_elements
|
153 |
| -print( |
154 |
| - f"Took {secs:.2f}s to find {mapping_size:,} pairings with {recall:.2f}% being exact" |
155 |
| -) |
| 137 | +print(f"Took {secs:.2f}s to find {mapping_size:,} pairings with {recall:.2f}% being exact") |
0 commit comments