narla.rewards

ActiveNeurons

class narla.rewards.ActiveNeurons[source]

Bases: narla.rewards.biological_reward.BiologicalReward

Rewards Neurons for becoming active

compute(network, layer_index)[source]

Compute the reward for the specified Layer

Parameters
  • network (MultiAgentNetwork) – Network

  • layer_index (int) – Index of the Layer to computer rewards for

Return type

Tensor

BiologicalReward

class narla.rewards.BiologicalReward[source]

Bases: narla.rewards.reward.Reward

BiologicalRewards are based on activity and dynamics within the Network

abstract compute(network, layer_index)[source]

Compute the reward for the specified Layer

Parameters
  • network (MultiAgentNetwork) – Network

  • layer_index (int) – Index of the Layer to computer rewards for

Return type

Tensor

LayerSparsity

class narla.rewards.LayerSparsity(desired_sparsity=0.2)[source]

Bases: narla.rewards.biological_reward.BiologicalReward

Rewards Neurons in the layer for appropriate sparsity

compute(network, layer_index)[source]

Compute the reward for the specified Layer

Parameters
  • network (MultiAgentNetwork) – Network

  • layer_index (int) – Index of the Layer to computer rewards for

Return type

Tensor

Reward

class narla.rewards.Reward[source]

Bases: object

abstract compute(*args, **kwargs)[source]

Compute the reward

Return type

Tensor

RewardTypes

class narla.rewards.RewardTypes(value)[source]

Bases: str, enum.Enum

An enumeration.

ACTIVE_NEURONS = 'active_neurons'
ACTIVITY_TRACE = 'activity_trace'
LAYER_SPARSITY = 'layer_sparsity'
PREDICTION = 'prediction'
TASK_REWARD = 'task_reward'
static biological_reward_types()[source]

Get the RewardTypes that are biological

Return type

List[RewardTypes]

to_reward()[source]

Convert the RewardType to a Reward object

Return type

Reward