deepsysid

System identification toolkit for multistep prediction using deep learning and hybrid methods.

https://github.com/alexandrabaier/deepsysid

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.3%) to scientific vocabulary

Keywords

deep-learning machine-learning physics-informed-neural-networks system-identification system-identification-toolbox
Last synced: 6 months ago · JSON representation ·

Repository

System identification toolkit for multistep prediction using deep learning and hybrid methods.

Basic Info
  • Host: GitHub
  • Owner: AlexandraBaier
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 1.21 MB
Statistics
  • Stars: 18
  • Watchers: 2
  • Forks: 6
  • Open Issues: 3
  • Releases: 0
Topics
deep-learning machine-learning physics-informed-neural-networks system-identification system-identification-toolbox
Created almost 4 years ago · Last pushed 6 months ago
Metadata Files
Readme License Citation

README.md

deepsysid

A system identification toolkit for multistep prediction using deep learning and hybrid methods.

The toolkit is easy to use. After you follow the instructions below, you can download a dataset, run hyperparameter optimization and identify your best-performing models in three lines: shell deepsysid download 4dof-sim-ship deepsysid session --enable-cuda progress.json NEW deepsysid session --enable-cuda --reportin=progress.json progress.json TEST_BEST

How to use?

Installation

Install via pip as follows, if you wish to run models on your GPU: shell pip install deepsysid@git+https://github.com/AlexandraBaier/deepsysid.git This command will not install the required PyTorch dependency. You have to install PyTorch manually. You can find corresponding instructions here.

If you are fine with running everything on your CPU, you can instead use the following command to install the package with PyTorch included: shell pip install deepsysid[torch-cpu]@git+https://github.com/AlexandraBaier/deepsysid.git

Environment Variables and Directories

Set the following environment variables: DATASET_DIRECTORY=<root directory of dataset with at least child directory processed> MODELS_DIRECTORY=<directory for saving of trained models> RESULT_DIRECTORY=<directory for validation/test results> CONFIGURATION=<JSON configuration file> The DATASET_DIRECTORY requires a specific structure which is shown in Datasets.

The structure of RESULT_DIRECTORY and MODELS_DIRECTORY is automatically generated by the provided scripts. You only need to make sure the respective directories exist.

CONFIGURATION points to a JSON file, which we discuss in Configuration.

Datasets

The following structure is expected for the dataset directory: DATASET_DIRECTORY - processed/ -- train/ --- *.csv -- validation/ --- *.csv -- test/ --- *.csv A ship motion dataset with the required structure can be found on DaRUS.

You can also download datasets in the right format with deepsysid download <dataset name> The dataset will be downloaded and prepared in the directory specified by DATASET_DIRECTORY. We are working on continuously adding new datasets. Run deepsysid download to see what datasets are available.

Configuration

We use a JSON file for our experiment and model configuration management. The configuration at its core defines a gridsearch for various models. Our configuration are defined as a pydantic model called deepsysid.pipeline.configuration.ExperimentGridSearchTemplate. The configuration file should be placed under the path specified by CONFIGURATION. We can validate the configuration file with deepsysid validate_configuration. A JSON configuration will have the following format: json { "settings": { "time_delta": "float, sampling time of your measurements", "window_size": "int, size of the initial window during evaluation", "horizon_size": "int, size of the prediction horizon during evaluation", "control_names": "list of strings, inputs to the model", "state_names": "list of strings, outputs of the model", "session": { "comment": "session is entirely optional and configures deepsysid session", "total_runs_for_best_models": "int, > 1, how many runs in total are executed for the best performing models" }, "target_metric": "name of metric used to select best performing model during grid-search", "metrics": { "name of metric": { "metric_class": "str, metrics (MSE, MAE, ...) executed during the evaluation.", "parameters": { "parameter name": "parameter value, metrics might additional require settings." } } }, "additional_tests": { "name of test": { "test_class": "str, tests performed when calling test in addition to inference on dataset.", "parameters": { "parameter name": "parameter value, some tests require additional settings." } } } }, "models": [ { "model_base_name": "str, base name of model will be extended by choice of flexible hyperparameters", "model_class": "str", "static_parameters": { "hyperparameter name": "hyperparameter value, no grid search will be performed over these parameters" }, "flexible_parameters": { "hyperparameter name": "list of hyperparameter values, gridsearch is performed over these parameters" } } ] }

First, we can run deepsysid session to perform an automatic hyperparameter search as shown at the top of the README.

Second, we can use it to manually train/test/evaluate specific models. To get a list of all model names use deepsysid write_model_names <output text>. You can then, for example, run deepsysid train <model_name> on a chosen model.

Command Line Interface

The deepsysid package exposes a command-line interface. Run deepsysid or deepsysid --help to access the list of available subcommands: ``` usage: Command line interface for the deepsysid package. [-h] {validateconfiguration,train,test,explain,evaluate,writemodel_names,session,download} ...

positional arguments: {validateconfiguration,train,test,explain,evaluate,writemodelnames,session,download} validateconfiguration Validate configuration file defined in CONFIGURATION. train Train a model. test Test a model. explain Explain a model. evaluate Evaluate a model. writemodelnames Write all model names from the configuration to a text file. session Run a full experiment given the configuration JSON. State of the session can be loaded from and is saved to disk. This allows stopping and continuing a session at any point. download Download and prepare datasets.

optional arguments: -h, --help show this help message and exit ```

Run deepsysid {subcommand} --help to get details on the specific subcommand.

Some common arguments for subcommands are listed here: - model: Positional argument. Name of model as defined in configuration JSON. - --enable-cuda: Optional flag. Script will pass device-name cuda to model. Models that support GPU usage will run accordingly. - --device-idx={n}: Optional argument (only in combination with --enable-cuda). Script will pass device name cuda:n to model, where n is an integer greater or equal to 0. - --disable-stdout: Optional flag for subcommand train. Script will not print logging to stdout, however will still log to training.log in the model directory. - --mode={train,validation,test}: Required argument for test and evaluate. Choose either train, validation or test to select what dataset to run the test and evaluate on.

Adding New Models

Adding new models is relatively easy. It consists of two steps (+ one optional step).

  1. You need to create a configuration class by subclassing deepsysid.models.base.DynamicIdentificationModelConfig, where you specify your model's hyperparameters. This is a subclass of pydantic.BaseModel and ensures that your configuration will always have the right types, when loaded from a file.
  2. You need to create a model class by subclassing deepsysid.models.base.DynamicIdentificationModel. DynamicIdentificationModel is an abstract class (or rather an interface in most other languages) that provides method signatures for initializing __init__, training train, and predicting simulate, as well as IO tasks save/load/get_extensions and retrieving the model size get_parameter_count. You need to implement these methods according to their signatures. Additionally, make sure to point the class field CONFIG inherited from DynamicIdentificationModel to your newly defined configuration class. This will allow the surrounding training and testing functionalities to correctly initialize your model.
  3. (Optional) Finally, you might want to ensure that your code won't break the moment it is run. Adding a simple smoke test to tests/smoke_tests/test_pipeline is the easiest way to do so.

References

Owner

  • Name: Alexandra Baier
  • Login: AlexandraBaier
  • Kind: user
  • Location: Stuttgart
  • Company: @AnalyticComp

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: deepsysid
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Alexandra
    family-names: Baier
    affiliation: University of Stuttgart
    orcid: 'https://orcid.org/0000-0001-5609-3400'
    email: Alexandra.Baier@ki.uni-stuttgart.de
  - given-names: Daniel
    family-names: Frank
    email: Daniel.Frank@ki.uni-stuttgart.de
    affiliation: University of Stuttgart
    orcid: 'https://orcid.org/0000-0002-6730-2252'
identifiers:
  - type: doi
    value: 10.18419/darus-3455
    description: The DaRUS link of the software.
repository-code: 'https://github.com/AlexandraBaier/deepsysid'
repository: >-
  https://darus.uni-stuttgart.de/dataset.xhtml?persistentId=doi:10.18419/darus-3455
abstract: >-
  A system identification toolkit for multistep prediction
  using deep learning and hybrid methods.
keywords:
  - system identification
  - deep learning
license: MIT
doi: 10.18419/darus-3455
date-released: 2023

GitHub Events

Total
  • Issues event: 2
  • Watch event: 5
  • Issue comment event: 1
  • Push event: 8
Last Year
  • Issues event: 2
  • Watch event: 5
  • Issue comment event: 1
  • Push event: 8

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: 15 days
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: 15 days
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • liu1084 (1)
  • RoChenyj (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

poetry.lock pypi
  • black 22.12.0 develop
  • cfgv 3.3.1 develop
  • click 8.1.3 develop
  • colorama 0.4.6 develop
  • coverage 6.5.0 develop
  • distlib 0.3.6 develop
  • exceptiongroup 1.1.0 develop
  • filelock 3.9.0 develop
  • flake8 5.0.4 develop
  • identify 2.5.12 develop
  • iniconfig 2.0.0 develop
  • isort 5.11.4 develop
  • mccabe 0.7.0 develop
  • mypy 0.982 develop
  • mypy-extensions 0.4.3 develop
  • nodeenv 1.7.0 develop
  • packaging 23.0 develop
  • pathspec 0.10.3 develop
  • platformdirs 2.6.2 develop
  • pluggy 1.0.0 develop
  • pre-commit 2.21.0 develop
  • pycodestyle 2.9.1 develop
  • pyflakes 2.5.0 develop
  • pytest 7.2.0 develop
  • pyyaml 6.0 develop
  • tomli 2.0.1 develop
  • virtualenv 20.17.1 develop
  • attrs 22.2.0
  • certifi 2022.12.7
  • charset-normalizer 2.1.1
  • cvxpy 1.3.0
  • ecos 2.0.12
  • h5py 3.7.0
  • idna 3.4
  • importlib-resources 5.10.2
  • joblib 1.2.0
  • jsonschema 4.17.3
  • numpy 1.23.5
  • osqp 0.6.2.post8
  • pandas 1.5.2
  • pkgutil-resolve-name 1.3.10
  • pydantic 1.10.4
  • pydataverse 0.3.1
  • pyrsistent 0.19.3
  • python-dateutil 2.8.2
  • pytz 2022.7
  • qdldl 0.1.5.post2
  • rarfile 4.0
  • requests 2.28.1
  • scikit-learn 1.2.0
  • scipy 1.9.3
  • scs 3.2.2
  • setuptools 64.0.2
  • six 1.16.0
  • threadpoolctl 3.1.0
  • torch 1.11.0
  • types-requests 2.28.11.7
  • types-urllib3 1.26.25.4
  • typing-extensions 4.4.0
  • urllib3 1.26.13
  • zipp 3.11.0
pyproject.toml pypi
  • black ^22.6.0 develop
  • coverage ^6.4.3 develop
  • flake8 ^5.0.4 develop
  • isort ^5.10.1 develop
  • mypy ^0.982 develop
  • pre-commit ^2.20.0 develop
  • pytest ^7.1.2 develop
  • cvxpy ^1.2.1
  • h5py ^3.7.0
  • numpy 1.23.5
  • pandas ^1.4.2
  • pyDataverse ^0.3.1
  • pydantic ^1.9.1
  • python ^3.8
  • rarfile ^4.0
  • requests ^2.28.1
  • scikit-learn ^1.1.1
  • scipy ^1.9.3
  • torch 1.11.0
  • types-requests ^2.28.10