Skip to main content

L*_sha: L*-Based Algorithm for Stochastic Hybrid Automata Learning

This repository contains the implementation of L*_sha, an algorithm to learn Stochastic Hybrid Automata from collected system traces. The algorithm is not tied to a specific domain, although it has been successfully exploited to infer a model of human behavior in human-robot interaction scenarios building upon the work presented in:

The algorithm builds upon L*, whose main elements are:

  • a Teacher that stores the collected traces and answers queries based on currently accumulated knowledge
  • a Learner that progressively refines the hypothesis automaton by asking queries to the Teacher

The teacher relies on samples of the System Under Learning (SUL) (i.e., it does not possess exact knowledge). To generate traces for the specific use case of human-robot interaction, we exploit either Uppaal with manually drafted SHA to be learned or the deployment framework to simulate the robotic application in a virtual environment and collect the simulation traces.

Authors:

Name E-mail address
Lestingi Livia livia.lestingi@polimi.it

Learned SHA

Learned SHA for the thermostat case study can be found here.

Learned SHA for the human-robot interaction case study can be found here.

Configuration File Setup

The main L*_sha script requires as input parameter the path to a configuration file, whose template can be found within the ./resources/config/ folder.

Make sure to set each property to match your environment, specifically:

  • N_min is the minimum number of observations for each trace to stop perfoming the refinement query (i.e., a value greater than 10 is advised);
  • CASE_STUDY is the chosen SUL (either THERMO or HRI);
  • CS_VERSION is the experiment you want to perform for the chosen SUL;
  • RESAMPLE_STRATEGY is the chosen approach to generate new SUL traces (either UPPAAL or SIM).

If the chosen resample strategy is UPPAAL:

  • UPPAAL_PATH is the path to Uppaal command line utility;
  • UPPAAL_SCRIPT_PATH is the path to verify.sh;
  • UPPAAL_MODEL_PATH is the path to the Uppaal model template (e.g., hri-w_ref.xml);
  • UPPAAL_QUERY_PATH is the path to the Uppal query template (e.g., thermostat.q);
  • UPPAAL_OUT_PATH is the path where you want the generated traces to be stored.

If the chosen resample strategy is SIM:

  • SIM_LOGS_PATH is the path to available SUL traces.

Note: The algorithm has been tested on Uppaal v.4.1.24 on Mac OS X. Should you run into any issue while testing with a different configuration please report to livia.lestingi@polimi.it.

Python Dependencies

Install the required dependencies:

pip install -r $LSHA_REPO_PATH/requirements.txt

Add the L*_SHA repo path to your Pytho path (fixes ModuleNotFoundError while trying to execute from command line):

export PYTHONPATH="${PYTHONPATH}:$LSHA_REPO_PATH"

Run the main script specifying the path to your configuration file:

python3 $LSHA_REPO_PATH/it/polimi/hri_learn/learn_model.py $CONFIG_FILE_PATH

Copyright © 2021 Livia Lestingi

Metadata

Release files for lsha 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lsha 0.1.10
File Size Uploaded
lsha-0.1.10.tar.gz 147.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lsha 0.1.10
File Interpreter ABI Platform
lsha-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 332.5 kB

Release files / lsha-0.1.10.tar.gz

Download URL lsha-0.1.10.tar.gz
Size 147.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6747e6140e4a42587792d96d02a5f9fe230077b2cd2b77971f9394b908a82d82
BLAKE2b-256 checksum
How to use checksums
b976ba184fa908e241e0def9c5c6c0f0c0c59ad70372c48baa64cb57c7ae5f8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.14

Release files / lsha-0.1.10-py3-none-any.whl

Download URL lsha-0.1.10-py3-none-any.whl
Size 185.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7242ee1b679b0f7f868707c346dbab88ea63b2d84193ad76d5c1f8855c24ae5
BLAKE2b-256 checksum
How to use checksums
4b73a207c232e98727d6e25ec5e3b3f264b3807df6ca6a107476dc0c14479599
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.14

Release history Release notifications | RSS feed

This release

0.1.10 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page