Tweaked cost function

pull/1/head
E. Almqvist 4 years ago
parent 0f40b6e8ae
commit 9ec78acd88
  1. 2
      rgbAI/lib/func.py
  2. 4
      rgbAI/main.py

@ -16,7 +16,7 @@ class AIlib:
for i in range(outLen):
sumC += (out[i] - correctOut[i])**2 # get the difference of every value
return sumC / outLen # return the average cost of all rows
return sumC # return the average cost of all rows
def genRandomMatrix( x:int, y:int, min: float=0.0, max: float=1.0 ): # generate a matrix with x, y dimensions with random values from min-max in it
return np.random.rand(x, y)

@ -22,8 +22,8 @@ class rgb(object):
def calcError( self, inp:np.array, out:np.array ):
cost = ai.calcCost( inp, out )
print(cost)
# Cost needs to get to 0, we can figure out this with backpropagation
return cost
def learn():
print("learn")
@ -49,4 +49,6 @@ def init(): # init
cost = bot.calcError(inpArr, res)
print("Cost: " + str(cost))
init()

Loading…
Cancel
Save