Creating pre-selected features
In the Creating and selecting features for a time series recipe, we learned how to select relevant features using tsfresh. We also discussed how we can use additional feature selection procedures to further reduce the number of features created from our time series.
In this recipe, we will create and select features using tsfresh. Next, we will reduce the feature space by utilizing Lasso regularization. Then, we will learn how to create a dictionary from the selected feature names to trigger the creation of those features from future time series.
How to do it...
Let’s begin by importing the necessary libraries and getting the dataset ready:
- Let’s import the required libraries and functions:
import pandas as pd from sklearn.feature_selection import SelectFromModel from sklearn.linear_model import LogisticRegression from tsfresh import ( extract_features, extract_relevant_features...