ContainsElement

class mastml.legos.feature_generators.ContainsElement(composition_feature, element, new_name, all_elements=False)[source]

Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin

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(df[, y])
transform(df[, y])

Methods Documentation

fit(df, y=None)[source]
transform(df, y=None)[source]