Learning Spatio-Temporal Specifications for Dynamical Systems

Suhail Alsalehi, Erfan Aasi, Ron Weiss, Calin Belta

Abstract

Learning dynamical systems properties from data provides valuable insights that help us understand such systems and mitigate undesired outcomes. We propose a framework for learning spatio-temporal (ST) properties as formal logic specifications from data. We introduce Support Vector Machine-Signal Temporal Logic (SVM-STL), an extension of Signal Temporal Logic (STL), capable of specifying spatial and temporal properties of a wide range of systems exhibiting time-varying spatial patterns. Our framework utilizes machine learning techniques to learn SVM-STL specifications from system executions given by sequences of spatial patterns. We present methods to deal with both labeled and unlabeled data. In addition, given system requirements in the form of SVM-STL specifications, we provide an approach for parameter synthesis to find parameters that maximize the satisfaction of such specifications. Our learning framework and parameter synthesis approach are showcased in an example of a reaction-diffusion system.

Introduction

Many complex dynamical systems—such as robotic swarms, smart city traffic grids, and multicellular biological networks—exhibit behaviors that change over both space and time. To understand and control these systems, engineers require formal methods to describe their properties. Historically, there has been a divide between machine learning and formal logic. Deep learning models, such as Convolutional Neural Networks (CNNs), excel at extracting spatial features from images but often operate as uninterpretable "black boxes." Conversely, formal logics like Signal Temporal Logic (STL) are highly interpretable and mathematically rigorous but struggle to process high-dimensional spatial data like raw images.

This paper bridges this gap by introducing SVM-STL, a framework that allows researchers to extract readable, logical rules from visual system executions and use those rules to tune system parameters. By combining CNN feature extraction, Support Vector Machine (SVM) classifiers, and temporal logic, the authors provide a method to both infer human-readable system rules from video-like data and synthesize system parameters to achieve desired behaviors.

Methodology: The SVM-STL Framework

The authors propose a two-stage pipeline that decouples spatial learning from temporal learning to make the problem computationally tractable.

Spatial Learning

The system processes a sequence of images (a spatio-temporal trajectory) through a pre-trained CNN (VGG16) to extract high-level features. To handle unlabeled data, unsupervised clustering is employed to group these images into distinct spatial classes. This clustering is optimized using Particle Swarm Optimization (PSO), as detailed in Algorithm 1.

Algorithm 1: Clustering images using Particle Swarm Optimization (PSO).

Following clustering, One-vs-Rest SVMs are trained on these classes. A key innovation here is the use of the geometric margin—the distance from an image's feature vector to the SVM decision boundary—as a continuous "robustness" score. This score serves as the spatial predicate, indicating how strongly an image represents a specific class.

Temporal Learning

Once spatial predicates are established, trajectories are clustered using Dynamic Time Warping (DTW) to group similar sequences of events over time. A Boosted Decision Tree (BDT) algorithm is then used to learn the temporal rules (e.g., "Eventually between time 0 and 30, Class A appears"). This modularity ensures that the logic remains interpretable while benefiting from the power of deep learning for feature extraction.

Parameter Synthesis

Beyond observation and inference, the framework enables active control. Once a desired SVM-STL formula is defined—either learned from data or specified by a user—the authors use PSO to search the system's parameter space. The goal is to maximize the continuous robustness score, finding the exact physical inputs required to force the system to satisfy the logical formula. This process is formalized in Algorithm 3.

Algorithm 3: Parameter Synthesis using PSO to maximize specification satisfaction.

Experimental Evaluation

The framework was evaluated on a simulated Reaction-Diffusion System (Turing patterns), which models how chemical species spread and react to create complex spots and stripes. The authors generated a dataset of 25,000 trajectories, each consisting of a $32 \times 32$ grid evolving over 60 time steps.

Key Results

  • High Inference Accuracy: The BDT algorithm learned SVM-STL formulas for three different trajectory classes with high accuracy. Training accuracies reached up to 99.99%, while testing accuracies remained strong, peaking at 99.68%.
  • Efficiency: Learning the specifications took approximately 1.8 to 2.1 hours on a standard desktop CPU, demonstrating reasonable compute requirements for complex spatio-temporal data.
  • Successful Synthesis: In a practical test, the system was given a rule: "Eventually in the first 30 steps, large spots appear, AND for the whole 60 steps, small spots never appear." Using the approach in Algorithm 3, the system successfully synthesized the required diffusion parameters ($D_1 = 3.9, D_2 = 30$) in just 2.5 minutes.

Conclusion and Future Work

The SVM-STL framework provides a robust bridge between machine learning and formal verification. By using the geometric margin of an SVM as a robustness score, it allows for gradient-free optimization of system parameters based on human-readable logic.

While successful, the current pipeline relies on disjointed components (pre-trained CNNs feeding into separate SVMs). Future work aims to explore end-to-end CNN models that act directly as spatial predicates and to expand the expressivity of the logic to include a wider range of temporal primitives and alternative clustering approaches for high-dimensional signals.

Summary updated

BibTeX
@inproceedings{alsalehi2022learning,
  author = {Suhail Alsalehi and Erfan Aasi and Ron Weiss and Calin Belta},
  title = {{Learning Spatio-Temporal Specifications for Dynamical Systems}},
  booktitle = {L4DC},
  year = {2022},
  url = {https://openreview.net/forum?id=GOK5cl9WrS},
}
Figure