You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# CMP9764 — Advanced Robotics: Assessment Item 2
# DMP vs SEDS: Trajectory Learning under Single-Demonstration Conditions
Implementations of Dynamic Movement Primitives (DMP) and the Stable Estimator
of Dynamical Systems (SEDS), compared for learning from a single demonstration across four
2D trajectory datasets of increasing geometric complexity.
## Methods
- **DMP:** canonical + transformation system with a forcing term fit by Locally Weighted Regression.
- **SEDS:** GMM-based velocity field trained under a Lyapunov stability constraint (global convergence guarantee).
- **Principled hyperparameter selection:** BIC, elbow detection, and closed-loop stability verification, with arc-length-MSE evaluation that isolates geometric path fidelity from speed.
## Key findings
- DMP gives better path fidelity on 3/4 datasets (up to 15.4x lower arc-MSE on sharp trajectories); SEDS guarantees sub-0.2 mm goal convergence everywhere.
- The MSE training objective outperforms log-likelihood by factors of **x17 to x56,399** under data-sparse conditions — reversing the standard multi-demonstration finding.
-
## Prerequisites
## Getting started
```bash
git clone https://github.com/riceth/dmp_vs_seds_trajectory_learning.git
pip install -r requirements.txt
```
## MATLAB (Stage 1 — SEDS)
- MATLAB R2019b or later
- `SEDS_lib/` and `GMR_lib/` toolboxes present in the project root
## Python (Stages 2 and 3 — DMP and Comparison)
- Python 3.8 or later
Install dependencies:
```bash
pip install numpy matplotlib scipy pandas scikit-learn pydmps
```
---
## Setup
## Getting started
```bash
git clone https://github.com/riceth/.git
pip install -r requirements.txt
```
Ensure the `data/` folder contains all four CSV files.
Ensure `SEDS_lib/` and `GMR_lib/` are in the project root (MATLAB will add them to path automatically).
---
## Running the Pipeline
### Stage 1 — SEDS (MATLAB)
Open MATLAB, navigate to the project root, and run:
```matlab
demo_SEDS_Learning
```
This will:
- Run 50 seeds per K value for all four datasets
- Select optimal K via BIC (or MSE elbow for Line)
- Run stability verification on the top 3 seeds
- Compare MSE vs log-likelihood objectives
- Save metrics to `output/logs/seds_*.csv`
- Save figures to `output/figures/seds_*.png`
**Expected runtime:** 10–20 minutes depending on hardware.
---
### Stage 2 — DMP (Python)
From the `src/` directory, run:
```bash
cd src
python dmp_reproduce.py
```
This will:
- Train DMP at baseline n\_bfs = 500 on all datasets
- Sweep n\_bfs over {25, 50, 100, 150, 175, 200, 250} with three selection criteria
- Run qualitative overfit analysis at n\_bfs ∈ {50, 200, 1000, 2000} on WShape and SShape
- Save trajectory logs to `output/logs/dmp_*.csv`
- Save figures to `output/`
**Expected runtime:** Under 2 minutes.
---
### Stage 3 — Comparison (Python)
**Must be run after both Stage 1 and Stage 2 are complete.**
From the `src/` directory, run:
```bash
python comparison_pipeline.py
```
This will:
- Compute arc-length position MSE for DMP and SEDS on all four datasets
- Generate 8 comparison figures
- Save a summary CSV to `output/comparison/summary_comparison.csv`
- Print the DMP vs SEDS arc-MSE table to the terminal
**Expected runtime:** Under 1 minute.
---
## Notes
- Run stages **in order** (SEDS → DMP → Comparison). The comparison pipeline reads logs from both previous stages.
- If you re-run the SEDS pipeline, existing CSV logs in `output/logs/` will be overwritten.
- The SEDS pipeline suppresses MATLAB singularity warnings during execution. These are expected and handled internally.
- All Python scripts must be run from the `src/` directory to ensure relative paths resolve correctly.
# AdvbancedRobotics2
About
DMP and SEDS for learning from demonstration; multi-criterion hyperparameter selection and arc-length-MSE comparison under single-demonstration conditions.