# HWM: Adaptive Hammerstein-Wiener Modeling Toolkit
[![License](https://img.shields.io/badge/license-BSD--3--Clause-blue.svg)](LICENSE)
[![PyPI version](https://badge.fury.io/py/hwm.svg)](https://badge.fury.io/py/hwm)
[![Documentation Status](https://readthedocs.org/projects/hwm/badge/?version=stable)](https://hwm.readthedocs.io/en/stable/)
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 HWClassifier
from hwm.metrics import prediction_stability_score
# Generate synthetic data
X, y = make_classification(n_samples=10000, 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 = HWClassifier(
nonlinear_input_estimator=StandardScaler(),
nonlinear_output_estimator=StandardScaler(),
p=2,
loss="cross_entropy",
max_iter =10
)
# 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"\nPrediction 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": "L.Kouadio",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "etanoyau@gmail.com",
"keywords": "machine learning, dynamic systems, algorithm, time series",
"author": "L.Kouadio",
"author_email": "etanoyau@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/63/4c/2f65d50130523f2e5b7e9dbe228123d427112d42e71fee3f11d1bf707c88/hwm-1.1.4.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://badge.fury.io/py/hwm.svg)](https://badge.fury.io/py/hwm) \r\n[![Documentation Status](https://readthedocs.org/projects/hwm/badge/?version=stable)](https://hwm.readthedocs.io/en/stable/)\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 HWClassifier\r\nfrom hwm.metrics import prediction_stability_score\r\n\r\n# Generate synthetic data\r\nX, y = make_classification(n_samples=10000, 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 = HWClassifier(\r\n nonlinear_input_estimator=StandardScaler(),\r\n nonlinear_output_estimator=StandardScaler(),\r\n p=2,\r\n loss=\"cross_entropy\", \r\n max_iter =10 \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\n\r\nprint(f\"\\nPrediction 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.1.4",
"project_urls": {
"API Documentation": "https://hwm.readthedocs.io/en/stable/api.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/stable/installation.html",
"User guide": "https://hwm.readthedocs.io/en/lateststable/user_guide.html"
},
"split_keywords": [
"machine learning",
" dynamic systems",
" algorithm",
" time series"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b46f86381897424ecbc1d5c9a99b173a8964356d68436e6ea46189f3a7431342",
"md5": "70145b0855826f2b296c6e55026caf7d",
"sha256": "4d763cdca14ec7e3588f6ad9b4a8e570a524d62da23775469b3d761292fc4fcb"
},
"downloads": -1,
"filename": "hwm-1.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "70145b0855826f2b296c6e55026caf7d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 98902,
"upload_time": "2024-11-20T14:43:51",
"upload_time_iso_8601": "2024-11-20T14:43:51.553466Z",
"url": "https://files.pythonhosted.org/packages/b4/6f/86381897424ecbc1d5c9a99b173a8964356d68436e6ea46189f3a7431342/hwm-1.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "634c2f65d50130523f2e5b7e9dbe228123d427112d42e71fee3f11d1bf707c88",
"md5": "5200a4fa5fed0fdbcaa62dbc83850dc5",
"sha256": "65d481821c653baff10c617a5acc0e24c9b30ef1e4a61d211b65078725d98856"
},
"downloads": -1,
"filename": "hwm-1.1.4.tar.gz",
"has_sig": false,
"md5_digest": "5200a4fa5fed0fdbcaa62dbc83850dc5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 100078,
"upload_time": "2024-11-20T14:43:53",
"upload_time_iso_8601": "2024-11-20T14:43:53.803480Z",
"url": "https://files.pythonhosted.org/packages/63/4c/2f65d50130523f2e5b7e9dbe228123d427112d42e71fee3f11d1bf707c88/hwm-1.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-20 14:43:53",
"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"
}