Add files via upload

This commit is contained in:
Silviu Marian Udrescu 2020-06-20 04:36:49 -04:00 committed by GitHub
parent 31e7f76672
commit b709df5840
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -109,6 +109,10 @@ def RPN_to_pytorch(pathdir,filename, math_expr, lr = 1e-2, N_epochs = 500):
trainable_parameters[j] -= lr * trainable_parameters[j].grad
trainable_parameters[j].grad.zero_()
for nan_i in range(len(trainable_parameters)):
if torch.isnan(trainable_parameters[nan_i])==True or abs(trainable_parameters[nan_i])>1e7:
return 1000000, 10000000, "1"
ii = -1
for parm in unsnapped_param_dict:
if ii == -1:

View file

@ -120,6 +120,10 @@ def final_gd(pathdir,filename, math_expr, lr = 1e-2, N_epochs = 5000):
trainable_parameters[j] -= lr/10 * trainable_parameters[j].grad
trainable_parameters[j].grad.zero_()
for nan_i in range(len(trainable_parameters)):
if torch.isnan(trainable_parameters[nan_i])==True or abs(trainable_parameters[nan_i])>1e7:
return 1000000, 10000000, "1"
# get the updated symbolic regression
ii = -1
for parm in unsnapped_param_dict: