def voting(self, y_true, pred):
if y_true.shape[0] != pred.shape[0]:
raise ValueError('Both arrays should have the same size!')
# split the arrays in songs
arr_size = y_true.shape[0]
pred = np.split(pred, arr_size/self.augment_factor)
y_true = np.split(y_true, arr_size/self.augment_factor)
# Empty answers
voting_truth = []
voting_ans = []
for x,y in zip(y_true, pred):
voting_truth.append(mode(x)[0][0])
voting_ans.append(mode(y)[0][0])
return np.array(voting_truth), np.array(voting_ans)
# @Class: MusicDataGenerator
# @Description:
# featurewise_center: set input mean to 0 over the dataset.
# samplewise_center: set each sample mean to 0.
# featurewise_std_normalization: divide inputs by std of the dataset.
# samplewise_std_normalization: divide each input by its std.
# zca_whitening: apply ZCA whitening.
评论列表
文章目录