Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Mar 28th, 2020 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def train(X, Y, n_batch, eta, n_epochs, W, b, l):
  2.        
  3.     vX, vY, vy = unpackData(vFileName)
  4.    
  5.     costs = []
  6.     vCosts = []
  7.     i = 0
  8.     while i < n_epochs:
  9.         j = 0
  10.         while j < np.shape(X)[1]/n_batch:
  11.             j_start = j * n_batch
  12.             j_end = (j+1) * n_batch
  13.             Xbatch = X[:, j_start:j_end]
  14.             Ybatch = Y[:, j_start:j_end]
  15.             P = evaluateClassifier(Xbatch, W, b);
  16.             grad_W, grad_b = computeGradients(Xbatch, Ybatch, P, W, l)
  17.             W = W - eta * grad_W;
  18.             b = b - eta * grad_b;
  19.             j += 1
  20.         c = computeCost(X, Y, W, b, l);
  21.         vC = computeCost(vX, vY, W, b, l);
  22.         print(i, ". Cost: ", c)
  23.         costs.append(c)
  24.         vCosts.append(vC)
  25.         i += 1
  26.     return costs, vCosts, W, b
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top