(self, y_transform, array_like=True)
return y
Reverse the transformations and return the target in it's original form.

        array_like determines if y_transform is expected to be multiple values or a single value.
        Note that the differencing won't be done if array_like=False.

        For an inverse of differencing, y_transform needs to include sufficient actual lag values.
Reverse the transformations and return the target in it's original form.
Reverse the transformations and return the target in it s original form .
def inverse_transform(self, y_transform, array_like=True):
        """
        Reverse the transformations and return the target in it's original form.

        array_like determines if y_transform is expected to be multiple values or a single value.
        Note that the differencing won't be done if array_like=False.

        For an inverse of differencing, y_transform needs to include sufficient actual lag values.
        """

        y = y_transform

        # If inversing differencing, we assume sufficient lag values. 
        # These should be actual values that have not been scaled previously.
        if self.make_stationary == 'difference' and array_like:
            if isinstance(y_transform, pd.DataFrame):
                y_lags = y_transform.iloc[:max(self.lags)]
                y = y_transform.iloc[max(self.lags):]
            else:
                y_lags = y_transform[:max(self.lags)]
                y = y_transform[max(self.lags):]
        
        # Inverse the scaling for non-lag values
        if self.scale:
            if isinstance(y, pd.DataFrame):
                y = self.scaler_instance.inverse_transform(np.reshape(y.values, (-1, 1)))
                # The scaler returns a numpy array which needs to be converted back to a data frame
                y = pd.DataFrame(y, columns=y.columns, index=y.index)
            else:
                y = self.scaler_instance.inverse_transform(np.reshape(y, (-1, 1)))
                # Flatten the reshaping done above
                y = y.ravel()

        # Apply an exponential to reverse the logarithm applied during transform
        if self.make_stationary == 'log':
            y = np.exp(y)

        # Reverse the differencing applied during transform
        # NOTE: y_transform will need to include actual lag values
        elif self.make_stationary == 'difference' and array_like:
            if isinstance(y, (pd.Series, pd.DataFrame)):
                y = pd.concat([y_lags, y])
            else:
                y = np.append(y_lags, y)

            len_y = len(y)
            
            for i in range(max(self.lags), len_y):
                for lag in self.lags:
                    if isinstance(y, (pd.Series, pd.DataFrame)):
                        y.iloc[i] = y.iloc[i] + y.iloc[i - lag]
                    else:
                        y[i] = y[i] + y[i - lag]

        if self.logfile is not None:
            self._print_log(2, data=y, array_like=array_like)

        return y
def inverse_transform ( self , y_transform , array_like = True ) : y = y_transform # If inversing differencing, we assume sufficient lag values.  # These should be actual values that have not been scaled previously. if self . make_stationary == 'difference' and array_like : if isinstance ( y_transform , pd . DataFrame ) : y_lags = y_transform . iloc [ : max ( self . lags ) ] y = y_transform . iloc [ max ( self . lags ) : ] else : y_lags = y_transform [ : max ( self . lags ) ] y = y_transform [ max ( self . lags ) : ] # Inverse the scaling for non-lag values if self . scale : if isinstance ( y , pd . DataFrame ) : y = self . scaler_instance . inverse_transform ( np . reshape ( y . values , ( - 1 , 1 ) ) ) # The scaler returns a numpy array which needs to be converted back to a data frame y = pd . DataFrame ( y , columns = y . columns , index = y . index ) else : y = self . scaler_instance . inverse_transform ( np . reshape ( y , ( - 1 , 1 ) ) ) # Flatten the reshaping done above y = y . ravel ( ) # Apply an exponential to reverse the logarithm applied during transform if self . make_stationary == 'log' : y = np . exp ( y ) # Reverse the differencing applied during transform # NOTE: y_transform will need to include actual lag values elif self . make_stationary == 'difference' and array_like : if isinstance ( y , ( pd . Series , pd . DataFrame ) ) : y = pd . concat ( [ y_lags , y ] ) else : y = np . append ( y_lags , y ) len_y = len ( y ) for i in range ( max ( self . lags ) , len_y ) : for lag in self . lags : if isinstance ( y , ( pd . Series , pd . DataFrame ) ) : y . iloc [ i ] = y . iloc [ i ] + y . iloc [ i - lag ] else : y [ i ] = y [ i ] + y [ i - lag ] if self . logfile is not None : self . _print_log ( 2 , data = y , array_like = array_like ) return y