Skip to main content

pc.remove_feature

pc.remove_feature(config, name)

This is a helper method for removing a feature from a model config.

Parameters:

   config: dict
The config to remove a feature from.

   name: str
The name of the feature to remove from the config.

Returns:

   None

Examples:

Add a feature to the default config.

    dataset = pc.get_dataset("titanic")
config = pc.get_default_config(dataset, targets='Survived')
config
# > {'input_features': [{'name': 'Pclass', 'column': 'Pclass', 'type': 'category'},
# {'name': 'Sex', 'column': 'Sex', 'type': 'category'},
# {'name': 'Age', 'column': 'Age', 'type': 'number'},
# {'name': 'SibSp', 'column': 'SibSp', 'type': 'number'},
# {'name': 'Parch', 'column': 'Parch', 'type': 'category'},
# {'name': 'Fare', 'column': 'Fare', 'type': 'number'},
# {'name': 'Cabin', 'column': 'Cabin', 'type': 'category'},
# {'name': 'Embarked', 'column': 'Embarked', 'type': 'category'}],
# 'output_features': [{'name': 'Survived', 'column': 'Survived', 'type': 'binary'}]}

pc.remove_feature(config, "Embarked")
config
# > {'input_features': [{'name': 'Pclass', 'column': 'Pclass', 'type': 'category'},
# {'name': 'Sex', 'column': 'Sex', 'type': 'category'},
# {'name': 'Age', 'column': 'Age', 'type': 'number'},
# {'name': 'SibSp', 'column': 'SibSp', 'type': 'number'},
# {'name': 'Parch', 'column': 'Parch', 'type': 'category'},
# {'name': 'Fare', 'column': 'Fare', 'type': 'number'},
# {'name': 'Cabin', 'column': 'Cabin', 'type': 'category'},
# 'output_features': [{'name': 'Survived', 'column': 'Survived', 'type': 'binary'}]}