(weights: Dict[str, float], vector: Dict[str, float])
| 251 | |
| 252 | |
| 253 | def sparse_dot(weights: Dict[str, float], vector: Dict[str, float]) -> float: |
| 254 | if not weights or not vector: |
| 255 | return 0.0 |
| 256 | if len(weights) > len(vector): |
| 257 | return sum(value * weights.get(key, 0.0) for key, value in vector.items()) |
| 258 | return sum(value * vector.get(key, 0.0) for key, value in weights.items()) |
| 259 | |
| 260 | |
| 261 | def balanced_logistic_samples( |
no test coverage detected