Skip to content

Conversation

@novaktim
Copy link

@novaktim novaktim commented May 6, 2025

Hey @AnotherSamWilson and @kapsner, really appreciate your work.
An average user can run into the “promise already under evaluation” error when a default argument references itself:

iterations = 100

scoringFunction = function(x, iterations = iterations) {
  score = x^iterations
  list(Score = score)
}

bounds = list(x = c(0, 1))

bayes = bayesOpt(scoringFunction, bounds = bounds, initPoints = 10)
# errorMessage --> "promise already under evaluation: recursive default argument reference or earlier problems?"

# afterwards e.g. build better model
print(scoringFunction(x = 0, iterations = 200))

With this in place, the example above now just works fine and all existing unit tests still pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant