From the course: Practical Python for Time Series Analysis

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Compare feature transformation performance

Compare feature transformation performance - Python Tutorial

From the course: Practical Python for Time Series Analysis

Compare feature transformation performance

- [Instructor] Let's go now to create the lag features, which is the new column you see in the data frame, CPI lag, and get the results to compare how good are each one of the models we have developed through the transformations in the explanatory variable. This is important to compare which is the best transformation and concludes the best model in such regard with the higher R-Squared, and at the same time, we will also compare the models with a unique R-Squared value, not divided by each one of the periods using the stats models library. Now, let's go with the creation of the lag features, which is simply going to the data frame, accessing the CPI, and using the function shift. Now, very important that for the period, if we put 12 and we execute, we get missing data in the beginning of the series. If we have it on the data frame with lag, a new column, we will observe that by the time we plot by filtering for the CPI…

Contents