MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _normalize_vector

Function _normalize_vector

skills/profile-updater/scripts/update_profile.py:396–403  ·  view source on GitHub ↗
(vector: List[float])

Source from the content-addressed store, hash-verified

394
395
396def _normalize_vector(vector: List[float]) -> List[float]:
397 if not vector:
398 return []
399 array = np.array(vector, dtype=float)
400 norm = np.linalg.norm(array)
401 if norm <= 0:
402 return [0.0] * len(array)
403 return (array / norm).tolist()
404
405
406def cosine_similarity(vec1: List[float], vec2: List[float]) -> float:

Callers 5

update_interest_vectorFunction · 0.85
_average_vectorFunction · 0.85
_hash_topic_vectorFunction · 0.85
_explicit_prior_vectorFunction · 0.85
_blend_vectorsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected