liveBook · Manning

Instinct function

As explained in Evolutionary Deep Learning: Genetic algorithms and neural networks

An instinct function is a reusable neural-network function or layer that can be placed in models for different tasks or environments.

An instinct function is a reusable neural-network function or layer that can be placed in models for different tasks or environments. In instinctual deep reinforcement learning, several DQN networks share a pool of middle-layer instincts while retaining environment-specific input and output layers. section 12.6

An instinctual model is assembled by:

  • Splitting the network into functional chunks with the Keras functional API. section 12.6
  • Keeping the first and last layers specific to each environment while selecting reusable middle layers from an instinct pool. section 12.6

Instinctual DQN

A model receives an environment-specific input layer, applies three selected dense instincts, concatenates their outputs, and produces actions through an environment-specific output layer.

Listing 12.32 EDL_12_6_Instinctual_DQN_GYMS.ipynb: Building the model
def _build_model(self, instincts):    
    inputs = k.Input(shape=(self.state_size,))            #1
    dense_in = instincts[0]                               #2
    dense1 = instincts[1]
    dense2 = instincts[2]                                 #2
    dense3 = instincts[3]
    dense_out = instincts[4]                              #2
 
    x = dense_in(inputs)
    x1 = dense1(x)                                        #3
    x2 = dense2(x)
    x3 = dense3(x)
    x = kl.concatenate([x1, x2, x3])                      #4
    outputs = dense_out(x)
    model = k.Model(inputs=inputs, outputs=outputs)       #5
    model.compile(loss='mse',   optimizer=k.optimizers.Adam(learning_rate=self.learning_rate))
    return model

Inspect the functional model-building pattern that turns selected layers into reusable instinct slots. section 12.6

How Evolutionary Deep Learning: Genetic algorithms and neural networks covers it

How deep it goes
Descends to Keras model construction, layer selection, concatenation, evaluation, and evolutionary optimization.
Examples
Uses paired DQN networks, multiple environments, dense instinct branches, and an evolutionary individual encoding layer choices.
What it assumes
Assumes familiarity with DQN or deep reinforcement learning, while demonstrating the instinct architecture through a modified DQN implementation.
What you can do after
Build it from scratch by assembling Keras layers into environment-specific DQN models and evolving their shared instinct selections.
How it connects
Connects DQN, deep reinforcement learning, Keras functional models, and evolutionary optimization.

This explainer was generated by Manning's knowledge graph from the text of Evolutionary Deep Learning: Genetic algorithms and neural networks. The section links point to the parts of the book it draws on.