MilesCranmer commited on
Commit
483a583
1 Parent(s): e2fe9b0

NaN detection

Browse files
Files changed (1) hide show
  1. eureqa.jl +4 -3
eureqa.jl CHANGED
@@ -346,11 +346,12 @@ function iterate(
346
  delta = afterLoss - beforeLoss
347
  probChange = exp(-delta/(T*alpha))
348
 
349
- if probChange > rand()
350
- return tree
351
  end
352
 
353
- return prev
 
354
  catch error
355
  # Sometimes too many chained exp operators
356
  if isa(error, DomainError)
 
346
  delta = afterLoss - beforeLoss
347
  probChange = exp(-delta/(T*alpha))
348
 
349
+ if isnan(afterLoss) || probChange < rand()
350
+ return prev
351
  end
352
 
353
+ return tree
354
+
355
  catch error
356
  # Sometimes too many chained exp operators
357
  if isa(error, DomainError)