def load(self, path):
metadata = json.loads(open(path + "/dataset.json").read())
self.index = np.array(metadata["index"])
x_shape = tuple(metadata["x_shape"])
x_type = metadata["x_type"]
if "y_shape" in metadata:
y_shape = tuple(metadata["y_shape"])
y_type = metadata["y_type"]
self.Y = np.memmap(path+"/Y.npy", y_type, shape = y_shape)
else:
self.Y = None
self.nrows = x_shape[0]
self.running_mean = np.asarray(metadata["running_mean"])
self.running_dev = np.asarray(metadata["running_dev"])
self.running_max = np.asarray(metadata["running_min"])
self.running_min = np.asarray(metadata["running_max"])
self.X = np.memmap(path+"/X.npy", x_type, shape = x_shape)
self.path = path
评论列表
文章目录