# HWM: Adaptive Hammerstein-Wiener Modeling Toolkit
[![License](https://img.shields.io/badge/license-BSD--3--Clause-blue.svg)](LICENSE)
[![PyPI version](https://img.shields.io/pypi/v/hwm.svg)](https://pypi.org/project/hwm/)
[![Documentation Status](https://readthedocs.org/projects/hwm/badge/?version=latest)](https://hwm.readthedocs.io/en/latest/)
HWM is a **Python toolkit for adaptive dynamic system modeling**, designed to capture complex nonlinear and linear relationships in data through the Hammerstein-Wiener architecture. With a flexible, modular design, HWM integrates seamlessly with [Scikit-learn](https://scikit-learn.org/), enabling streamlined workflows for regression, classification, and time-series forecasting tasks.
## 🚀 Key Features
- **Adaptive Hammerstein-Wiener Models**: Supports both regression and classification with customizable nonlinear and dynamic components.
- **Time-Series and Dynamic System Modeling**: Tools for handling sequence-based and time-dependent data.
- **Scikit-Learn Compatible API**: Designed to integrate easily with Scikit-learn workflows.
- **Flexible Metrics and Utilities**: Custom metrics like `prediction_stability_score` and `twa_score` for model evaluation, along with data handling utilities.
## 📦 Installation
HWM requires **Python 3.9** or later. Install it from [PyPI](https://pypi.org/project/hwm/) using `pip`:
```bash
pip install hwm
```
For detailed installation instructions, refer to the [Installation Guide](https://hwm.readthedocs.io/en/latest/installation.html).
## 🏁 Getting Started
### 🔍 Example: Classification with Hammerstein-Wiener Model
```python
import numpy as np
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from hwm.estimators import HammersteinWienerClassifier
from hwm.metrics import prediction_stability_score
# Generate synthetic data
X, y = make_classification(n_samples=1000, n_features=20)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
# Initialize the model
hw_model = HammersteinWienerClassifier(
nonlinear_input_estimator=StandardScaler(),
nonlinear_output_estimator=StandardScaler(),
p=2,
loss="cross_entropy"
)
# Train and evaluate
hw_model.fit(X_train, y_train)
y_pred = hw_model.predict(X_test)
stability_score = prediction_stability_score(y_pred)
print(f"Prediction Stability Score: {stability_score:.4f}")
```
For more usage examples, see the [Examples Page](https://hwm.readthedocs.io/en/latest/examples.html).
## 📖 Documentation
Comprehensive documentation is available on [Read the Docs](https://hwm.readthedocs.io). Key sections include:
- [API Documentation](https://hwm.readthedocs.io/en/latest/api.html): Detailed reference for all modules and functions.
- [User Guide](https://hwm.readthedocs.io/en/latest/user_guide.html): Step-by-step guidance for using HWM.
- [Installation Guide](https://hwm.readthedocs.io/en/latest/installation.html): Complete installation instructions.
## 🔗 Project Links
- **Documentation**: [hwm.readthedocs.io](https://hwm.readthedocs.io)
- **Source Code**: [GitHub Repository](https://github.com/earthai-tech/hwm)
- **Issue Tracker**: [GitHub Issues](https://github.com/earthai-tech/hwm/issues)
- **Download**: [PyPI Downloads](https://pypi.org/project/hwm/#files)
## 🤝 Contributing
We welcome contributions! Please submit issues or pull requests via our [GitHub repository](https://github.com/earthai-tech/hwm). For major changes, discuss your ideas in the issues section first to align with project goals.
## 👨💼 Maintainers
- **Laurent Kouadio**
- Email: [etanoyau@gmail.com](mailto:etanoyau@gmail.com)
## 📝 License
HWM is licensed under the BSD-3-Clause license. See the [LICENSE](LICENSE) file for details.
## 🏷️ Keywords
`machine learning`, `dynamic systems`, `regression`,
`classification`, `time-series`, `Scikit-learn compatible`
---
For additional resources, visit the [User Guide](https://hwm.readthedocs.io/en/latest/user_guide.html) and explore our rich tools for dynamic system modeling and time-series analysis. A practical [example of network intrusion detection](https://github.com/earthai-tech/hwm/blob/main/examples/detailed_hwm_vs_lstm.ipynb) is the use of [KDD Cup 1999](https://kdd.ics.uci.edu/databases/kddcup99/kddcup99.html) dataset.
Raw data
{
"_id": null,
"home_page": "https://github.com/earthai-tech/hwm",
"name": "hwm",
"maintainer": "Laurent Kouadio",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "etanoyau@gmail.com",
"keywords": "machine learning, dynamic systems, algorithm, time series, Scikit-learn compatible",
"author": "Laurent Kouadio",
"author_email": "etanoyau@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b4/f9/b6bc4b6c0feb30c9e4a009096710998e6ac272ac1d383b41b37ccf793802/hwm-1.0.1.tar.gz",
"platform": null,
"description": "# HWM: Adaptive Hammerstein-Wiener Modeling Toolkit\r\n\r\n[![License](https://img.shields.io/badge/license-BSD--3--Clause-blue.svg)](LICENSE) \r\n[![PyPI version](https://img.shields.io/pypi/v/hwm.svg)](https://pypi.org/project/hwm/) \r\n[![Documentation Status](https://readthedocs.org/projects/hwm/badge/?version=latest)](https://hwm.readthedocs.io/en/latest/)\r\n\r\nHWM is a **Python toolkit for adaptive dynamic system modeling**, designed to capture complex nonlinear and linear relationships in data through the Hammerstein-Wiener architecture. With a flexible, modular design, HWM integrates seamlessly with [Scikit-learn](https://scikit-learn.org/), enabling streamlined workflows for regression, classification, and time-series forecasting tasks.\r\n\r\n## \ud83d\ude80 Key Features\r\n\r\n- **Adaptive Hammerstein-Wiener Models**: Supports both regression and classification with customizable nonlinear and dynamic components.\r\n- **Time-Series and Dynamic System Modeling**: Tools for handling sequence-based and time-dependent data.\r\n- **Scikit-Learn Compatible API**: Designed to integrate easily with Scikit-learn workflows.\r\n- **Flexible Metrics and Utilities**: Custom metrics like `prediction_stability_score` and `twa_score` for model evaluation, along with data handling utilities.\r\n\r\n## \ud83d\udce6 Installation\r\n\r\nHWM requires **Python 3.9** or later. Install it from [PyPI](https://pypi.org/project/hwm/) using `pip`:\r\n\r\n```bash\r\npip install hwm\r\n```\r\n\r\nFor detailed installation instructions, refer to the [Installation Guide](https://hwm.readthedocs.io/en/latest/installation.html).\r\n\r\n## \ud83c\udfc1 Getting Started\r\n\r\n### \ud83d\udd0d Example: Classification with Hammerstein-Wiener Model\r\n\r\n```python\r\nimport numpy as np\r\nfrom sklearn.datasets import make_classification\r\nfrom sklearn.model_selection import train_test_split\r\nfrom sklearn.preprocessing import StandardScaler\r\nfrom hwm.estimators import HammersteinWienerClassifier\r\nfrom hwm.metrics import prediction_stability_score\r\n\r\n# Generate synthetic data\r\nX, y = make_classification(n_samples=1000, n_features=20)\r\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)\r\n\r\n# Initialize the model\r\nhw_model = HammersteinWienerClassifier(\r\n nonlinear_input_estimator=StandardScaler(),\r\n nonlinear_output_estimator=StandardScaler(),\r\n p=2,\r\n loss=\"cross_entropy\"\r\n)\r\n\r\n# Train and evaluate\r\nhw_model.fit(X_train, y_train)\r\ny_pred = hw_model.predict(X_test)\r\nstability_score = prediction_stability_score(y_pred)\r\nprint(f\"Prediction Stability Score: {stability_score:.4f}\")\r\n```\r\n\r\nFor more usage examples, see the [Examples Page](https://hwm.readthedocs.io/en/latest/examples.html).\r\n\r\n## \ud83d\udcd6 Documentation\r\n\r\nComprehensive documentation is available on [Read the Docs](https://hwm.readthedocs.io). Key sections include:\r\n\r\n- [API Documentation](https://hwm.readthedocs.io/en/latest/api.html): Detailed reference for all modules and functions.\r\n- [User Guide](https://hwm.readthedocs.io/en/latest/user_guide.html): Step-by-step guidance for using HWM.\r\n- [Installation Guide](https://hwm.readthedocs.io/en/latest/installation.html): Complete installation instructions.\r\n\r\n## \ud83d\udd17 Project Links\r\n\r\n- **Documentation**: [hwm.readthedocs.io](https://hwm.readthedocs.io)\r\n- **Source Code**: [GitHub Repository](https://github.com/earthai-tech/hwm)\r\n- **Issue Tracker**: [GitHub Issues](https://github.com/earthai-tech/hwm/issues)\r\n- **Download**: [PyPI Downloads](https://pypi.org/project/hwm/#files)\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nWe welcome contributions! Please submit issues or pull requests via our [GitHub repository](https://github.com/earthai-tech/hwm). For major changes, discuss your ideas in the issues section first to align with project goals.\r\n\r\n## \ud83d\udc68\u200d\ud83d\udcbc Maintainers\r\n\r\n- **Laurent Kouadio** \r\n - Email: [etanoyau@gmail.com](mailto:etanoyau@gmail.com) \r\n\r\n## \ud83d\udcdd License\r\n\r\nHWM is licensed under the BSD-3-Clause license. See the [LICENSE](LICENSE) file for details.\r\n\r\n## \ud83c\udff7\ufe0f Keywords\r\n\r\n`machine learning`, `dynamic systems`, `regression`, \r\n`classification`, `time-series`, `Scikit-learn compatible`\r\n\r\n---\r\n\r\nFor additional resources, visit the [User Guide](https://hwm.readthedocs.io/en/latest/user_guide.html) and explore our rich tools for dynamic system modeling and time-series analysis. A practical [example of network intrusion detection](https://github.com/earthai-tech/hwm/blob/main/examples/detailed_hwm_vs_lstm.ipynb) is the use of [KDD Cup 1999](https://kdd.ics.uci.edu/databases/kddcup99/kddcup99.html) dataset.\r\n\r\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Adaptive Hammerstein-Wiener Modeling Toolkit",
"version": "1.0.1",
"project_urls": {
"API Documentation": "https://hwm.readthedocs.io/en/latest/api_references.html",
"Bugs tracker": "https://github.com/earthai-tech/hwm/issues",
"Download": "https://pypi.org/project/hwm/#files",
"Home page": "https://hwm.readthedocs.io",
"Homepage": "https://github.com/earthai-tech/hwm",
"Installation guide": "https://hwm.readthedocs.io/en/latest/installation.html",
"User guide": "https://hwm.readthedocs.io/en/latest/user_guide.html"
},
"split_keywords": [
"machine learning",
" dynamic systems",
" algorithm",
" time series",
" scikit-learn compatible"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ea0d98f7df587808a7cd9c41bbddabdcc7618a5b7b9fcdb2707d348a1943393e",
"md5": "047371c4f68b46e6d73ec2635e12141c",
"sha256": "61ce2060dda2801867f9e36c8faae9afd54a045dc4a5b5838c6533154227f439"
},
"downloads": -1,
"filename": "hwm-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "047371c4f68b46e6d73ec2635e12141c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 87710,
"upload_time": "2024-11-10T06:31:15",
"upload_time_iso_8601": "2024-11-10T06:31:15.646408Z",
"url": "https://files.pythonhosted.org/packages/ea/0d/98f7df587808a7cd9c41bbddabdcc7618a5b7b9fcdb2707d348a1943393e/hwm-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b4f9b6bc4b6c0feb30c9e4a009096710998e6ac272ac1d383b41b37ccf793802",
"md5": "da48e0c04d7104535c5391f3430e5ae6",
"sha256": "5f09159edf703390f4d3110d4737b2f2c47754a8bf11c2b0993e67270773f8c8"
},
"downloads": -1,
"filename": "hwm-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "da48e0c04d7104535c5391f3430e5ae6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 89200,
"upload_time": "2024-11-10T06:31:17",
"upload_time_iso_8601": "2024-11-10T06:31:17.709357Z",
"url": "https://files.pythonhosted.org/packages/b4/f9/b6bc4b6c0feb30c9e4a009096710998e6ac272ac1d383b41b37ccf793802/hwm-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-10 06:31:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "earthai-tech",
"github_project": "hwm",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "hwm"
}