recommend_treatments#

scikitplot.feature_selection.recommend_treatments(schema, *, rule=None, role='feature')[source]#

Recommend an ordered preprocessing chain per feature.

Parameters:
schemaFeatureSchema

Fitted schema.

rulecallable or None, default=None

rule(spec) -> (steps, reasons); default_treatment when None.

rolestr or sequence of str or None, default=”feature”

Roles to include.

Returns:
pandas.DataFrame

Indexed by feature with kind, steps and reasons (tuples).

Parameters:
Return type:

DataFrame

Examples

>>> import pandas as pd
>>> from scikitplot.feature_selection import profile_features, recommend_treatments
>>> X = pd.DataFrame({"x": [1.5, 2.5, 3.5, 50.5] * 5, "c": list("abcd") * 5})
>>> recommend_treatments(profile_features(X))["steps"].to_dict()
{'x': ("PowerTransformer(method='yeo-johnson')",), 'c': ("OneHotEncoder(handle_unknown='infrequent_if_exist')",)}