上传者: 44293155
|
上传时间: 2022-07-17 16:06:24
|
文件大小: 38KB
|
文件类型: PY
def distance(self, features, targets):
cost_matrix = np.zeros((len(targets), len(features)))
key_list = list(self.samples.keys())
for i, target_k in enumerate(targets):
target = key_list[i]
cost_matrix[i, :] = self._metric(self.samples[target], features)
return cost_matrix