SLM Lab
v4.2.0
v4.2.0
  • SLM Lab
  • 🖥Setup
    • Installation
    • Quick Start
  • 🚀Using SLM Lab
    • Lab Command
    • Lab Organization
    • Train: REINFORCE CartPole
    • Resume and Enjoy: REINFORCE CartPole
    • Agent Spec: DDQN+PER on LunarLander
    • Env Spec: A2C on Pong
    • GPU Usage: PPO on Pong
    • Parallelizing Training: Async SAC on Humanoid
    • Experiment and Search Spec: PPO on Breakout
    • Run Benchmark: A2C on Atari Games
    • Meta Spec: High Level Specifications
    • Post-Hoc Analysis
    • TensorBoard: Visualizing Models and Actions
    • Using SLM Lab In Your Project
  • 📈Analyzing Results
    • Data Locations
    • Graphs and Data
    • Performance Metrics
  • 🥇Benchmark Results
    • Public Benchmark Data
    • Discrete Environment Benchmark
    • Continuous Environment Benchmark
    • Atari Environment Benchmark
    • RL GIFs
  • 🔧Development
    • Modular Design
      • Algorithm Taxonomy
      • Class Inheritance: A2C > PPO
    • Algorithm
      • DQN
      • REINFORCE
      • Actor Critic
    • Memory
      • Replay
      • PrioritizedReplay
      • OnPolicyReplay
      • OnPolicyBatchReplay
    • Net
      • MLP
      • CNN
      • RNN
    • Profiling SLM Lab
  • 📖Publications and Talks
    • Book: Foundations of Deep Reinforcement Learning
    • Talks and Presentations
  • 🤓Resources
    • Deep RL Resources
    • Contributing
    • Motivation
    • Help
    • Contact
Powered by GitBook
On this page
  • Multi-Layer Perceptron
  • Source Documentation
  • Example Net Spec

Was this helpful?

  1. 🔧Development
  2. Net

MLP

PreviousNetNextCNN

Last updated 5 years ago

Was this helpful?

Multi-Layer Perceptron

Code:

These networks take a single state as input. They are composed of a sequence of dense (fully connected) layers. MLPs are general purpose, simple networks. Well suited for environments with a low dimensional state space, or a state space with no spatial structure.

Source Documentation

Refer to the class documentation and example net spec from the source:

Example Net Spec

This specification instantiates an MLP with 3 hidden layers of 256, 128, and 64 nodes respectively, rectified linear (ReLU) activations, and the optimizer with a learning rate of 0.02. The rest of the spec is annotated below.

{
    ...
    "agent": [{
      "net": {
        "type": "MLPNet",
        "shared": false,  // whether to shared networks for Actor-Critic
        "hid_layers": [256, 128, 64],
        "hid_layers_activation": "relu",
        "out_layer_activation": null,  // output layer activation
        "init_fn": "xavier_uniform_",  // weight initialization
        "clip_grad_val": 1.0,  // clip gradient by norm
        "loss_spec": {  // default loss function used for regression
          "name": "MSELoss"
        },
        "optim_spec": {  // the optimizer and its arguments
          "name": "Adam",
          "lr": 0.02
        },
        ...
      }
    }],
    ...
}

For more concrete examples of net spec specific to algorithms, refer to the existing .

slm_lab/agent/net/mlp.py
slm_lab/agent/net/mlp.py#L12-L58
Adam
spec files