This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Daniel J. Rodriguez | |
# https://github.com/danieljoserodriguez | |
import numpy as np | |
# Cross-entropy loss, or log loss, measures the performance of a classification model whose output is a | |
# probability value between 0 and 1 | |
def cross_entropy(y_hat, y): | |
return -np.log(y_hat) if y == 1 else -np.log(1 - y_hat) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Daniel J. Rodriguez | |
# https://github.com/danieljoserodriguez | |
import numpy as np | |
# A straight line function where activation is proportional to input | |
# ( which is the weighted sum from neuron ). | |
# In mathematics, an identity function, also called an identity relation or |