code: def __init__(self, dates: np.ndarray, packets: torch.Tensor):
      self.data = normalize_by_previous_day(packets)
      self.data.log_()
      mean = self.data[:, :, 0 : CandleIdx.open_close].mean(dim=-1)
      self.reference = calculate_moving_average(mean, -4, 0)
      self.target = calculate_moving_average(mean, 1, 5)
      self.strike_low = self.data[:, :, CandleIdx.low]
      self.strike_high = self.data[:, :, CandleIdx.high]
      self.strike_low[:-1] = self.data[1:, :, CandleIdx.low]
      self.strike_high[:-1] = self.data[1:, :, CandleIdx.high]
  
      self.data.transpose_(0, 1)
      self.reference.transpose_(0, 1).unsqueeze_(-1)
      self.target.transpose_(0, 1).unsqueeze_(-1)
      self.strike_low.transpose_(0, 1).unsqueeze_(-1)
      self.strike_high.transpose_(0, 1).unsqueeze_(-1)
      self.y = self.target - self.reference
  
      self.dates = dates[1:]
  
      self.price_std = (
          self.data[:, :, 0 : CandleIdx.prices].std().item()
      )
      self.price_mean = (
          self.data[:, :, 0 : CandleIdx.prices].mean().item()
      )
      self.volume_std = self.data[:, :, CandleIdx.volume].std().item()
      self.volume_mean = self.data[:, :, CandleIdx.volume].mean().item()
      self.y_std = self.y.std().item()
      self.y_mean = self.y.mean().item()
  
      tracker.set_tensor("ref.*", is_once=True)
      tracker.set_tensor("target.*", is_once=True)
      tracker.set_tensor("strike_low.*", is_once=True)
      tracker.set_tensor("strike_high.*", is_once=True)
  
file_path: labml/samples/stocks/dataset.py
imports: import numpy
  import torch
  from labml import monit, lab
  from labml import tracker
  from torch.utils.data import Dataset
  from stocks import CandleIdx
  from stocks.build_numpy_cache import build_cache
label_desc: Use image node_id 1 to create a new MinutelyDataset object from inherited base classes: Dataset with example: obj = MinutelyDataset(dates, packets)