figure - rolling/sliding windows from original time series for the hands-on examples in this sectionyou can refer to the jupyter notebook notebook_stock_prediction_regression_modeling_lstm ipynb for the necessary code snippets and examples for using lstms to model our time serieswe need to apply one more level of transformation to be able to input our data lstms accept tensors as inputwe transform each of the windows (or sequencesin (nwfformat heren is the number of samples or windows from the original time seriesw is the size of each window or the number of historical time steps and is the number of features per time step in our caseas we are only using the closing pricef is equal to and are configurable the following function performs the windowing and tensor transformations using pandas and numpy def get_reg_train_test(timeseries,sequence_length train_size= ,roll_mean_window= normalize=true,scale=false)smoothen out series if roll_mean_windowtimeseries timeseries rolling(roll_mean_windowmean(dropna(create windows result [for index in range(len(timeseriessequence_length)result append(timeseries[indexindex sequence_length]normalize data as variation of th index if normalizenormalised_data [for window in resultnormalised_window [((float(pfloat(window[ ]) for in windownormalised_data append(normalised_windowresult normalised_data identify train-test splits result np array(resultrow round(train_size result shape[ ]split train and test sets train result[:int(row):test result[int(row)::