def perform(self, a, y):
"""Perform costOperation
Parameters
----------
a : np.array
Predictions
y : np.array
Data labels
Returns
-------
np.array
Output data
"""
predLog = np.nan_to_num(-np.log(a))
cEntropyMat = np.multiply(y, predLog)
return (1.0 / self.nExamples) * np.sum(cEntropyMat)
评论列表
文章目录