In the context of a pset, we wouldn't care what the type is, as long as it is some kind of int. But the type sensitivity can cause problems if we read back params from a database, e.g. when repeating workloads for failed psets.
If we pass in ints as in
>>> params = ps.plist("a", [1,2,3])
pandas will cast them such that in a DataFrame, df.a.values will be a numpy array
>>> strip_pset = lambda pset: {k: v for k,v in pset.items() if not k.startswith("_")}
>>> params_from_df = [strip_pset(row.to_dict()) for _, row in df.iterrows()]
>>> type(params_from_df[0]["a"])
int
joblib.hash
may be too specific for our purposes in some cases, since it is type-sensitive:In the context of a
pset
, we wouldn't care what the type is, as long as it is some kind of int. But the type sensitivity can cause problems if we read backparams
from a database, e.g. when repeating workloads for failed psets.If we pass in ints as in
pandas
will cast them such that in aDataFrame
,df.a.values
will be a numpy arraywith each entry being int64, but
to_dict()
inwill cast back to Python ints.