Skip to main content

HiMAP: Hidden Markov models for Advanced Prognostics!

Project description

HiMAP: Hidden Markov models for Advanced Prognostics

HiMAP is a Python package for implementing hidden Markov Models (HMMs) and hidden semi-Markov Models (HSMMs) tailored for prognostic applications. It provides a probabilistic framework for predicting Remaining Useful Life (RUL) and modeling complex degradation processes without requiring labeled datasets.

Table of Contents

Requirements

[!WARNING] A C++ compiler is required to build the .pyx files.

Windows users:

Microsoft Visual C/C++ (MSVC) 14.0 or higher is required to build the .pyx files.

https://visualstudio.microsoft.com/visual-cpp-build-tools/

(Download Build Tool - After Visual Studio Installer is ready, choose Desktop development with C++)

Linux users:

The GNU C Compiler (gcc) is usually present. Next to a C compiler, Cython requires the Python header files. On Ubuntu or Debian run the following command:

sudo apt-get install build-essential python3-dev

[!Note] For more information refer to the Cython package documentation:

https://cython.readthedocs.io/en/latest/src/quickstart/install.html

Installation

You can install HiMAP in two ways:

Option 1: Install via pip

The easiest way to install HiMAP is through pip. Simply run the following command:

pip install himap

[!Note] To install the package, you need Python>=3.9

Option 2: Install from Source Code

If you prefer to install HiMAP directly from the source, follow these steps:

  1. Create a virtual environment and activate it. (This example will be demonstrated with Anaconda, but it is not required.)

Step 1a

conda create -n himap_env python=3.12

Step 1b

conda activate himap_env
  1. This repository can be directly pulled through GitHub by the following commands:

Step 2a

conda install git

Step 2b

git clone https://github.com/GroupiSP/himap.git

Step 2c

cd himap
  1. The dependencies can be installed using the requirements.txt file
pip install -r requirements.txt
  1. To compile the Cython code, run the following commands:
python setup_cython.py build_ext --inplace

[!Note] For detailed usage instructions, guides, and API references, please visit our comprehensive documentation: Read the docs

Structure

../root/
      └── LICENSE
      └── README.md
      └── requirements.txt
      └── ...

    
      ├── himap/                                                        -- Required
          └── ab.py                                                     -- Required
          └── base.py                                                   -- Required
          └── main.py                                                   -- Required
          └── plot.py                                                   -- Required
          └── smoothed.pyd                                              -- Required
          └── utils.py                                                  -- Required
          
          ├── cython_build/                                             -- Required
              └── __init__.py                                           -- Required      
              └── fwd_bwd.pyx                                           -- Required
              └── setup.py                                              -- Required


          ├── example_data/                                             -- Required      
              └── test_FD001_disc_20_mod.csv                            -- Required
              └── train_FD001_disc_20_mod.csv                           -- Required

          ├── results/                                                  -- Automatically generated      
              ├── dictionaries                                          -- Automatically generated
              ├── figures/                                              -- Automatically generated
              ├── models/                                               -- Automatically generated

Example

Run from the rebuild repo

To describe how to train and use the HMM and HSMM models, we show an example below. To run the code from the terminal with default values, use the following command from the root directory of the repository:

python -m himap.main

This runs the HMM model for the C-MAPSS dataset by default and fits the best model utilizing the Bayesian Information Criterion.

If you want to fit the HSMM model to the C-MAPSS data run the command:

python -m himap.main --hsmm True 

If you want to run the example utilizing Monte Carlo Sampling generated data run the command:

python -m himap.main --mc_sampling True

See the main.py file for different existing variables and options.

Run from the installed package

The example can be also run via the distribution. After installing the package in the virtual environment you can run

python -m himap.main

and use the same arguments as previously for the different example options.

Results

The results are saved inside the directory root/himap/results/

Contributors

License

As of v1.1.0 (2025-08-25), HiMAP is licensed under the Apache License 2.0. Prior releases remain under their original licenses.

See LICENSE and NOTICE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

himap-1.3.0.tar.gz (315.8 kB view details)

Uploaded Source

File details

Details for the file himap-1.3.0.tar.gz.

File metadata

  • Download URL: himap-1.3.0.tar.gz
  • Upload date:
  • Size: 315.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for himap-1.3.0.tar.gz
Algorithm Hash digest
SHA256 ed9b4129734deb7db6f93c6dcc9b9d72395cbe394e211b74005d4b9025dcea0c
MD5 b2cd6614cffa04ae7e198cb3d8238942
BLAKE2b-256 25be6d0bef4308bd6eafeaad3b5b80d6e13d751bf3c57e2e510a11d773172ef1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page