Welcome to QBAF-Py’s documentation!#
QBAF-Py is a library for drawing inferences from Quantitative Bipolar Argumentation Frameworks (QBAFs) and explaining them. The library is written in CPython (C with a Python API) to facilitate speed and efficiency.
Core API#
Module that creates a QBAFArgument type.
- class qbaf.QBAFARelations#
Class representing a set of Relations (Agent, Patient) of type QBAFArgument. Every Relation has an Agent (the initiator of an action) and a Patient (the entity undergoing the effect of an action). Example of (Agent, Patient): (Attacker, Attacked) or (Supporter, Supported).
Note: Every time the type QBAFArgument is written, any type that is hashable can be used.
QBAFARelations(relations)
- Parameters:
relations (Union[list, set]) – A collection of (Agent: QBAFArgument, Patient: QBAFArgument)
- add(agent, patient)#
Add the relation (agent, patient). If it is contained it does nothing.
- Parameters:
agent (QBAFArgument) – The initiator of an action
patient (QBAFArgument) – The entity undergoing the effect of an action
- agents(patient)#
Return the agents that initiate a certain action (e.g. attack, support) which effects are undergone by the patient.
- Parameters:
patient (QBAFArgument) – The entity undergoing the effect of the action
- Returns:
The list of QBAFArgment that initiate the action
- Return type:
list
- contains(agent, patient)#
Return True if the relation (agent, patient) is contained. False, otherwise.
- Parameters:
agent (QBAFArgument) – The initiator of an action
patient (QBAFArgument) – The entity undergoing the effect of an action
- Returns:
True if contained, False if not contained
- Return type:
bool
- copy()#
Return a shallow copy of self.
- isdisjoint(other)#
Return True if self has no relation in common with other. False, otherwise.
- Parameters:
other (QBAFARelations) – other instance of QBAFARelations
- Returns:
True if disjointed, False if not disjointed
- Return type:
bool
- patients(agent)#
Return the patients that undergo the effect of a certain action (e.g. attack, support) initiated by the agent.
- Parameters:
agent (QBAFArgument) – The initiator of the action
- Returns:
The list of QBAFArgment that undergo the effect of the action
- Return type:
list
- relations#
Set of argument relations (Agent, Patient).
Getter: Return a copy of the QBAFARelation’s set of relations Type: set of (QBAFArgument, QBAFArgument)
- remove(agent, patient)#
Removed the relation (agent, patient). If it is not contained it does nothing.
- Parameters:
agent (QBAFArgument) – The initiator of an action
patient (QBAFArgument) – The entity undergoing the effect of an action
- class qbaf.QBAFArgument#
This class represents an argument of a QBAF. It has an unmodifiable string name that is used as id, and a string description.
QBAFArgument(name: str, description=””)
- Parameters:
name (str) – The name that will be used as identifier of the argument
description (str, optional) – The description of the argument. Defaults to “”
- description#
The description of the argument.
Getter: Return the argument’s description Setter: Set the argument’s description Type: str
- name#
The name of the argument. Also used as id of the argument.
Getter: Return the argument’s name Type: str
- class qbaf.QBAFramework#
This class represents a Quantitative Bipolar Argumentation Framework (QBAF).
A QBAF consists of a set of arguments, Attack relations between arguments, Support relations between arguments and each argument has an initial strength.
Each argument has a final strength which is calculated as the result of an influence function that combines the initial strength and the aggregation result. The aggregation result is obtained as the result of applying an aggregation function to the final strengths of the attackers and the final strengths of supporters.
Note that every time the type QBAFArgument is written, any type that is hashable can be used.
The semantics of a QBAF are associated with the way the final strengths are calculated. There are some predefined semantics (The default is ‘basic_model’), but custom semantics can be created by implementing your own aggregation function and influence function.
- Predefined semantics: ‘basic_model’, ‘QuadraticEnergy_model’, ‘SquaredDFQuAD_model’,
‘EulerBasedTop_model’, ‘EulerBased_model’ and ‘DFQuAD_model’.
- QBAFramework(arguments, initial_strengths, attack_relations, support_relations,
disjoint_relations=True, semantics=None, aggregation_function=None, influence_function=None, min_strength=-1.7976931348623157e+308, max_strength=1.7976931348623157e+308)
- Parameters:
arguments (list) – a list of QBAFArgument
initial_strengths (list) – a list of floats corresponding to each argument of arguments
attack_relations (Union[set,list]) – a collection of (attacker: QBAFArgument, attacked: QBAFArgument)
support_relations (Union[set,list]) – a collection of (supporter: QBAFArgument, supported: QBAFArgument)
disjoint_relations (bool, optional) – True if the Attack relations and the Support relations must be disjoint. Defaults to True.
semantics (str, optional) – Name of the predifined semantics to be used to calculate the final strengths. Defaults to None. If the aggregation function and the influence function are None it defaults to ‘basic_model’.
aggregation_function (Callable[[list, list], float], optional) – Function to combine the final strengths of the attackers and the supporters. Defaults to None.
influence_function (Callable[[float, float], float], optional) – Function to combine the initial strength and the aggregation result. Defaults to None.
min_strength (float, optional) – The minimum value an initial strength can have. Defaults to -1.7976931348623157e+308. It can only be modified when the semantics are custom
max_strength (float, optional) – The maximum value an initial strength can have. Defaults to 1.7976931348623157e+308. It can only be modified when the semantics are custom
- add_argument(argument, initial_strength=0.0)#
Add an argument to the Framework. If it already exists it does nothing.
- Parameters:
argument (QBAFArgument) – the argument
initial_strength (float, optional) – the initial strength of the argument. Defaults to 0.0.
- add_attack_relation(attacker, attacked)#
Add the Attack relation (attacker, attacked) to the Framework. The relation’s arguments must be contained in the Framework’s arguments. If the Attack relation already exists, this method does nothing.
- Parameters:
attacker (QBAFArgument) – the argument that is attacking
attacked (QBAFArgument) – the argument that is being attacked
- add_support_relation(supporter, supported)#
Add the Support relation (supporter, supported) to the Framework. The relation’s arguments must be contained in the Framework’s arguments. If the Support relation already exists, this method does nothing.
- Parameters:
supporter (QBAFArgument) – the argument that is supporting
supported (QBAFArgument) – the argument that is being supported
- are_strength_consistent(other, arg1, arg2)#
Return True if the argument arg1 and the argument arg2 are strength consistent w.r.t the Framework self and the Framework other. Both arguments must be contained in both Frameworks.
- Parameters:
other (QBAFramework) – a Framework
arg1 (QBAFArgument) – first argument
arg2 (QBAFArgument) – second argument
- Returns:
True if strength consistent, False if strength inconsistent
- Return type:
bool
- arguments#
Set of arguments of the Framework.
Getter: Return a copy of the QBAFramework’s set of arguments
Type: set of QBAFArgument
- attack_relations#
Attack relations of the Framework.
Getter: Return the QBAFramework’s attack relations
Type: QBAFARelations
- attackedBy(attacker)#
Return the arguments that are being attacked by the argument attacker.
- Parameters:
attacker (QBAFArgument) – the argument that is attacking
- Returns:
the arguments that are being attacked
- Return type:
list
- attackersOf(attacked)#
Return the arguments that are attacking the argument attacked.
- Parameters:
attacked (QBAFArgument) – the argument that is being attacked
- Returns:
the arguments that are attacking
- Return type:
list
- change_info(other, explanation)#
Return information regarding the modifications of the set of arguments explanation in the framework self w.r.t. the framework other. All arguments in set must be contained in at least one of the Frameworks.
- Parameters:
other (QBAFramework) – a Framework
explanation (set) – a set of arguments
- Returns:
- removed_arguments, added_arguments, modified_strength_arguments, removed_attack_relations,
added_attack_relations, removed_support_relations, added_support_relations
- Return type:
tuple
- contains_argument(argument)#
Return True if the argument is contained in the Framework. False if it is not.
- Parameters:
argument (QBAFARelations) – the argument
- Returns:
True if contained, False if not contained
- Return type:
bool
- contains_attack_relation(attacker, attacked)#
Return True if the Attack relation (attacker, attacked) is contained in the Framework. False if it is not.
- Parameters:
attacker (QBAFArgument) – the argument that is attacking
attacked (QBAFArgument) – the argument that is being attacked
- Returns:
True if contained, False if not contained
- Return type:
bool
- contains_support_relation(supporter, supported)#
Return True if the Support relation (supporter, supported) is contained in the Framework. False if it is not.
- Parameters:
supporter (QBAFArgument) – the argument that is supporting
supported (QBAFArgument) – the argument that is being supported
- Returns:
True if contained, False if not contained
- Return type:
bool
- copy()#
Return a shallow copy of self.
- disjoint_relations#
True if the attack/support relations must be disjoint, False if they do not have to.
Getter: Return if the attack/support relations must be disjoint or not
Setter: Set if the attack/support relations must be disjoint or not
Type: bool
- final_strength(argument)#
Return the final strength of the argument. If the framework has been modified from the last time the final strengths were calculated they are calculated again. Otherwise, it returns the already calculated final strength.
- Parameters:
argument (QBAFARelations) – the argument
- Returns:
the initial strength
- Return type:
float
- final_strengths#
Final strengths of the arguments of the Framework.
- Getter: Calculate and return the QBAFramework’s final strengths.
If the Framework has not been modified since last time they were calculated, a copy of the previously calculated final strengths is returned.
Type: dict of QBAFArgument: float
- initial_strength(argument)#
Return the initial strength of the argument.
- Parameters:
argument (QBAFARelations) – the argument
- Returns:
the initial strength
- Return type:
float
- initial_strengths#
Initial strengths of the arguments of the Framework.
Getter: Return a copy of the QBAFramework’s initial strengths
Type: dict of QBAFArgument: float
- isCSIExplanation(other, set, arg1, arg2)#
Return True if the Set of arguments set is Counterfactual Strength Inconsistency (CSI) Explanation of the argument arg1 and the argument arg2 w.r.t. the framework self and the framework other. Both arguments must be contained in both Frameworks. All arguments in set must be contained in at least one of the Frameworks.
- Parameters:
other (QBAFramework) – a Framework
set (set) – a set of arguments
arg1 (QBAFArgument) – first argument
arg2 (QBAFArgument) – second argument
- Returns:
True if CSI Explanation, False if not CSI Explanation
- Return type:
bool
- isNSIExplanation(other, set, arg1, arg2)#
Return True if the Set of arguments set is Necessary Strength Inconsistency (NSI) Explanation of the argument arg1 and the argument arg2 w.r.t. the framework self and the framework other. Both arguments must be contained in both Frameworks. All arguments in set must be contained in at least one of the Frameworks.
- Parameters:
other (QBAFramework) – a Framework
set (set) – a set of arguments
arg1 (QBAFArgument) – first argument
arg2 (QBAFArgument) – second argument
- Returns:
True if NSI Explanation, False if not NSI Explanation
- Return type:
bool
- isSSIExplanation(other, set, arg1, arg2)#
Return True if the Set of arguments set is Sufficient Strength Inconsistency (SSI) Explanation of the argument arg1 and the argument arg2 w.r.t. the framework self and the framework other. Both arguments must be contained in both Frameworks. All arguments in set must be contained in at least one of the Frameworks.
- Parameters:
other (QBAFramework) – a Framework
set (set) – a set of arguments
arg1 (QBAFArgument) – first argument
arg2 (QBAFArgument) – second argument
- Returns:
True if SSI Explanation, False if not SSI Explanation
- Return type:
bool
- isacyclic()#
Return True if the Attack/Support relations of the Framework have no cycles. False otherwise.
- Returns:
True if acyclic, False if not acyclic
- Return type:
bool
- max_strength#
The maximun value an initial strength can have in the Framework.
Getter: Return the QBAFramework’s maximum strength.
Type: float
- min_strength#
The minimun value an initial strength can have in the Framework.
Getter: Return the QBAFramework’s minimum strength.
Type: float
- minimalCSIExplanations(other, arg1, arg2)#
Return all the sets of arguments that are a subset-minimal CSI Explanation of the argument arg1 and the argument arg2 w.r.t. the Framework self and the Framework other. Both arguments must be contained in both Frameworks.
- Parameters:
other (QBAFramework) – a Framework
arg1 (QBAFArgument) – first argument
arg2 (QBAFArgument) – second argument
- Returns:
list of set of arguments
- Return type:
list
- minimalNSIExplanations(other, arg1, arg2)#
Return all the sets of arguments that are a subset-minimal NSI Explanation of the argument arg1 and the argument arg2 w.r.t. the Framework self and the Framework other. Both arguments must be contained in both Frameworks.
- Parameters:
other (QBAFramework) – a Framework
arg1 (QBAFArgument) – first argument
arg2 (QBAFArgument) – second argument
- Returns:
list of set of arguments
- Return type:
list
- minimalSSIExplanations(other, arg1, arg2)#
Return all the sets of arguments that are a subset-minimal SSI Explanation of the argument arg1 and the argument arg2 w.r.t. the Framework self and the Framework other. Both arguments must be contained in both Frameworks.
- Parameters:
other (QBAFramework) – a Framework
arg1 (QBAFArgument) – first argument
arg2 (QBAFArgument) – second argument
- Returns:
list of set of arguments
- Return type:
list
- modify_initial_strength(argument, initial_strength)#
Modify the initial strength of the argument.
- Parameters:
argument (QBAFArgument) – the argument to be modified
initial_strength (float) – the new value of initial strength
- remove_argument(argument)#
Remove the argument from the Framework. If it does not exist it does nothing.
- Parameters:
argument (QBAFArgument) – the argument
- remove_attack_relation(attacker, attacked)#
Remove the Attack relation (attacker, attacked) from the Framework. If the Attack relation does not exist, this method does nothing.
- Parameters:
attacker (QBAFArgument) – the argument that is attacking
attacked (QBAFArgument) – the argument that is being attacked
- remove_support_relation(supporter, supported)#
Remove the Support relation (supporter, supported) from the Framework. If the Support relation does not exist, this method does nothing.
- Parameters:
supporter (QBAFArgument) – the argument that is supporting
supported (QBAFArgument) – the argument that is being supported
- reversal(other, set)#
Return the reversal Framework of the Framework self to the Framework other w.r.t. the Set of arguments set. All arguments in set must be contained in at least one of the Frameworks.
- Parameters:
other (QBAFramework) – a Framework
set (set) – a set of arguments
- Returns:
a new Framework
- Return type:
- semantics#
The name of the semantics used to calculate the final strengths of the Framework. If the semantics are custom (not predefined) then its value is None.
Getter: Return the QBAFramework’s semantics name. None if it is custom.
Type: str
- support_relations#
Support relations of the Framework.
Getter: Return the QBAFramework’s support relations
Type: QBAFARelations
- supportedBy(supporter)#
Return the arguments that are being supported by the argument supporter.
- Parameters:
supporter (QBAFArgument) – the argument that is supporting
- Returns:
the arguments that are being supported
- Return type:
list
- supportersOf(supported)#
Return the arguments that are supporting the argument supported.
- Parameters:
supported (QBAFArgument) – the argument that is being supported
- Returns:
the arguments that are supporting
- Return type:
list
Contribution Functions#
- qbaf_ctrbs.removal.determine_removal_ctrb(topic, contributors, qbaf)[source]#
Determines the removal contribution of a contributor or a set of contributors to a topic argument.
- Parameters:
topic (string) – The topic argument
contributors (string or set) – The contributing argument(s)
qbaf (QBAFramework) – The QBAF that contains topic and contributor
- Returns:
The contribution of the contributor to the topic
- Return type:
float
- qbaf_ctrbs.intrinsic_removal.determine_iremoval_ctrb(topic, contributors, qbaf)[source]#
- Determines the intrinsic removal contribution of a contributor
or a set of contributors to a topic argument.
- Parameters:
topic (string) – The topic argument
contributors (string or set) – The contributing argument(s)
qbaf (QBAFramework) – The QBAF that contains topic and contributor
- Returns:
The contribution of the contributor to the topic
- Return type:
float
- qbaf_ctrbs.shapley.determine_shapley_ctrb(topic, contributors, qbaf)[source]#
Determines the shapley contribution of a contributor or a set of contributors to a topic argument.
Note
If a set of contributors is provided, its elements are treated as a single player in the calculation. For example, given three arguments {a}, {b}, and {c}, specifying {b, c} as a contributor results in two players: {a} and {b, c}.
- Parameters:
topic (string) – The topic argument
contributors (string or set) – The contributing argument(s)
qbaf (QBAFramework) – The QBAF that contains topic and contributor
- Returns:
The contribution of the contributor to the topic
- Return type:
float
This is a wrapper around determine_partitioned_shapley_ctrb. It partitions qbaf.arguments into singletons, except for contributors which form one set, then calls determine_partitioned_shapley_ctrb.
- qbaf_ctrbs.shapley.determine_partitioned_shapley_ctrb(topic, contributors, partition, qbaf)[source]#
Determines the shapley contribution of a contributor or a set of contributors to a topic argument for a given argument partition.
- Parameters:
topic (string) – The topic argument
contributors (string or set) – The contributing argument(s)
partition (set) – The argument partitioning
qbaf (QBAFramework) – The QBAF that contains topic and contributor
- Returns:
The contribution of the contributor to the topic
- Return type:
float
- qbaf_ctrbs.gradient.determine_gradient_ctrb(topic, contributors, qbaf, epsilon=1.4901161193847656e-08, aggregation_fn=<built-in function max>)[source]#
Determines the gradient contribution of a contributor or a set of contributors to a topic argument.
- Parameters:
topic (string) – The topic argument
contributors (string or set) – The contributing argument(s)
qbaf (QBAFramework) – The QBAF that contains topic and contributor
epsilon (float) – Epsilon used by the approximator. Defaults to 1.4901161193847656e-08.
aggregation_fn (function) – Function to aggregate gradient contributions. Defaults to max.
- Returns:
The contribution of the contributor to the topic
- Return type:
float
- qbaf_ctrbs.utils.restrict(qbaf, arguments)[source]#
Restricts the given QBAF to the provided set of arguments.
- Parameters:
qbaf (QBAFramework) – QBAF that is to be restricted
arguments (list) – Arguments the QBAF is to be restricted to (all other arguments will be removed)
- Returns:
restricted QBAF
- Return type:
Robustness Functions#
- qbaf_robustness.consistency_checks.is_general_robust_consistent(qbaf_initial: QBAFramework, qbaf_collection: list[QBAFramework], topic_argument_1: str, topic_argument_2: str) bool[source]#
Checks whether qbaf_initial is general robust consistent with respect to qbaf_collection.
- Parameters:
qbaf_initial (QBAFramework) – The initial QBAF.
qbaf_collection (list[QBAFramework]) – The collection of QBAF updates.
topic_argument_1 (str) – The first topic argument whose strength is considered.
topic_argument_2 (str) – The second topic argument whose strength is considered.
- Returns:
True if qbaf_initial is general robust consistent with respect to qbaf_collection, False otherwise.
- Return type:
bool
- qbaf_robustness.consistency_checks.is_expansion_robust_consistent(qbaf_initial: QBAFramework, qbaf_collection: list[QBAFramework], topic_argument_1: str, topic_argument_2: str) bool[source]#
Checks whether qbaf_initial is expansion robust consistent with respect to qbaf_collection.
- Parameters:
qbaf_initial (QBAFramework) – The initial QBAF.
qbaf_collection (list[QBAFramework]) – The collection of QBAF updates.
topic_argument_1 (str) – The first topic argument whose strength is considered.
topic_argument_2 (str) – The second topic argument whose strength is considered.
- Returns:
True if qbaf_initial is general robust consistent with respect to qbaf_collection, False otherwise.
- Return type:
bool
- qbaf_robustness.consistency_checks.is_bounded_updates_robust_consistent(qbaf_initial: QBAFramework, qbaf_updates: list[QBAFramework], topic_argument_1: str, topic_argument_2: str, epsilon: float, mutable_args: set) bool[source]#
Checks whether qbaf_initial is bounded-update robust consistent with respect to qbaf_collection, epsilon and the mutable_args.
- Parameters:
qbaf_initial (QBAFramework) – The initial QBAF.
qbaf_updates (list[QBAFramework]) – The collection of QBAF updates.
topic_argument_1 (str) – The first topic argument whose strength is considered.
topic_argument_2 (str) – The second topic argument whose strength is considered.
epsilon (float) – The permissible range of strength change.
mutable_args (set) – The set of mutable arguments whose strength is suspected to change.
- Returns:
True if qbaf_initial is bounded-update robust consistent with respect to qbaf_collection.
- Return type:
bool
- qbaf_robustness.consistency_checks.is_bounded_update(qbaf_initial: QBAFramework, qbaf_update: QBAFramework, epsilon: float, mutable_args: set) bool[source]#
Checks whether qbaf_update is an epsilon and mutable_args bounded update.
- Parameters:
qbaf_initial (QBAFramework) – The initial QBAF.
qbaf_update (QBAFramework) – The updated QBAF.
mutable_args (set) – The set of mutable arguments whose strength is suspected to change.
epsilon (float) – The permissible range of strength change.
- Retruns:
bool: True if qbaf_update is an epsilon and mutable_args bounded update,false otherwise.
- qbaf_robustness.consistency_checks.is_expansion(qbaf_initial: QBAFramework, qbaf_update: QBAFramework) bool[source]#
Checks whether qbaf_update is a normal expansion of qbaf_initial.
- Parameters:
qbaf_initial (QBAFramework) – The initial QBAF.
qbaf_update (QBAFramework) – The updated QBAF.
- Returns:
True if qbaf_update is a normal expansion of qbaf_initial, False otherwise.
- Return type:
bool
- qbaf_robustness.inconsistency_checks.is_general_robust_inconsistent(qbaf_initial: QBAFramework, qbaf_collection: list[QBAFramework], topic_argument_1: str, topic_argument_2: str) bool[source]#
Checks whether qbaf_initial is general robust inconsistent with respect to qbaf_collection.
- Parameters:
qbaf_initial (QBAFramework) – The initial QBAF.
qbaf_collection (list[QBAFramework]) – The collection of QBAF updates.
topic_argument_1 (str) – The first topic argument whose strength is considered.
topic_argument_2 (str) – The second topic argument whose strength is considered.
- Returns:
True if qbaf_initial is general robust inconsistent with respect to qbaf_collection, False otherwise.
- Return type:
bool
- qbaf_robustness.inconsistency_checks.is_expansion_robust_inconsistent(qbaf_initial: QBAFramework, qbaf_collection: list[QBAFramework], topic_argument_1: str, topic_argument_2: str) bool[source]#
Checks whether qbaf_initial is expansion robust consistent with respect to qbaf_collection.
- Parameters:
qbaf_initial (QBAFramework) – The initial QBAF.
qbaf_collection (list[QBAFramework]) – The collection of QBAF updates.
topic_argument_1 (str) – The first topic argument whose strength is considered.
topic_argument_2 (str) – The second topic argument whose strength is considered.
- Returns:
True if qbaf_initial is general robust consistent with respect to qbaf_collection, False otherwise.
- Return type:
bool
- qbaf_robustness.inconsistency_checks.is_bounded_updates_robust_inconsistent(qbaf_initial: QBAFramework, qbaf_updates: list[QBAFramework], topic_argument_1: str, topic_argument_2: str, epsilon: float, mutable_args: set) bool[source]#
Checks whether qbaf_initial is bounded-update robust inconsistent with respect to qbaf_collection, epsilon and the mutable_args.
- Parameters:
qbaf_initial (QBAFramework) – The initial QBAF.
qbaf_updates (list[QBAFramework]) – The collection of QBAF updates.
topic_argument_1 (str) – The first topic argument whose strength is considered.
topic_argument_2 (str) – The second topic argument whose strength is considered.
epsilon (float) – The permissible range of strength change.
mutable_args (set) – The set of mutable arguments whose strength is suspected to change.
- Returns:
True if qbaf_initial is bounded-update robust inconsistent with respect to qbaf_collection, False otherwise.
- Return type:
bool
- qbaf_robustness.explanations.new_arguments(initial_qbaf: QBAFramework, qbaf_collection: list[QBAFramework]) set[str][source]#
Returns the set of new arguments that gets added to qbaf_initial by qbaf_collection.
- Parameters:
initial_qbaf (QBAFramework) – The initial QBAF.
qbaf_collection (list[QBAFramework]) – The collection of QBAF updates.
- Returns:
The set of new arguments that gets added to qbaf_initial.
- Return type:
set[str]
- qbaf_robustness.explanations.is_pocket(qbaf_initial: QBAFramework, qbaf_collection: list[QBAFramework], pocket: list[str], topic_argument_1: str, topic_argument_2: str) bool[source]#
Checks whether qbaf_initial is a pocket of qbaf_collection.
- Parameters:
qbaf_initial (QBAFramework) – The initial QBAF.
qbaf_collection (list[QBAFramework]) – The collection of QBAF updates.
pocket (list[str]) – The arguments we check whether is a pocket.
topic_argument_1 (str) – The first topic argument whose strength is considered.
topic_argument_2 (str) – The second topic argument whose strength is considered.
- Returns:
Returns the set of all sub-pockets, if pocket is a pocket of consistency; False otherwise.
- Return type:
list[set[str]]/bool
- qbaf_robustness.explanations.pockets_of_consistency(qbaf_initial: QBAFramework, qbaf_collection: list[QBAFramework], topic_argument_1: str, topic_argument_2: str) list[set[str]][source]#
Retruns the list of pockets of qbaf_initial and qbaf_collection.
- Parameters:
qbaf_initial (QBAFramework) – The initial QBAF.
qbaf_collection (list[QBAFramework]) – The collection of QBAF updates.
topic_argument_1 (str) – The first topic argument whose strength is considered.
topic_argument_2 (str) – The second topic argument whose strength is considered.
- Returns:
The list of pockets.
- Return type:
list[set[str]]
- qbaf_robustness.explanations.explanation_of_robustness_violation(qbaf_initial: QBAFramework, qbaf_collection: list[QBAFramework], topic_argument_1: str, topic_argument_2: str) list[tuple[str]][source]#
Returns the list of minimal arguments in qbaf_collection that explain the updates.
- Parameters:
qbaf_initial (QBAFramework) – The initial QBAF.
qbaf_collection (list[QBAFramework]) – The collection of QBAF updates.
topic_argument_1 (str) – The first topic argument whose strength is considered.
topic_argument_2 (str) – The second topic argument whose strength is considered.
- Returns:
The list of minimal arguments in qbaf_collection that explain the updates.
- Return type:
list[tuple[str]]
Visualization Support#
- qbaf_visualizer.Visualizer.visualize(qbaf: QBAFramework, explanations=[], with_fs=False, round_to=2)[source]#
Takes a QBAF and renders it as a graph
- Parameters:
qbaf (QBAFramework) – The QBAF that is supposed to be rendered
explanations (List) – List of sets of explanation arguments that are supposed to be highlighted
with_fs (Bool) – Set to True if final strenghts should be rendered as well. Defaults to False.
round_to (int) – Number of decimals the strengths should be rounded to before rendering. Defaults to 2.