force_plots ================================================ .. py:module:: evalml.model_understanding.force_plots .. autoapi-nested-parse:: Force plots. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: :nosignatures: evalml.model_understanding.force_plots.force_plot evalml.model_understanding.force_plots.graph_force_plot Contents ~~~~~~~~~~~~~~~~~~~ .. py:function:: force_plot(pipeline, rows_to_explain, training_data, y) Function to generate the data required to build a force plot. :param pipeline: The pipeline to generate the force plot for. :type pipeline: PipelineBase :param rows_to_explain: A list of the indices of the training_data to explain. :type rows_to_explain: list[int] :param training_data: The data used to train the pipeline. :type training_data: pandas.DataFrame :param y: The target data. :type y: pandas.Series :returns: list of dictionaries where each dict contains force plot data. Each dictionary entry represents the explanations for a single row. For single row binary force plots: [{'malignant': {'expected_value': 0.37, 'feature_names': ['worst concave points', 'worst perimeter', 'worst radius'], 'shap_values': [0.09, 0.09, 0.08], 'plot': AdditiveForceVisualizer}] For two row binary force plots: [{'malignant': {'expected_value': 0.37, 'feature_names': ['worst concave points', 'worst perimeter', 'worst radius'], 'shap_values': [0.09, 0.09, 0.08], 'plot': AdditiveForceVisualizer}, {'malignant': {'expected_value': 0.29, 'feature_names': ['worst concave points', 'worst perimeter', 'worst radius'], 'shap_values': [0.05, 0.03, 0.02], 'plot': AdditiveForceVisualizer}] :rtype: list[dict] :raises TypeError: If rows_to_explain is not a list. :raises TypeError: If all values in rows_to_explain aren't integers. .. py:function:: graph_force_plot(pipeline, rows_to_explain, training_data, y, matplotlib=False) Function to generate force plots for the desired rows of the training data. :param pipeline: The pipeline to generate the force plot for. :type pipeline: PipelineBase :param rows_to_explain: A list of the indices indicating which of the rows of the training_data to explain. :type rows_to_explain: list[int] :param training_data: The data used to train the pipeline. :type training_data: pandas.DataFrame :param y: The target data for the pipeline. :type y: pandas.Series :param matplotlib: flag to display the force plot using matplotlib (outside of jupyter) Defaults to False. :type matplotlib: bool :returns: The same as force_plot(), but with an additional key in each dictionary for the plot. :rtype: list[dict[shap.AdditiveForceVisualizer]]