holisticai.security.metrics.attribute_attack_score#

holisticai.security.metrics.attribute_attack_score(x_train: DataFrame, x_test: DataFrame, y_train: Series, y_test: Series, attribute_attack: str, attack_train_ratio: float = 0.5, **kargs) float[source]#

Calculate the accuracy score for black box attribute attack. It is done as follows: - The attack attribute is removed from the training data. - The label is added as an input feature, and a machine learning model is trained. - The model is used to predict the removed attribute, and the prediction is compared with the actual value.

Parameters

x_train: pd.DataFrame

The training features.

x_test: pd.DataFrame

The testing features.

y_train: pd.Series

The training labels.

y_test: pd.Series

The testing labels.

attribute_attack: str

The attribute column in the x_train dataframe to attack.

attack_train_ratio: float

The ratio of the attack data to the training data.

kargs: aditional attributes are passed to AttributeAttackScore class

Returns

float: The accuracy score for black box attribute attack.