Neurosymbolic Tutorial

Open In Colab

This is the material used in the Neurosymbolic Summer School 2022 and for the NeurIPS 2022 tutorial on Neurosymbolic Programming. The goal of the notebooks is to provide a hands-on component (30 min each) to complement the tutorials. We provide code as an initial walk-through of baseline methods grounded in behavior analysis applications, with optional exercises for open-ended exploration. The dataset consists of thousands of frames of trajectory data annotated with behavior labels by domain experts. The notebooks demonstrate neurosymbolic programming for behavior quantification, where the task is to learn the relationship between pose and behavior.

Setup

You will need Google Colab and a directory to access code_and_data from Colab. The data can be downloaded from this public Google drive link: https://drive.google.com/drive/folders/1TS9DPhtpe4oSjA3TJ65niHU7ICNCPXXj?usp=sharing to be placed inside code_and_data/data. For example, the current code assumes the training data is in the path code_and_data/data/calms21_task1/train_data.npy.

Notebook 1

The goal of this notebook is to provide a walk-through of the data with example code for training neural networks and programs.

  • Data Visualization
    • Plot trajectory samples
  • Neural Network
    • Train a 1D Conv Net
  • Program
    • Train program given structure
  • Visualize Model Weights
  • Open-Ended Exploration

Notebook 2

This notebook walks through top-down type-guided enumeration, one approach for learning neurosymbolic programs.

  • Running Enumeration
  • Visualize Runtime vs. Classification Performance
  • Implement Temporal Filter
  • Open-Ended Exploration

Notebook 3

This notebook walks through informed search via admissible neural heuristics (NEAR), another approach for learning neurosymbolic programs.

  • Running NEAR
  • Visualize Runtime vs. Classification Performance
  • Choose your path:
    • Open-ended Exploration
    • Modifying Architecture of Neural Heuristic
    • IDDFS Search
    • Test on Other Behaviors