feat_dict = {f: (["channel", "name"], [np.random.random(size)
for i in range(n_channels)])
for f in features}
fset = xr.Dataset(feat_dict)
fset.coords["name"] = ts_names
fset.coords["channel"] = range(n_channels)
if targets:
ts_targets = np.array(list(islice(cycle(targets), size)))
fset.coords["target"] = ("name", ts_targets)
if names:
fset.name.values = names
for feat in meta_features:
fset[feat] = ("name", np.random.random(size))
return Featureset(fset)
After Change
ts_names = np.arange(size).astype("str")
index = pd.MultiIndex.from_tuples([(f, i) for f in features for i in range(n_channels)],
names=["feature", "channel"])
fset = pd.DataFrame(np.random.random((size, len(features) * n_channels)),
columns=index)
if targets:
targets = np.array(list(islice(cycle(targets), size)))
if names:
fset.index = names
for feat in meta_features:
fset[feat] = np.random.random(size)
return fset, targets