Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/subbarayudu-j/TheAlgorithms-Python
/ cost_function
Function
cost_function
machine_learning/logistic_regression.py:31–32 ·
view source on GitHub ↗
(h, y)
Source
from the content-addressed store, hash-verified
29
30
31
def
cost_function(h, y):
32
return
(-y * np.log(h) - (1 - y) * np.log(1 - h)).mean()
33
34
35
# here alpha is the learning rate, X is the feature matrix,y is the target matrix
Callers
1
logistic_reg
Function · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected