Exemplo n.º 1
0
 def precompute_z_norm(self, data):
     """
     Stores the z-norm of every possible shapelet from data in self.z_data.
     :param data: list of training examples
     :type data: np.array
     """
     self.z_data = dict()
     for w in self.windows:
         for ts_id, ts in enumerate(data):
             self.z_data[ts_id, w] = z_normalize(subsequences(ts, w))
Exemplo n.º 2
0
 def estimate_sigma_min(self):
     """
     Estimates $\sigma_{min}$ by using the maximum standard deviation of shapelets in time series
     without label.
     """
     if self.sigma_min is None:
         sigma_min = 0
         for id, labels in enumerate(self.target):
             if len(labels) == 0:
                 ts_subs = subsequences(self.data[id], min(self.windows))
                 sigma_min = max(sigma_min, ts_subs.std(axis=1).max())
         print("sigma_min set to {}".format(sigma_min))
         self.sigma_min = sigma_min
     shapelet_utils.sigma_min = self.sigma_min