You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now the the returned values from generate(n_candidates) for different Generators are in different conventions.
Specifically, some return List[Dict[str, float]] and some return List[Dict[str, np.ndarray]], which is not documented explicitly in the type annotation.
Although this doesn't affect the performance when people use only X.run(), it becomes quite confusing when someone is trying to use Generator separately.
Since most (if not all) of the Generators only works for the case that an input parameter has one scalar value, it's safe to use the consistent style of List[Dict[str, float]]?
Thanks for bringing this up @cr-xu . Actually, most generators can generate more than one sample if generator.generate(x) if x>1 (I think ES and RCDS are some of the only generators that cannot generate more than one). I think we can standardize this such that the type hint is a numpy array instead. This however might conflict with our casual notion of what the evaluate function should take as an input ie. dict[str, float], since multiple points to be evaluated should have the form List[dict[str, float]]. @ChristopherMayes what are your thoughts?
Note that this is why I favor pandas DataFrame conventions instead of dicts, and lists of dicts. We currently do this internally inside of xopt, but it might be useful to have generators return DataFrames instead.
Thanks for bringing this up @cr-xu . Actually, most generators can generate more than one sample if generator.generate(x) if x>1 (I think ES and RCDS are some of the only generators that cannot generate more than one).
This I understand. I meant one input parameter might not be scalar-valued (list, categorical etc.), but this is not being considered by Xopt anyway.
An easy fix would be to float() convert the returned values from RCDS and ES, because they are np arrays now.
In general, I like the idea of generators returning pd.DataFrame.
Now the the returned values from
generate(n_candidates)
for different Generators are in different conventions.Specifically, some return
List[Dict[str, float]]
and some returnList[Dict[str, np.ndarray]]
, which is not documented explicitly in the type annotation.Although this doesn't affect the performance when people use only
X.run()
, it becomes quite confusing when someone is trying to use Generator separately.Since most (if not all) of the Generators only works for the case that an input parameter has one scalar value, it's safe to use the consistent style of
List[Dict[str, float]]
?For example:
Output:
The text was updated successfully, but these errors were encountered: