Package: features-creation
FeaturesCreationEfficiently creates new DataFrame columns by applying strategically selected operations, optimizing result relevance and significance. It offers a wide range of functions, intelligent operation selection, and seamless integration with popular data analysis libraries, empowering users to enhance data manipulation effortlessly.How it works: Transformation ProcessThe FeaturesCreation library offers a powerful transformation process that allows users to efficiently create new DataFrame columns with strategically selected operations.Instantiation and Fitting:First, you need to instantiate the FeaturesCreation class and specify the classifier you want to use for selecting operations. For example, fe_cr = FeaturesCreation().Then, you fit the FeaturesCreation instance to your data by calling fe_cr.fit(x, y, classifier, n_new_features), where x represents the feature data (input), y is the target column (output), classifier is the chosen classifier (e.g., LGBMClassifier), and n_new_features is the desired number of new features to create.Transformation Selection:During the fitting process, the FeaturesCreation class intelligently selects the most relevant and significant transformations to apply to the data. It leverages the provided classifier to evaluate the importance of each potential transformation and selects the top operations that yield the best results.Application of Transformations:After fitting, the selected transformations are ready to be applied to the original DataFrame. To apply these transformations, call fe_cr.apply_transformation(df, transformations), where df is the original DataFrame, and transformations contains the chosen operations.Resulting DataFrame:The apply_transformation method returns a new DataFrame with the original data and the newly created columns resulting from the applied transformations.DataFrame Before TransformationsConsider the original DataFrame as follows:sepal length (cm)sepal width (cm)petal length (cm)petal width (cm)05.13.51.40.214.93.01.40.224.73.21.30.234.63.11.50.245.03.61.40.2DataFrame After TransformationsNow, let's apply the transformations to the original DataFrame. The resulting DataFrame will be the newly created columns based on the selected operations:sepal length (cm)__mod__petal length (cm)sepal length (cm)__truediv__petal length (cm)sepal width (cm)__truediv__petal width (cm)00.93.64285717.510.73.50000015.020.83.61538516.030.13.06666715.540.83.57142918.0The new columns are named in the format "feature1__operation__feature2" and contain the transformed values generated by applying the specified operations to the original data.ExamplesExamples can be found inexamples/.# Instantiate the FeaturesCreation class and the classifierfe_cr=FeaturesCreation()classifier=LGBMClassifier(verbose=-1)# Define the number of new features to createn_new_features=3# Separate the features (X) and the target column (y)x,y=df.drop(columns=[target_column]),df[target_column]# Create new transformations using FeaturesCreation.fit()transformations=fe_cr.fit(x,y,classifier,n_new_features)# Apply the transformations to the DataFrame using FeaturesCreation.apply_transformation()transformed_df=fe_cr.apply_transformation(df,transformations)# Concatenate the transformed DataFrame with the original DataFrametransformed_df=pd.concat([df,transformed_df],axis=1)