Skip to content

Commit

Permalink
docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoabreu1002 committed Apr 12, 2021
1 parent 62c5b85 commit d1d93c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion LSTM_Residual.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def gen_population(self):

return population

def fit(self, lag_error, searchSpace, options_ACO):
def fit(self, lag_error, searchSpace, options_ACO, saturate=True, saturation=[0,1]):

erro_train_entrada, erro_train_saida, erro_test_entrada, erro_test_saida = self.train_test_split(
self._erro, lag_error)
Expand All @@ -81,6 +81,10 @@ def fit(self, lag_error, searchSpace, options_ACO):
print(error_hat_test.shape)

y_hat_test = self._data_test_arima[:] + error_hat_test[:,0]
if saturate:
y_hat_test[y_hat_test < saturation[0]] = saturation[0]
y_hat_test[y_hat_test > saturation[1]] = saturation[1]

print("shape y_hat_test")
print(y_hat_test.shape)

Expand Down
5 changes: 4 additions & 1 deletion TimeSeriesUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
rotatingHandler.setLevel(logging.INFO)
logging.getLogger('').addHandler(rotatingHandler)

def MAPE(y_pred, y_true):
def MAPE(y_pred, y_true):
"""
(y_pred, y_true)
"""
mask = y_true != 0
return (np.fabs(y_true - y_pred)/y_true)[mask].mean()

Expand Down

0 comments on commit d1d93c6

Please sign in to comment.