ajar.argument.Argument#

class ajar.argument.Argument(name: str, content: str = '', activation_function: Callable[[Any], bool] | None = None, support: List[str] | None = None, counter: List[str] | None = None)[source]#

Bases: object

An Argument is the basic element of an Argumentation Graph.

Arguments represent something that may be true or false, and which are linked together by (attack) relationships. For example, “There are clouds in the sky” is an argument, which attacks “The weather is nice”. If the “clouds” argument is true in a given situation, it will be difficult to accept the “nice weather” argument as well.

__init__(name: str, content: str = '', activation_function: Callable[[Any], bool] | None = None, support: List[str] | None = None, counter: List[str] | None = None)[source]#

Create a new Argument.

Parameters:
  • name – The name (unique identifier) of the argument.

  • content – The (long) description of the argument.

  • activation_function – The activation function of the argument, typically a lambda expression that takes a state as parameter, and returns a boolean. By default (None), the argument will always be considered activated (alive).

  • support – The list of decisions that are supported by this argument. By default, an empty list.

  • counter – The list of decisions that are countered by this argument. By default, an empty list.

Methods

__init__(name[, content, ...])

Create a new Argument.

add_counter(value)

Add a new value to the counters, if it is not present already.

add_support(value)

Add a new value to the supports, if it is not present already.

compute(state)

Determine whether the argument is activated in a given state.

set_alive(alive)

Change the argument's aliveness.

Attributes

name

The name of an argument, a unique identifier.

content

The content of an argument, a long description.

activation_function

The activation function determines if an argument is alive in a situation.

alive

Whether the argument is currently alive.

support

The list of decisions this argument supports.

counter

The list of decisions this argument counters.

activation_function: Callable[[Any], bool]#

The activation function determines if an argument is alive in a situation.

Arguments are defined outside of any context, but need to be evaluated within a given situation. For example, “clouds in the sky” is a possible argument, which may be true (alive) if there are effectively clouds; or false (killed or disabled) otherwise.

An activation function takes a situation as parameter, which are left untyped for flexibility: they usually will be dicts, but could be instances of specific classes, lists, dictionaries, … The function must return a boolean, which indicates the argument’s aliveness in the given situation.

For example, assuming the situation is s = {'clouds': 4} (meaning that there are 4 clouds in the sky), an activation function for “clouds in the sky” could be lambda s: s['clouds'] > 0.

add_counter(value: str)[source]#

Add a new value to the counters, if it is not present already.

add_support(value: str)[source]#

Add a new value to the supports, if it is not present already.

alive: bool#

Whether the argument is currently alive.

The aliveness of an argument is determined by the activation_function in a given situation. All arguments are alive by default, and should be updated when a situation is evaluated. They then should be reset after the judgment.

compute(state) bool[source]#

Determine whether the argument is activated in a given state.

Parameters:

state – The given state. Typically, a dict indexed by strings.

Returns:

A boolean indicating whether the argument is activated.

content: str#

The content of an argument, a long description.

This represents the argument itself, in a human-readable form. In the above example, “There are clouds in the sky” can be considered the content. "clouds in the sky" can be a shorter content, which still brings the same meaning.

counter: List[str]#

The list of decisions this argument counters.

Similarly to support, this is a legacy from the AFDM. For example, “nice weather” counters decision “take an umbrella”.

Note that an argument can be neutral w.r.t. to a decision: it is not because it does not support it that it must counter it. For example, “clouds in the sky” does not necessarily counter “do not take an umbrella”.

name: str#

The name of an argument, a unique identifier.

It should ideally be a string that intuitively gives a hint of the argument’s content. In the above example “There are clouds in the sky”, clouds, cloudy, or even cloudy_sky are reasonably good names, but arg1 is not.

set_alive(alive: bool)[source]#

Change the argument’s aliveness.

support: List[str]#

The list of decisions this argument supports.

This is a legacy from the AFDM, where the goal was to select a decision to make, supported by arguments. For example, “clouds in the sky” supports decision “take an umbrella”, whereas “nice weather” supports “do not take an umbrella”.

In our case (AFJD), we simply want to judge whether the learning agent’s action was aligned with a moral value; decisions can be simplified to 'moral' (i.e., “yes, the action was aligned”) and 'immoral' (i.e., “no, the action violates the moral value”), which is a binary choice.

We keep the original definition, a list of decisions to support potential extensions, such as using different ethical principles to reason over moral values; yet, in practice, this list of decisions is currently limited.

See also its counterpart, counter.