OneHotElementEncoder¶
-
class
mastml.feature_generators.
OneHotElementEncoder
(composition_df, remove_constant_columns=False)[source]¶ Bases:
mastml.feature_generators.BaseGenerator
Class to generate new categorical features (i.e. values of 1 or 0) based on whether an input composition contains a certain designated element
- Args:
composition_feature: (str), string denoting a chemical composition to generate elemental features from
element: (str), string representing the name of an element
new_name: (str), the name of the new feature column to be generated
all_elments: (bool), whether to generate new features for all elements present from all compositions in the dataset.
- Methods:
- fit: pass through, needed to maintain scikit-learn class structure
- Args:
- df: (dataframe), dataframe of input X and y data
- transform: generate new element-specific features
- Args:
- df: (dataframe), dataframe of input X and y data
- Returns:
- df_trans: (dataframe), dataframe with generated element-specific features
Methods Summary
fit
(X[, y])transform
(X[, y])Methods Documentation