Spaces:
Runtime error
Runtime error
File size: 469 Bytes
a57c6eb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from typing import List
import numpy as np
def weighted_sum(weights: List[float], datas: List[np.array]) -> np.array:
"""ε―Ήη©ι΅ε葨ζη
§ζιε葨ε ζζ±ε
Args:
weights (list): ζιε葨
datas (list): η©ι΅ε葨
Returns:
np.array: ε ζζ±εεηη©ι΅
"""
res = np.zeros(datas[0].shape)
n_data = len(datas)
for i in range(n_data):
res += datas[i] * weights[i] / n_data
return res
|