(self, X, y=None)
return X_transform
Apply the new shape to the data provided in X.
        X is expected to be a 2D DataFrame of samples and features.
        The data will be reshaped according to self.input_shape.
Apply the new shape to the data provided in X.
        X is expected to be a 2D DataFrame of samples and features.
        The data will be reshaped according to self.input_shape.
Apply the new shape to the data provided in X . X is expected to be a 2D DataFrame of samples and features . The data will be reshaped according to self . input_shape .
def transform(self, X, y=None):
        """
        Apply the new shape to the data provided in X.
        X is expected to be a 2D DataFrame of samples and features.
        The data will be reshaped according to self.input_shape. 
        """
        
        # Add the number of samples to the input_shape
        input_shape = self.input_shape.copy()
        input_shape.insert(0, X.shape[0])

        # Debug information is printed to the terminal and logs if required
        if self.logfile:
            self._print_log(2, data=input_shape)

        # If the final shape is n_samples by n_features we have nothing to do here
        if (len(input_shape) == 2):
            return X
        
        # 2D, 3D and 4D data is valid. 
        # e.g. The input_shape can be a tuple of (samples, subsequences, timesteps, features), with subsequences and timesteps as optional.
        # A 5D shape may be valid for e.g. a ConvLSTM with (samples, timesteps, rows, columns, features) 
        if len(input_shape) > 5:
            err = "Unsupported input_shape: {}".format(input_shape)
            raise Exception(err)
        # Reshape the data
        elif len(input_shape) > 2:
            # Reshape input data using numpy
            X_transform = X.values.reshape(input_shape)

            # Debug information is printed to the terminal and logs if required
            if self.logfile:
                self._print_log(3, data=X_transform)

        return X_transform
def transform ( self , X , y = None ) : # Add the number of samples to the input_shape input_shape = self . input_shape . copy ( ) input_shape . insert ( 0 , X . shape [ 0 ] ) # Debug information is printed to the terminal and logs if required if self . logfile : self . _print_log ( 2 , data = input_shape ) # If the final shape is n_samples by n_features we have nothing to do here if ( len ( input_shape ) == 2 ) : return X # 2D, 3D and 4D data is valid.  # e.g. The input_shape can be a tuple of (samples, subsequences, timesteps, features), with subsequences and timesteps as optional. # A 5D shape may be valid for e.g. a ConvLSTM with (samples, timesteps, rows, columns, features)  if len ( input_shape ) > 5 : err = "Unsupported input_shape: {}" . format ( input_shape ) raise Exception ( err ) # Reshape the data elif len ( input_shape ) > 2 : # Reshape input data using numpy X_transform = X . values . reshape ( input_shape ) # Debug information is printed to the terminal and logs if required if self . logfile : self . _print_log ( 3 , data = X_transform ) return X_transform