Do you see that Xhat takes on only the values [8, 10, 12]?
Hello everyone! I'm trying to perform a Bayesian optimization to find the best hyperparameters for a deep neural network and I want the variable MiniBatchSize to just have, in this case, three possible values: 8, 10, 12. I thought I could declare optVar as if it was an array interval = 8:2:12; optVar = optimizableVariable('MiniBatchSize', interval, 'Type', 'integer'); This code raises the following error: Error using optimizableVariable/checkRange 'Range' value must be a string array, a cell array of character vectors, or a numeric vector of length 2. Am I missing something? Is there another way to perform this?
John Williams answered .
2025-11-20
Xhat = 2*X - 0.5;
levels = [2 3 5 7 11]; Xhat = levels(X);
Xhat = X*2 + 6;