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)
def forward(self, tensor): bias_ts = tensor / tsf.rolling_mean(tensor, window=self._window) - 1 return bias_ts
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
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
def forward(self, tensor): return tsf.rolling_mean(tensor, window=self._window) / tsf.rolling_std( tensor, window=self._window)
def forward(self, close_ts): output_tensor = tsf.rolling_mean(close_ts, 12) / close_ts return output_tensor