model.boredomhandler module

Module that holds classes that represent an agent’s boredom handler.

class model.boredomhandler.BoredomHandler

Bases: object

Abstract boredom handler class.

process_boredom(interaction_memory, interaction, unmodified_valence)

Modifies the valence of an interaction such that boredom is handled.

Parameters:
  • interaction_memory – The interaction memory
  • interaction – The interaction to process boredom for
  • unmodified_valence – The unmodified (raw) valence of the interaction
Returns:

The modified valence taking boredom into account

class model.boredomhandler.PassthroughBoredomHandler

Bases: model.boredomhandler.BoredomHandler

A boredom handler not implementing any boredom measures.

process_boredom(interaction_memory, interaction, unmodified_valence)
class model.boredomhandler.RepetitiveBoredomHandler

Bases: model.boredomhandler.BoredomHandler

A boredom handler taking into the account the last few (primitive) interactions enacted by the agent, and compares the similarity of those with the proposed interaction. The more similar, the more the interaction is penalized.

HISTORY_CONSIDER_SIZE = 15
count_interactions(interaction_sequence)

Count the interaction occurrences in a sequence.

Parameters:interaction_sequence – The interaction sequence
Returns:A Counter (dictionary) object mapping from interactions to their frequency in the sequence.
process_boredom(interaction_memory, interaction, unmodified_valence)
similarity(count1, count2)

Calculate the cosine similarity between two counts (Counter dictionaries, seen as vectors).

Parameters:
  • count1 – The first interaction count
  • count2 – The second interaction count
Returns:

The cosine similarity between the two counts

class model.boredomhandler.WeightBoredomHandler

Bases: model.boredomhandler.BoredomHandler

A boredom handler taking into account the weight of interactions. The sum of the hierarchical weight of an interaction is calculated, and its contribution to the total weight is calculated. This is used to discount interactions that have a high contribution.

interaction_total_weight(interaction_memory, interaction)

Get the total (hierarchical) weight of an interaction. This takes the sum of all weights of all interactions inside the hierarchy of this interaction. E.g., for a composite interaction <i1, i2> the sum is weight(<i1, i2>) = <i1, i2>.weight + weight(i1) + weight(i2).

Parameters:
  • interaction_memory – The interaction memory
  • interaction – The interaction to get the hierarchical weight for
Returns:

The hierarchical weight of the interaction

process_boredom(interaction_memory, interaction, unmodified_valence)
class model.boredomhandler.WeightRepetitiveBoredomHandler

Bases: model.boredomhandler.BoredomHandler

A boredom handler combining the weight boredom handler and repetitive boredom handler by taking the average valence output of the two.

process_boredom(interaction_memory, interaction, unmodified_valence)