pyoselm


Namepyoselm JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/leferrad/pyoselm
SummaryA Python implementation of Online Sequential Extreme Machine Learning (OS-ELM) for online machine learning
upload_time2025-08-17 20:58:19
maintainerNone
docs_urlNone
authorLeandro Ferrado
requires_python<4.0,>=3.10
licenseApache-2.0
keywords machine learning online learning extreme learning machine elm os-elm neural networks regression classification scikit-learn
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <img style="display: inline;" src="docs/img/pyoselm_logo.png" width="300"/>

*A Python implementation of Online Sequential Extreme Machine Learning (OS-ELM) for online machine learning*

[![CI Pipeline](https://github.com/leferrad/pyoselm/actions/workflows/ci_pipeline.yml/badge.svg)](https://github.com/leferrad/pyoselm/actions/workflows/ci_pipeline.yml)
[![Documentation Status](http://readthedocs.org/projects/pyoselm/badge/?version=latest)](http://pyoselm.readthedocs.io/?badge=latest)
[![Coverage Status](https://codecov.io/gh/leferrad/pyoselm/branch/master/graph/badge.svg)](https://codecov.io/gh/leferrad/pyoselm)

### Description

**pyoselm** is a Python library for machine learning models with Extreme Machine Learning (ELM) and Online Sequential Machine Learning (OS-ELM). It allows to fit models for regression and classification tasks, both in batch and online learning (either row-by-row or chunk-by-chunk).

This library offers a scikit-learn like API for easy usage. For more details about setup and usage, check the [documentation](http://readthedocs.org/projects/pyoselm/).

> **IMPORTANT:** This library was developed as a research project. It may not be production-ready, so please be aware of that.

### Setup

The easiest way to install this library is using `pip`:

```
$ pip install pyoselm
```

### Usage

Here a simple but complete example of usage.

```python
from pyoselm import OSELMRegressor, OSELMClassifier
from sklearn.datasets import load_digits, make_regression 
from sklearn.model_selection import train_test_split

print("Regression task")
# Model
oselmr = OSELMRegressor(n_hidden=20, activation_func='sigmoid', random_state=123)
# Data
X, y = make_regression(n_samples=1000, n_targets=1, n_features=10, random_state=123)   
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=123)
n_batch = 40

# Fit model with chunks of data
for i in range(20):
    X_batch = X_train[i*n_batch:(i+1)*n_batch]
    y_batch = y_train[i*n_batch:(i+1)*n_batch]
    oselmr.fit(X_batch, y_batch)
    print("Train score for batch %i: %s" % (i+1, str(oselmr.score(X_batch, y_batch))))

# Results
print("Train score of total: %s" % str(oselmr.score(X_train, y_train)))
print("Test score of total: %s" % str(oselmr.score(X_test, y_test)))  
print("")


print("Classification task")
# Model 
oselmc = OSELMClassifier(n_hidden=20, activation_func='sigmoid', random_state=123)
# Data
X, y = load_digits(n_class=5, return_X_y=True) 
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=123)

# Sequential learning
# The first batch of data must have the same size as n_hidden to achieve the first phase (boosting)
batches_x = [X_train[:oselmc.n_hidden]] + [[x_i] for x_i in X_train[oselmc.n_hidden:]]
batches_y = [y_train[:oselmc.n_hidden]] + [[y_i] for y_i in y_train[oselmc.n_hidden:]]

for b_x, b_y in zip(batches_x, batches_y):
    oselmc.fit(b_x, b_y)

print("Train score of total: %s" % str(oselmc.score(X_train, y_train)))
print("Test score of total: %s" % str(oselmc.score(X_test, y_test)))
```

### Development

For development, this project uses [Poetry](https://python-poetry.org/) for dependency management:

```bash
# Install Poetry
curl -sSL https://install.python-poetry.org | python3 -

# Install dependencies
poetry install

# Activate environment
poetry shell

# Run tests
make test           # Unit tests
make test-system    # System tests

# Check code quality
make lint
```

### License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/leferrad/pyoselm",
    "name": "pyoselm",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "machine learning, online learning, extreme learning machine, ELM, OS-ELM, neural networks, regression, classification, scikit-learn",
    "author": "Leandro Ferrado",
    "author_email": "leferrad@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d2/99/8b37da76daf90f975124b176cd669ce852a51fbaa086825f2a614737eb4b/pyoselm-1.2.0.tar.gz",
    "platform": null,
    "description": "<img style=\"display: inline;\" src=\"docs/img/pyoselm_logo.png\" width=\"300\"/>\n\n*A Python implementation of Online Sequential Extreme Machine Learning (OS-ELM) for online machine learning*\n\n[![CI Pipeline](https://github.com/leferrad/pyoselm/actions/workflows/ci_pipeline.yml/badge.svg)](https://github.com/leferrad/pyoselm/actions/workflows/ci_pipeline.yml)\n[![Documentation Status](http://readthedocs.org/projects/pyoselm/badge/?version=latest)](http://pyoselm.readthedocs.io/?badge=latest)\n[![Coverage Status](https://codecov.io/gh/leferrad/pyoselm/branch/master/graph/badge.svg)](https://codecov.io/gh/leferrad/pyoselm)\n\n### Description\n\n**pyoselm** is a Python library for machine learning models with Extreme Machine Learning (ELM) and Online Sequential Machine Learning (OS-ELM). It allows to fit models for regression and classification tasks, both in batch and online learning (either row-by-row or chunk-by-chunk).\n\nThis library offers a scikit-learn like API for easy usage. For more details about setup and usage, check the [documentation](http://readthedocs.org/projects/pyoselm/).\n\n> **IMPORTANT:** This library was developed as a research project. It may not be production-ready, so please be aware of that.\n\n### Setup\n\nThe easiest way to install this library is using `pip`:\n\n```\n$ pip install pyoselm\n```\n\n### Usage\n\nHere a simple but complete example of usage.\n\n```python\nfrom pyoselm import OSELMRegressor, OSELMClassifier\nfrom sklearn.datasets import load_digits, make_regression \nfrom sklearn.model_selection import train_test_split\n\nprint(\"Regression task\")\n# Model\noselmr = OSELMRegressor(n_hidden=20, activation_func='sigmoid', random_state=123)\n# Data\nX, y = make_regression(n_samples=1000, n_targets=1, n_features=10, random_state=123)   \nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=123)\nn_batch = 40\n\n# Fit model with chunks of data\nfor i in range(20):\n    X_batch = X_train[i*n_batch:(i+1)*n_batch]\n    y_batch = y_train[i*n_batch:(i+1)*n_batch]\n    oselmr.fit(X_batch, y_batch)\n    print(\"Train score for batch %i: %s\" % (i+1, str(oselmr.score(X_batch, y_batch))))\n\n# Results\nprint(\"Train score of total: %s\" % str(oselmr.score(X_train, y_train)))\nprint(\"Test score of total: %s\" % str(oselmr.score(X_test, y_test)))  \nprint(\"\")\n\n\nprint(\"Classification task\")\n# Model \noselmc = OSELMClassifier(n_hidden=20, activation_func='sigmoid', random_state=123)\n# Data\nX, y = load_digits(n_class=5, return_X_y=True) \nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=123)\n\n# Sequential learning\n# The first batch of data must have the same size as n_hidden to achieve the first phase (boosting)\nbatches_x = [X_train[:oselmc.n_hidden]] + [[x_i] for x_i in X_train[oselmc.n_hidden:]]\nbatches_y = [y_train[:oselmc.n_hidden]] + [[y_i] for y_i in y_train[oselmc.n_hidden:]]\n\nfor b_x, b_y in zip(batches_x, batches_y):\n    oselmc.fit(b_x, b_y)\n\nprint(\"Train score of total: %s\" % str(oselmc.score(X_train, y_train)))\nprint(\"Test score of total: %s\" % str(oselmc.score(X_test, y_test)))\n```\n\n### Development\n\nFor development, this project uses [Poetry](https://python-poetry.org/) for dependency management:\n\n```bash\n# Install Poetry\ncurl -sSL https://install.python-poetry.org | python3 -\n\n# Install dependencies\npoetry install\n\n# Activate environment\npoetry shell\n\n# Run tests\nmake test           # Unit tests\nmake test-system    # System tests\n\n# Check code quality\nmake lint\n```\n\n### License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A Python implementation of Online Sequential Extreme Machine Learning (OS-ELM) for online machine learning",
    "version": "1.2.0",
    "project_urls": {
        "Documentation": "http://pyoselm.readthedocs.io/",
        "Homepage": "https://github.com/leferrad/pyoselm",
        "Repository": "https://github.com/leferrad/pyoselm"
    },
    "split_keywords": [
        "machine learning",
        " online learning",
        " extreme learning machine",
        " elm",
        " os-elm",
        " neural networks",
        " regression",
        " classification",
        " scikit-learn"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a2ed7818fa4ac62d38d7585d29ea2fb35e5a0263369a312b0bdd863015ebc59d",
                "md5": "83b502e4dbb65bce597f395732d9a918",
                "sha256": "f63696915d8ab5f437ab4c5388e0d71e28d9a51089cd9147239db8b86a386166"
            },
            "downloads": -1,
            "filename": "pyoselm-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "83b502e4dbb65bce597f395732d9a918",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 19079,
            "upload_time": "2025-08-17T20:58:18",
            "upload_time_iso_8601": "2025-08-17T20:58:18.230592Z",
            "url": "https://files.pythonhosted.org/packages/a2/ed/7818fa4ac62d38d7585d29ea2fb35e5a0263369a312b0bdd863015ebc59d/pyoselm-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d2998b37da76daf90f975124b176cd669ce852a51fbaa086825f2a614737eb4b",
                "md5": "d038d8b227257d983ec52c94f7d7df59",
                "sha256": "4eb8079bdd07359cde432f6e1fa34ae1f7f5f8cd2aa118dbf2ded8efb6fd47df"
            },
            "downloads": -1,
            "filename": "pyoselm-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d038d8b227257d983ec52c94f7d7df59",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 17448,
            "upload_time": "2025-08-17T20:58:19",
            "upload_time_iso_8601": "2025-08-17T20:58:19.607003Z",
            "url": "https://files.pythonhosted.org/packages/d2/99/8b37da76daf90f975124b176cd669ce852a51fbaa086825f2a614737eb4b/pyoselm-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-17 20:58:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "leferrad",
    "github_project": "pyoselm",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pyoselm"
}
        
Elapsed time: 0.51887s