src.plotting.task_plot_decomposition

This module holds the code to compute marginal contributions and shapley values.

Module Contents

Functions

task_plot_decomposition_of_infection_channels_in_spring(depends_on, produces)

task_plot_decomposition_of_rapid_tests_in_spring(depends_on, produces)

_create_bar_plot(df, scenario_to_members, no_effects_scenario, ordering, color)

_create_area_plot(df, scenario_to_members, no_effects_scenario, ordering, color)

_compute_ratios_based_on_shapley_values(s, scenario_to_members: Dict[str, frozenset], no_effects_scenario: str)

_compute_shapley_values(coalitions)

Compute Shapley values.

_compute_marginal_effects(coalitions)

_compute_shapley_values_from_marginal_effects(coalitions)

Attributes

_CHANNEL_SCENARIOS_TO_MEMBERS[source]
_RAPID_TEST_SCENARIOS_TO_MEMBERS[source]
_AVAILABLE_SCENARIOS[source]
_MATPLOTLIB_RC_CONTEXT[source]
_ORDERED_CHANNELS = ['Rapid Tests', 'Seasonality', 'Vaccinations'][source]
_ORDERED_RAPID_TEST_CHANNELS = ['Private', 'Work', 'School'][source]
_ALL_CHANNEL_SCENARIOS_AVAILABLE[source]
_ALL_RAPID_TEST_SCENARIOS_AVAILABLE[source]
task_plot_decomposition_of_infection_channels_in_spring(depends_on, produces)[source]
task_plot_decomposition_of_rapid_tests_in_spring(depends_on, produces)[source]
_create_bar_plot(df, scenario_to_members, no_effects_scenario, ordering, color)[source]
_create_area_plot(df, scenario_to_members, no_effects_scenario, ordering, color)[source]
_compute_ratios_based_on_shapley_values(s, scenario_to_members: Dict[str, frozenset], no_effects_scenario: str)[source]
_compute_shapley_values(coalitions)[source]

Compute Shapley values.

Parameters

coalitions (pandas.DataFrame) –

A DataFrame where each row contains one coalition and an associated payoff.

  • "members" contains an iterable with all the members participating in the specific coalition.

  • "payoff" contains the value associated with the coalition.

Returns

shapley_values – The Shapley values associated with each of the members found in all coalitions.

Return type

pandas.Series

_compute_marginal_effects(coalitions)[source]
_compute_shapley_values_from_marginal_effects(coalitions)[source]