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

Function unit_vector

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

Source from the content-addressed store, hash-verified

126
127# 将向量单位化
128def unit_vector(vec):
129 # 计算向量的模长
130 vec_norm = np.linalg.norm(vec)
131 # 将向量转化为单位向量
132 unit_vec = vec / vec_norm
133 return unit_vec
134
135# 输出该值域对应的所有embedding 并返回单词到id映射
136def 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