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

Function add_weighted_vector

experiments/baselines/discourse_aware/runner.py:307–311  ·  view source on GitHub ↗
(target: Dict[str, float], vector: Dict[str, float], weight: float)

Source from the content-addressed store, hash-verified

305
306
307def add_weighted_vector(target: Dict[str, float], vector: Dict[str, float], weight: float) -> None:
308 if weight <= 0:
309 return
310 for key, value in vector.items():
311 target[key] = target.get(key, 0.0) + value * weight
312
313
314def cosine(left: Dict[str, float], right: Dict[str, float]) -> float:

Callers 1

prepare_vectorsMethod · 0.70

Calls 1

getMethod · 0.80

Tested by

no test coverage detected