MCPcopy Create free account
hub / github.com/BIT-DataLab/LakeBench / unit_vector

Function unit_vector

join/Pexeso/PEXESO_benchmark_ws.py:123–128  ·  view source on GitHub ↗
(vec)

Source from the content-addressed store, hash-verified

121
122# 将向量单位化
123def unit_vector(vec):
124 # 计算向量的模长
125 vec_norm = np.linalg.norm(vec)
126 # 将向量转化为单位向量
127 unit_vec = vec / vec_norm
128 return unit_vec
129
130# 输出该值域对应的所有embedding 并返回单词到id映射
131def find_word2vec_of_all(values, model, word_to_id=None):

Callers 2

find_word2vec_of_allFunction · 0.70
bootstrap_setsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected