Added debug because I have no clue if it is working

pull/1/head
E. Almqvist 4 years ago
parent fc779f1afd
commit 2dec1df539
  1. 10000
      rgbAI/cost.txt
  2. 6
      rgbAI/lib/func.py
  3. 2
      rgbAI/main.py

File diff suppressed because it is too large Load Diff

@ -80,7 +80,7 @@ class AIlib:
if( newLayer <= maxLayer ): if( newLayer <= maxLayer ):
return AIlib.gradient( inp, obj, theta, maxLayer, newLayer, grads, obj1, obj2 ) return AIlib.gradient( inp, obj, theta, maxLayer, newLayer, grads, obj1, obj2 )
else: else:
return grads, cost2 return grads, res1, cost1
def mutateProps( obj, maxLen:int, gradient:list ): def mutateProps( obj, maxLen:int, gradient:list ):
for i in range(maxLen): for i in range(maxLen):
@ -95,7 +95,7 @@ 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
maxLen = len(obj.bias) maxLen = len(obj.bias)
grads, cost = AIlib.gradient( inp, obj, theta, maxLen - 1 ) grads, res, cost = AIlib.gradient( inp, obj, theta, maxLen - 1 )
AIlib.mutateProps( obj, maxLen, grads ) # mutate the props for next round AIlib.mutateProps( obj, maxLen, grads ) # mutate the props for next round
print("Cost:", cost) print("Cost:", cost, "|", inp, res)

@ -55,7 +55,7 @@ class rgb(object):
def init(): def init():
bot = rgb() bot = rgb()
bot.traintimes = 10 bot.traintimes = 10000
bot.train() bot.train()

Loading…
Cancel
Save