Made it so that the AI trains on the same input

pull/1/head
E. Almqvist 4 years ago
parent c1de21eaad
commit a543a9db1a
  1. 3
      rgbAI/lib/func.py

@ -98,8 +98,9 @@ class AIlib:
# i.e. : W' = W - lr * gradient (respect to W in layer i) = W - lr*[ dC / dW[i] ... ] # i.e. : W' = W - lr * gradient (respect to W in layer i) = W - lr*[ dC / dW[i] ... ]
# So if we change all the weights with i.e. 0.01 = theta, then we can derive the gradient with math and stuff # So if we change all the weights with i.e. 0.01 = theta, then we can derive the gradient with math and stuff
while( not curCost or curCost > targetCost ): # targetCost is the target for the cost function
inp = np.asarray(np.random.rand( 1, inputNum ))[0] # create a random learning sample inp = np.asarray(np.random.rand( 1, inputNum ))[0] # create a random learning sample
while( not curCost or curCost > targetCost ): # targetCost is the target for the cost function
maxLen = len(obj.bias) maxLen = len(obj.bias)
grads, res, curCost = AIlib.gradient( inp, obj, theta, maxLen - 1 ) grads, res, curCost = AIlib.gradient( inp, obj, theta, maxLen - 1 )
obj = AIlib.mutateProps( obj, maxLen, grads ) # mutate the props for next round obj = AIlib.mutateProps( obj, maxLen, grads ) # mutate the props for next round

Loading…
Cancel
Save