MilesCranmer commited on
Commit
79ef9ab
1 Parent(s): 501ebd3

Fix bug with curMSE equal to 0.0

Browse files
Files changed (1) hide show
  1. pysr/sr.py +4 -1
pysr/sr.py CHANGED
@@ -1067,7 +1067,10 @@ def get_hof(
1067
  if lastMSE is None:
1068
  cur_score = 0.0
1069
  else:
1070
- cur_score = -np.log(curMSE / lastMSE) / (curComplexity - lastComplexity)
 
 
 
1071
 
1072
  scores.append(cur_score)
1073
  lastMSE = curMSE
 
1067
  if lastMSE is None:
1068
  cur_score = 0.0
1069
  else:
1070
+ if curMSE > 0.0:
1071
+ cur_score = -np.log(curMSE / lastMSE) / (curComplexity - lastComplexity)
1072
+ else:
1073
+ cur_score = np.inf
1074
 
1075
  scores.append(cur_score)
1076
  lastMSE = curMSE