pyreal.explanation_types.feature_based.AdditiveFeatureImportanceExplanation#
- class pyreal.explanation_types.feature_based.AdditiveFeatureImportanceExplanation(explanation, values=None)[source]#
A type wrapper for additive global feature importance DataFrame type outputs from explanation algorithms. Additive global feature importance give one numeric value per feature, representing that feature’s overall importance to the model’s prediction. Importance values can be added together with meaningful effect (ie., importance of feature A + importance of feature B = combined importance of feature A and B)
- __init__(explanation, values=None)#
Set the wrapped explanation to explanation and values to values and validate :param explanation: wrapped explanation :type explanation: object :param values: Values corresponding with the object being explained :type values: DataFrame of shape (n_instances, n_features) or None
Methods
__init__
(explanation[, values])Set the wrapped explanation to explanation and values to values and validate :param explanation: wrapped explanation :type explanation: object :param values: Values corresponding with the object being explained :type values: DataFrame of shape (n_instances, n_features) or None
apply_feature_descriptions
(feature_descriptions)Apply feature descriptions to explanation
combine_columns
(columns, new_column)Combine the values for columns into a new column, if appropriate :param columns: Columns to sum :type columns: list of strings :param new_column: Name of new column :type new_column: string
get
()Get the explanation wrapped by this type.
get_all
()Get the explanation and wrapped values as a tuple.
get_explanation
()Get the explanation wrapped by this type
get_top_features
([num_features, select_by])Get the top features from the explanation :returns:
get_values
()Return the values associated with the explanation
update_explanation
(new_explanation[, ...])Sets this object's explanation to the new value.
update_values
(values[, inplace])Updates this objects values, and validates
validate
()Validate that self.explanation is a valid single-row DataFrame :returns: None
validate_values
()Validate that self.values are valid values for this Explanation.