Deep Learning, Machine Learning, Artificial Intelligence, Loss Function, Neural Networks.
import numpy as np # define true labels and predicted probabilities as NumPy arrays y_true = np.array([[0, 1, 0], [0, 0, 1], [1, 0, 0]]) y_pred = np.array([[0.8, 0.1, 0.1], [0.2, 0.3, 0.5], [0.1, 0.6, 0.3]]) # calculate the loss loss = -1/len(y_true) * np.sum(np.sum(y_true * np.log(y_pred))) #