|
|
@ -53,12 +53,12 @@ class AIlib: |
|
|
|
|
|
|
|
|
|
|
|
def gradient( dCost:float, prop:list ): |
|
|
|
def gradient( dCost:float, prop:list ): |
|
|
|
propLen = len(prop) |
|
|
|
propLen = len(prop) |
|
|
|
#print("PropLEN: ", propLen) |
|
|
|
|
|
|
|
#print(prop) |
|
|
|
|
|
|
|
#print("\n") |
|
|
|
|
|
|
|
gradient = [None] * propLen |
|
|
|
gradient = [None] * propLen |
|
|
|
for i in range( propLen ): |
|
|
|
for i in range( propLen, 0, -1 ): |
|
|
|
gradient[i] = dCost / prop[i] |
|
|
|
if( i == propLen ): |
|
|
|
|
|
|
|
gradient[i] = dCost / prop[i] |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
gradient[i] = dCost / (prop[i] + gradient[i+1]) |
|
|
|
|
|
|
|
|
|
|
|
return gradient |
|
|
|
return gradient |
|
|
|
|
|
|
|
|
|
|
|