Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def kerperceptron_batch(data, labels, sigma_squared=25.0):
- c = np.zeros(len(data)).astype('float')
- i, t = 0, 0
- batches = list()
- while (i < 10):
- t = 0
- for image in data:
- if (t == 0):
- numerrors = 0
- currerrors = np.zeros(len(data)).astype('int')
- batches.append(currerrors)
- y = int(summation_kernel(c,t,data, sigma_squared) >= 0)
- if (y == 0) and (labels[t] == 1):
- c[t] += 1
- numerrors += 1
- elif (y == 1) and (labels[t] == -1):
- c[t] -= -1
- numerrors += 1
- currerrors[t] = numerrors
- t += 1
- i += 1
- batches = np.array(batches)
- return c, batches, i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement