Exemplo n.º 1
0
 def forward(self, tensor_x, tensor_y):
     if tensor_x.dim() < tensor_y.dim():
         tensor_x = tensor_x.expand_as(tensor_y)
     residual = calc_residual3d(tensor_x,
                                tensor_y,
                                window=self.window_train,
                                keep_first_nan=True)
     residual = residual.squeeze(-1).transpose(0, 1)
     return tsf.rolling_mean(residual, self._window)
Exemplo n.º 2
0
 def forward(self, tensor):
     bias_ts = tensor / tsf.rolling_mean(tensor, window=self._window) - 1
     return bias_ts
Exemplo n.º 3
0
 def forward(self, high_ts):
     cond = tsf.rolling_mean(high_ts, self.window) < high_ts
     zeros = torch.zeros(high_ts.size())
     output_tensor = torch.where(cond, (-1 * tsf.diff(high_ts, 2)), zeros)
     return output_tensor
Exemplo n.º 4
0
 def forward(self, close_ts):
     output_tensor = (close_ts - tsf.rolling_mean_(close_ts, self.window)) / tsf.rolling_mean(close_ts,
                                                                                                   self.window) * 100
     return output_tensor
Exemplo n.º 5
0
 def forward(self, tensor):
     return tsf.rolling_mean(tensor, window=self._window) / tsf.rolling_std(
         tensor, window=self._window)
Exemplo n.º 6
0
 def forward(self, close_ts):
     output_tensor = tsf.rolling_mean(close_ts, 12) / close_ts
     return output_tensor