|
|
@ -187,7 +187,6 @@ def learn( inputNum:int, obj, theta:float, traintimes:int ): |
|
|
|
|
|
|
|
|
|
|
|
count = 0 |
|
|
|
count = 0 |
|
|
|
while( count <= traintimes ): # targetCost is the target for the cost function |
|
|
|
while( count <= traintimes ): # targetCost is the target for the cost function |
|
|
|
count += 1 |
|
|
|
|
|
|
|
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 |
|
|
|
# inp = np.asarray([1.0, 1.0, 1.0]) |
|
|
|
# inp = np.asarray([1.0, 1.0, 1.0]) |
|
|
|
|
|
|
|
|
|
|
@ -201,6 +200,7 @@ def learn( inputNum:int, obj, theta:float, traintimes:int ): |
|
|
|
mutateProps( obj, curCost, maxLen, grads ) # mutate the props for next round |
|
|
|
mutateProps( obj, curCost, maxLen, grads ) # mutate the props for next round |
|
|
|
|
|
|
|
|
|
|
|
printProgress() |
|
|
|
printProgress() |
|
|
|
|
|
|
|
count += 1 |
|
|
|
|
|
|
|
|
|
|
|
print("DONE\n") |
|
|
|
print("DONE\n") |
|
|
|
print(obj.weights) |
|
|
|
print(obj.weights) |
|
|
|