iOpt


NameiOpt JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/aimclub/iOpt
SummaryFramework for automatically tuning hyperparameter values for mathematical models, AI and ML.
upload_time2024-03-22 16:23:18
maintainerNone
docs_urlNone
authorUNN Team
requires_python>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <img src="/docs/iOpt_logo.png" width="200" height="150"/>
</p>

[![SAI](https://github.com/ITMO-NSS-team/open-source-ops/blob/master/badges/SAI_badge_flat.svg)](https://sai.itmo.ru/)
[![ITMO](https://github.com/ITMO-NSS-team/open-source-ops/blob/master/badges/ITMO_badge_flat.svg)](https://en.itmo.ru/en/)

[![License: BSD 3-Clause](https://img.shields.io/badge/License-BSD%203--Clause-green)](LICENSE)
[![python: 3.9](https://img.shields.io/badge/python-3.9-44cc12?style=flat-square&logo=python)](https://www.python.org/downloads/release/python-390/)
[![python: 3.8](https://img.shields.io/badge/python-3.8-44cc12?style=flat-square&logo=python)](https://www.python.org/downloads/release/python-380/)
[![docs: ](https://readthedocs.org/projects/ebonite/badge/?style=flat-square)](https://iopt.readthedocs.io/ru/latest/)
[![build:](https://github.com/UNN-ITMM-Software/iOpt/actions/workflows/python-app.yml/badge.svg)](https://github.com/UNN-ITMM-Software/iOpt/actions)
[![rus:](https://img.shields.io/badge/lang-ru-yellow.svg)](README_ru.md)



iOpt is an open source framework for automatic selection of parameter values both for mathematical models of complex industrial processes and for AI and ML methods used in industry. The framework is distributed under the 3-Clause BSD license.


# **Key features of the framework**
- Automatic selection of parameter values both for mathematical models and for AI and ML methods used in industry.
- Intelligent control of the process of choosing the optimal parameters for industrial applications.
- Integration with external artificial intelligence and machine learning libraries or frameworks as well as applied models.
- Automation of the preliminary analysis of the models under study, e.g., by identifying different types of model dependencies on different groups of parameters.
- Visualization of the process of choosing optimal parameters.


# **Installation**



## Automatic installation

The simplest way to install **iOpt** is using *pip*:

```
pip install iOpt
``` 

## Manual installation

### On Unix-like systems:

```
git clone https://github.com/aimclub/iOpt
cd iOpt
pip install virtualenv
virtualenv ioptenv
source ioptenv/bin/activate
python setup.py install
```

### On Windows:

```
git clone https://github.com/aimclub/iOpt
cd iOpt
pip install virtualenv
virtualenv ioptenv
ioptenv\Scripts\activate.bat
python setup.py install
```
## Docker

Download the image:

```
docker pull aimclub/iopt:latest
```

Using the iOpt image:

```
docker run -it aimclub/iopt:latest
```


# **How to Use**

Using the iOpt framework to minimize the Rastrigin test function.

```python
from problems.rastrigin import Rastrigin
from iOpt.solver import Solver
from iOpt.solver_parametrs import SolverParameters
from iOpt.output_system.listeners.static_painters import StaticPainterNDListener
from iOpt.output_system.listeners.console_outputers import ConsoleOutputListener

from subprocess import Popen, PIPE, STDOUT

if __name__ == "__main__":
    """
    Minimization of the Rastrigin test function with visualization
    """
    # Create a test task
    problem = Rastrigin(2)
    # Setup a solver options
    params = SolverParameters(r=2.5, eps=0.01, iters_limit=300, refine_solution=True)
    # Create the solver
    solver = Solver(problem, parameters=params)
    # Print results to console while solving
    cfol = ConsoleOutputListener(mode='full')
    solver.add_listener(cfol)
    # 3D visualization at the end of the solution
    spl = StaticPainterNDListener("rastrigin.png", "output", vars_indxs=[0, 1], mode="surface", calc="interpolation")
    solver.add_listener(spl)
    # Run problem solution
    sol = solver.solve()
```

# **Examples**

Let’s demonstrate the use of the iOpt framework when tuning the hyperparameters of one of the machine learning methods. In the support vector machine ([SVC](https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html)), we find the optimal hyperparameters (the regularization parameter **C**, the kernel coefficient **gamma**) in the problem of breast cancer classification ([detailed description of the data](https://archive.ics.uci.edu/ml/datasets/Breast+Cancer+Wisconsin+(Diagnostic))).

```python
import numpy as np
from sklearn.utils import shuffle
from sklearn.datasets import load_breast_cancer

from iOpt.output_system.listeners.static_painters import StaticPainterNDListener
from iOpt.output_system.listeners.animate_painters import AnimatePainterNDListener
from iOpt.output_system.listeners.console_outputers import ConsoleOutputListener
from iOpt.solver import Solver
from iOpt.solver_parametrs import SolverParameters
from examples.Machine_learning.SVC._2D.Problems import SVC_2d


def load_breast_cancer_data():
    dataset = load_breast_cancer()
    x_raw, y_raw = dataset['data'], dataset['target']
    inputs, outputs = shuffle(x_raw, y_raw ^ 1, random_state=42)
    return inputs, outputs


if __name__ == "__main__":
    x, y = load_breast_cancer_data()
    regularization_value_bound = {'low': 1, 'up': 6}
    kernel_coefficient_bound = {'low': -7, 'up': -3}

    problem = SVC_2d.SVC_2D(x, y, regularization_value_bound, kernel_coefficient_bound)

    method_params = SolverParameters(r=np.double(3.0), iters_limit=100)
    solver = Solver(problem, parameters=method_params)

    apl = AnimatePainterNDListener("svc2d_anim.png", "output", vars_indxs=[0, 1], to_paint_obj_func=False)
    solver.add_listener(apl)

    spl = StaticPainterNDListener("svc2d_stat.png", "output", vars_indxs=[0, 1], mode="surface", calc="interpolation")
    solver.add_listener(spl)

    cfol = ConsoleOutputListener(mode='full')
    solver.add_listener(cfol)

    solver_info = solver.solve()

```

# **Project Structure**

The latest stable release of iOpt is in the [main](https://github.com/UNN-ITMM-Software/iOpt/tree/main) branch. The repository includes the following directories:
- The [iOpt](https://github.com/UNN-ITMM-Software/iOpt/tree/main/iOpt) directory contains the framework core in the form of Python classes.
- The [examples](https://github.com/UNN-ITMM-Software/iOpt/tree/main/examples) directory contains examples of using the framework for both test and applied problems.
- Unit tests are located in the [test](https://github.com/UNN-ITMM-Software/iOpt/tree/main/test) directory.
- Documentation source files are located in the [docs](https://github.com/UNN-ITMM-Software/iOpt/tree/main/docs) directory.

# **Documentation**

A detailed description of the iOpt framework API is available at [Read the Docs](https://iopt.readthedocs.io/ru/latest/).

# **Supported by**

The study is supported by the [Research Center Strong Artificial Intelligence in Industry](https://sai.itmo.ru/) 
of [ITMO University](https://en.itmo.ru/) as part of the plan of the center's program: Framework of intelligent heuristic optimization methods.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/aimclub/iOpt",
    "name": "iOpt",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "UNN Team",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/b6/fb/b8fe37553d1bf6c7d2ba537ea20ac2539811258e919599ca3cc62ed4379f/iOpt-0.4.0.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n  <img src=\"/docs/iOpt_logo.png\" width=\"200\" height=\"150\"/>\n</p>\n\n[![SAI](https://github.com/ITMO-NSS-team/open-source-ops/blob/master/badges/SAI_badge_flat.svg)](https://sai.itmo.ru/)\n[![ITMO](https://github.com/ITMO-NSS-team/open-source-ops/blob/master/badges/ITMO_badge_flat.svg)](https://en.itmo.ru/en/)\n\n[![License: BSD 3-Clause](https://img.shields.io/badge/License-BSD%203--Clause-green)](LICENSE)\n[![python: 3.9](https://img.shields.io/badge/python-3.9-44cc12?style=flat-square&logo=python)](https://www.python.org/downloads/release/python-390/)\n[![python: 3.8](https://img.shields.io/badge/python-3.8-44cc12?style=flat-square&logo=python)](https://www.python.org/downloads/release/python-380/)\n[![docs: ](https://readthedocs.org/projects/ebonite/badge/?style=flat-square)](https://iopt.readthedocs.io/ru/latest/)\n[![build:](https://github.com/UNN-ITMM-Software/iOpt/actions/workflows/python-app.yml/badge.svg)](https://github.com/UNN-ITMM-Software/iOpt/actions)\n[![rus:](https://img.shields.io/badge/lang-ru-yellow.svg)](README_ru.md)\n\n\n\niOpt is an open source framework for automatic selection of parameter values both for mathematical models of complex industrial processes and for AI and ML methods used in industry. The framework is distributed under the 3-Clause BSD license.\n\n\n# **Key features of the framework**\n- Automatic selection of parameter values both for mathematical models and for AI and ML methods used in industry.\n- Intelligent control of the process of choosing the optimal parameters for industrial applications.\n- Integration with external artificial intelligence and machine learning libraries or frameworks as well as applied models.\n- Automation of the preliminary analysis of the models under study, e.g., by identifying different types of model dependencies on different groups of parameters.\n- Visualization of the process of choosing optimal parameters.\n\n\n# **Installation**\n\n\n\n## Automatic installation\n\nThe simplest way to install **iOpt** is using *pip*:\n\n```\npip install iOpt\n``` \n\n## Manual installation\n\n### On Unix-like systems:\n\n```\ngit clone https://github.com/aimclub/iOpt\ncd iOpt\npip install virtualenv\nvirtualenv ioptenv\nsource ioptenv/bin/activate\npython setup.py install\n```\n\n### On Windows:\n\n```\ngit clone https://github.com/aimclub/iOpt\ncd iOpt\npip install virtualenv\nvirtualenv ioptenv\nioptenv\\Scripts\\activate.bat\npython setup.py install\n```\n## Docker\n\nDownload the image:\n\n```\ndocker pull aimclub/iopt:latest\n```\n\nUsing the iOpt image:\n\n```\ndocker run -it aimclub/iopt:latest\n```\n\n\n# **How to Use**\n\nUsing the iOpt framework to minimize the Rastrigin test function.\n\n```python\nfrom problems.rastrigin import Rastrigin\nfrom iOpt.solver import Solver\nfrom iOpt.solver_parametrs import SolverParameters\nfrom iOpt.output_system.listeners.static_painters import StaticPainterNDListener\nfrom iOpt.output_system.listeners.console_outputers import ConsoleOutputListener\n\nfrom subprocess import Popen, PIPE, STDOUT\n\nif __name__ == \"__main__\":\n    \"\"\"\n    Minimization of the Rastrigin test function with visualization\n    \"\"\"\n    # Create a test task\n    problem = Rastrigin(2)\n    # Setup a solver options\n    params = SolverParameters(r=2.5, eps=0.01, iters_limit=300, refine_solution=True)\n    # Create the solver\n    solver = Solver(problem, parameters=params)\n    # Print results to console while solving\n    cfol = ConsoleOutputListener(mode='full')\n    solver.add_listener(cfol)\n    # 3D visualization at the end of the solution\n    spl = StaticPainterNDListener(\"rastrigin.png\", \"output\", vars_indxs=[0, 1], mode=\"surface\", calc=\"interpolation\")\n    solver.add_listener(spl)\n    # Run problem solution\n    sol = solver.solve()\n```\n\n# **Examples**\n\nLet\u2019s demonstrate the use of the iOpt framework when tuning the hyperparameters of one of the machine learning methods. In the support vector machine ([SVC](https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html)), we find the optimal hyperparameters (the regularization parameter **C**, the kernel coefficient **gamma**) in the problem of breast cancer classification ([detailed description of the data](https://archive.ics.uci.edu/ml/datasets/Breast+Cancer+Wisconsin+(Diagnostic))).\n\n```python\nimport numpy as np\nfrom sklearn.utils import shuffle\nfrom sklearn.datasets import load_breast_cancer\n\nfrom iOpt.output_system.listeners.static_painters import StaticPainterNDListener\nfrom iOpt.output_system.listeners.animate_painters import AnimatePainterNDListener\nfrom iOpt.output_system.listeners.console_outputers import ConsoleOutputListener\nfrom iOpt.solver import Solver\nfrom iOpt.solver_parametrs import SolverParameters\nfrom examples.Machine_learning.SVC._2D.Problems import SVC_2d\n\n\ndef load_breast_cancer_data():\n    dataset = load_breast_cancer()\n    x_raw, y_raw = dataset['data'], dataset['target']\n    inputs, outputs = shuffle(x_raw, y_raw ^ 1, random_state=42)\n    return inputs, outputs\n\n\nif __name__ == \"__main__\":\n    x, y = load_breast_cancer_data()\n    regularization_value_bound = {'low': 1, 'up': 6}\n    kernel_coefficient_bound = {'low': -7, 'up': -3}\n\n    problem = SVC_2d.SVC_2D(x, y, regularization_value_bound, kernel_coefficient_bound)\n\n    method_params = SolverParameters(r=np.double(3.0), iters_limit=100)\n    solver = Solver(problem, parameters=method_params)\n\n    apl = AnimatePainterNDListener(\"svc2d_anim.png\", \"output\", vars_indxs=[0, 1], to_paint_obj_func=False)\n    solver.add_listener(apl)\n\n    spl = StaticPainterNDListener(\"svc2d_stat.png\", \"output\", vars_indxs=[0, 1], mode=\"surface\", calc=\"interpolation\")\n    solver.add_listener(spl)\n\n    cfol = ConsoleOutputListener(mode='full')\n    solver.add_listener(cfol)\n\n    solver_info = solver.solve()\n\n```\n\n# **Project Structure**\n\nThe latest stable release of iOpt is in the [main](https://github.com/UNN-ITMM-Software/iOpt/tree/main) branch. The repository includes the following directories:\n- The [iOpt](https://github.com/UNN-ITMM-Software/iOpt/tree/main/iOpt) directory contains the framework core in the form of Python classes.\n- The [examples](https://github.com/UNN-ITMM-Software/iOpt/tree/main/examples) directory contains examples of using the framework for both test and applied problems.\n- Unit tests are located in the [test](https://github.com/UNN-ITMM-Software/iOpt/tree/main/test) directory.\n- Documentation source files are located in the [docs](https://github.com/UNN-ITMM-Software/iOpt/tree/main/docs) directory.\n\n# **Documentation**\n\nA detailed description of the iOpt framework API is available at [Read the Docs](https://iopt.readthedocs.io/ru/latest/).\n\n# **Supported by**\n\nThe study is supported by the [Research Center Strong Artificial Intelligence in Industry](https://sai.itmo.ru/) \nof [ITMO University](https://en.itmo.ru/) as part of the plan of the center's program: Framework of intelligent heuristic optimization methods.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Framework for automatically tuning hyperparameter values for mathematical models, AI and ML.",
    "version": "0.4.0",
    "project_urls": {
        "Homepage": "https://github.com/aimclub/iOpt"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1de505a2fd081a4f7217678021f9a3d269602a7a7df7df719b325764353301e0",
                "md5": "16cfa5325485ee25fdd4a107fe9e0f43",
                "sha256": "7af9a21dec3bd9c37ffd409a99053717db2186fbf1c7292dd75173223b6dc706"
            },
            "downloads": -1,
            "filename": "iOpt-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "16cfa5325485ee25fdd4a107fe9e0f43",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 404570,
            "upload_time": "2024-03-22T16:23:14",
            "upload_time_iso_8601": "2024-03-22T16:23:14.580430Z",
            "url": "https://files.pythonhosted.org/packages/1d/e5/05a2fd081a4f7217678021f9a3d269602a7a7df7df719b325764353301e0/iOpt-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b6fbb8fe37553d1bf6c7d2ba537ea20ac2539811258e919599ca3cc62ed4379f",
                "md5": "41063b9f0c307f890afc9cb06ce2a4dd",
                "sha256": "7c2272e70972a26e8634c5c33ada54a4a8133f632f9c25de29d7ee38ff6ff640"
            },
            "downloads": -1,
            "filename": "iOpt-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "41063b9f0c307f890afc9cb06ce2a4dd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 340333,
            "upload_time": "2024-03-22T16:23:18",
            "upload_time_iso_8601": "2024-03-22T16:23:18.576961Z",
            "url": "https://files.pythonhosted.org/packages/b6/fb/b8fe37553d1bf6c7d2ba537ea20ac2539811258e919599ca3cc62ed4379f/iOpt-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-22 16:23:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aimclub",
    "github_project": "iOpt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "iopt"
}
        
Elapsed time: 0.22366s