Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cross(X, Y, W, b):
- P = evaluateClassifier(X, W, b);
- result = 0;
- i = 0;
- while i < np.shape(Y)[1]:
- result = result - np.log(Y[:,i].transpose().dot(P[:,i]))
- i += 1;
- return result;
- def computeCost(X, Y, W, b, l):
- lCross = cross(X, Y, W, b);
- length = np.shape(Y)[1];
- result = 1/length * lCross + l*np.sum(np.power(W,2));
- return result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement