def __init__(self, path,
x_width = 0, x_type = np.float,
y_width = 0, y_type = types.int_):
if os.path.exists(path + "/dataset.json"):
print("Using existing dataset in "+path)
self.load(path)
else:
if x_width == 0 : raise "X width must be specified for new dataset"
self.X = np.memmap(path + "/X.npy", x_type, "w+", 0, (1, x_width))
self.X.flush()
if y_width > 0:
self.Y = np.memmap(path + "/Y.npy", y_type, "w+", 0, (1, y_width))
self.Y.flush()
else: self.Y = None
self.index = None
self.nrows = 0
self.running_mean = np.zeros((1, x_width), x_type)
self.running_dev = np.zeros((1, x_width), x_type)
self.running_max = np.zeros((1, x_width), x_type)
self.running_min = np.zeros((1, x_width), x_type)
self.path = path
评论列表
文章目录