Showing preview only (589K chars total). Download the full file or copy to clipboard to get everything.
Repository: openscilab/pymilo
Branch: main
Commit: d1b0b257ea98
Files: 248
Total size: 527.4 KB
Directory structure:
gitextract_4tl_xksm/
├── .coveragerc
├── .github/
│ ├── CODE_OF_CONDUCT.md
│ ├── CONTRIBUTING.md
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.yml
│ │ ├── config.yml
│ │ └── feature_request.yml
│ ├── PULL_REQUEST_TEMPLATE.md
│ ├── dependabot.yml
│ └── workflows/
│ ├── publish_conda.yml
│ ├── publish_pypi.yml
│ └── test.yml
├── .gitignore
├── .pydocstyle
├── AUTHORS.md
├── CHANGELOG.md
├── CITATION.cff
├── LICENSE
├── README.md
├── SECURITY.md
├── SUPPORTED_MODELS.md
├── autopep8.bat
├── autopep8.sh
├── codecov.yml
├── dev-requirements.txt
├── otherfiles/
│ ├── RELEASE.md
│ ├── meta.yaml
│ ├── requirements-splitter.py
│ └── version_check.py
├── paper/
│ ├── .gitignore
│ ├── PyMilo.bib
│ ├── paper.bib
│ └── paper.md
├── pymilo/
│ ├── __init__.py
│ ├── __main__.py
│ ├── chains/
│ │ ├── __init__.py
│ │ ├── chain.py
│ │ ├── clustering_chain.py
│ │ ├── compose_chain.py
│ │ ├── cross_decomposition_chain.py
│ │ ├── decision_tree_chain.py
│ │ ├── ensemble_chain.py
│ │ ├── linear_model_chain.py
│ │ ├── naive_bayes_chain.py
│ │ ├── neighbours_chain.py
│ │ ├── neural_network_chain.py
│ │ ├── svm_chain.py
│ │ └── util.py
│ ├── exceptions/
│ │ ├── __init__.py
│ │ ├── deserialize_exception.py
│ │ ├── pymilo_exception.py
│ │ └── serialize_exception.py
│ ├── pymilo_func.py
│ ├── pymilo_obj.py
│ ├── pymilo_param.py
│ ├── streaming/
│ │ ├── __init__.py
│ │ ├── communicator.py
│ │ ├── compressor.py
│ │ ├── encryptor.py
│ │ ├── interfaces.py
│ │ ├── param.py
│ │ ├── pymilo_client.py
│ │ ├── pymilo_server.py
│ │ └── util.py
│ ├── transporters/
│ │ ├── __init__.py
│ │ ├── adamoptimizer_transporter.py
│ │ ├── baseloss_transporter.py
│ │ ├── binmapper_transporter.py
│ │ ├── bisecting_tree_transporter.py
│ │ ├── bunch_transporter.py
│ │ ├── cfnode_transporter.py
│ │ ├── compose_transporter.py
│ │ ├── feature_extraction_transporter.py
│ │ ├── function_transporter.py
│ │ ├── general_data_structure_transporter.py
│ │ ├── generator_transporter.py
│ │ ├── lossfunction_transporter.py
│ │ ├── neighbors_tree_transporter.py
│ │ ├── preprocessing_transporter.py
│ │ ├── randomstate_transporter.py
│ │ ├── sgdoptimizer_transporter.py
│ │ ├── transporter.py
│ │ ├── tree_transporter.py
│ │ └── treepredictor_transporter.py
│ └── utils/
│ ├── __init__.py
│ ├── data_exporter.py
│ ├── test_pymilo.py
│ └── util.py
├── requirements.txt
├── setup.py
├── streaming-requirements.txt
└── tests/
├── test_clusterings/
│ ├── affinity_propagation.py
│ ├── birch.py
│ ├── bisecting_kmeans.py
│ ├── dbscan.py
│ ├── gaussian_mixture/
│ │ ├── bayesian_gaussian_mixture.py
│ │ └── gaussian_mixture.py
│ ├── hdbscan.py
│ ├── hierarchical_clustering/
│ │ ├── agglomerative_clustering.py
│ │ └── feature_agglomeration.py
│ ├── kmeans.py
│ ├── mean_shift.py
│ ├── minibatch_kmeans.py
│ ├── optics.py
│ ├── spectral_clustering/
│ │ ├── spectral_biclustering.py
│ │ ├── spectral_clustering.py
│ │ └── spectral_coclustering.py
│ └── test_clusterings.py
├── test_composes/
│ ├── column_transformer.py
│ ├── test_compose_models.py
│ ├── transformed_target_regressor.py
│ └── util.py
├── test_cross_decomposition/
│ ├── cca.py
│ ├── pls_canonical.py
│ ├── pls_regression.py
│ └── test_cross_decompositions.py
├── test_decision_trees/
│ ├── decision_tree/
│ │ ├── decision_tree_classification.py
│ │ └── decision_tree_regression.py
│ ├── extra_tree/
│ │ ├── extra_tree_classification.py
│ │ └── extra_tree_regression.py
│ └── test_decision_trees.py
├── test_ensembles/
│ ├── adaboost/
│ │ ├── adaboost_classifier.py
│ │ └── adaboost_regressor.py
│ ├── bagging/
│ │ ├── bagging_classifier.py
│ │ └── bagging_regressor.py
│ ├── extra_trees/
│ │ ├── extra_trees_classifier.py
│ │ └── extra_trees_regressor.py
│ ├── gradient_booster/
│ │ ├── gradient_booster_classifier.py
│ │ └── gradient_booster_regressor.py
│ ├── hist_gradient_boosting/
│ │ ├── hist_gradient_boosting_classifier.py
│ │ └── hist_gradient_boosting_regressor.py
│ ├── isolation_forest.py
│ ├── pipeline.py
│ ├── random_forests/
│ │ ├── random_forest_classifier.py
│ │ └── random_forest_regressor.py
│ ├── random_trees_embedding.py
│ ├── stacking/
│ │ ├── stacking_classifier.py
│ │ └── stacking_regressor.py
│ ├── test_ensembles.py
│ └── voting/
│ ├── voting_classifier.py
│ └── voting_regressor.py
├── test_exceptions/
│ ├── custom_models.py
│ ├── export_exceptions.py
│ ├── import_exceptions.py
│ ├── invalid_jsons/
│ │ ├── corrupted.json
│ │ └── unknown-model.json
│ ├── test_exceptions.py
│ └── valid_jsons/
│ └── linear_regression.json
├── test_feature_extraction/
│ ├── count_vectorizer.py
│ ├── dict_vectorizer.py
│ ├── feature_hasher.py
│ ├── hashing_vectorizer.py
│ ├── patch_extractor.py
│ ├── pipeline.py
│ ├── test_feature_extractions.py
│ ├── tfidf_transformer.py
│ ├── tfidf_vectorizer.py
│ └── util.py
├── test_linear_models/
│ ├── bayesian/
│ │ ├── ard_regression.py
│ │ └── bayesian_regression.py
│ ├── elasticnet/
│ │ ├── elastic_net.py
│ │ ├── elastic_net_cv.py
│ │ ├── multi_task_elastic_net.py
│ │ └── multi_task_elastic_net_cv.py
│ ├── glm/
│ │ ├── gamma_regression.py
│ │ ├── poisson_regression.py
│ │ └── tweedie_regression.py
│ ├── lasso_lars/
│ │ ├── lasso.py
│ │ ├── lasso_cv.py
│ │ ├── lasso_lars.py
│ │ ├── lasso_lars_cv.py
│ │ ├── lasso_lars_ic.py
│ │ ├── multi_task_lasso.py
│ │ └── multi_task_lasso_cv.py
│ ├── linear_regression/
│ │ └── linear_regression.py
│ ├── logistic/
│ │ ├── logistic_regression.py
│ │ └── logistic_regression_cv.py
│ ├── omp/
│ │ ├── omp.py
│ │ └── omp_cv.py
│ ├── passive_aggressive/
│ │ ├── passive_aggressive_classifier.py
│ │ └── passive_aggressive_regressor.py
│ ├── perceptron/
│ │ └── perception.py
│ ├── quantile/
│ │ └── quantile.py
│ ├── ridge/
│ │ ├── ridge_classifier.py
│ │ ├── ridge_classifier_cv.py
│ │ ├── ridge_regression.py
│ │ └── ridge_regression_cv.py
│ ├── robustness/
│ │ ├── huber_regression.py
│ │ ├── ransac_regression.py
│ │ └── theil_sen_regression.py
│ ├── sgd/
│ │ ├── sgd_classifier.py
│ │ ├── sgd_oneclass_svm.py
│ │ └── sgd_regression.py
│ └── test_linear_models.py
├── test_misc_functionalities.py/
│ └── test_batch.py
├── test_ml_streaming/
│ ├── docker_files/
│ │ ├── Dockerfile1
│ │ └── Dockerfile2
│ ├── run_server.py
│ ├── scenarios/
│ │ ├── scenario1.py
│ │ ├── scenario2.py
│ │ ├── scenario3.py
│ │ └── scenario4.py
│ └── test_streaming.py
├── test_naive_bayes/
│ ├── bernoulli.py
│ ├── categorical.py
│ ├── complement.py
│ ├── gaussian.py
│ ├── multinomial.py
│ └── test_naive_bayes_models.py
├── test_neighbors/
│ ├── kneighbors_classifier.py
│ ├── kneighbors_regressor.py
│ ├── local_outlier_factor.py
│ ├── nearest_centroid.py
│ ├── nearest_neighbor.py
│ ├── radius_neighbors_classifier.py
│ ├── radius_neighbors_regressor.py
│ └── test_neighbors.py
├── test_neural_networks/
│ ├── bernoulli_rbm/
│ │ └── bernoulli_rbm.py
│ ├── mlp/
│ │ ├── mlp_classification.py
│ │ └── mlp_regression.py
│ └── test_neural_networks.py
├── test_preprocessings/
│ ├── binarizer.py
│ ├── function_transformer.py
│ ├── kbins_discretizer.py
│ ├── kernel_centerer.py
│ ├── label_binarizer.py
│ ├── label_encoder.py
│ ├── max_abs_scaler.py
│ ├── multilabel_binarizer.py
│ ├── normalizer.py
│ ├── one_hot_encoder.py
│ ├── ordinal_encoder.py
│ ├── polynomial_features.py
│ ├── power_transformer.py
│ ├── quantile_transformer.py
│ ├── robust_scaler.py
│ ├── spline_transformer.py
│ ├── standard_scaler.py
│ ├── target_encoder.py
│ ├── test_preprocessings.py
│ └── util.py
└── test_svms/
├── linear_svc.py
├── linear_svr.py
├── nu_svc.py
├── nu_svr.py
├── one_class_svm.py
├── svc.py
├── svr.py
└── test_svms.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .coveragerc
================================================
[run]
branch = True
omit =
*/pymilo/__main__.py
[report]
# Regexes for lines to exclude from consideration
exclude_lines =
pragma: no cover
================================================
FILE: .github/CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
pymilo@openscilab.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
================================================
FILE: .github/CONTRIBUTING.md
================================================
# Contribution
Changes and improvements are more than welcome! ❤️ Feel free to fork and open a pull request.
Please consider the following :
1. Fork it!
2. Create your feature branch (under `dev` branch)
3. Add your functions/methods to proper files
4. Add standard `docstring` to your functions/methods
5. Add tests for your functions/methods (`tests` folder)
6. Pass all CI tests
7. Update `CHANGELOG.md`
- Describe changes under `[Unreleased]` section
8. Submit a pull request into `dev` (please complete the pull request template)
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.yml
================================================
name: Bug Report
description: File a bug report
title: "[Bug]: "
body:
- type: markdown
attributes:
value: |
Thanks for your time to fill out this bug report!
- type: input
id: contact
attributes:
label: Contact details
description: How can we get in touch with you if we need more info?
placeholder: ex. email@example.com
validations:
required: false
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Provide a clear and concise description of what the bug is.
placeholder: >
Tell us a description of the bug.
validations:
required: true
- type: textarea
id: step-to-reproduce
attributes:
label: Steps to reproduce
description: Provide details of how to reproduce the bug.
placeholder: >
ex. 1. Go to '...'
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: What did you expect to happen?
placeholder: >
ex. I expected '...' to happen
validations:
required: true
- type: textarea
id: actual-behavior
attributes:
label: Actual behavior
description: What did actually happen?
placeholder: >
ex. Instead '...' happened
validations:
required: true
- type: dropdown
id: operating-system
attributes:
label: Operating system
description: Which operating system are you using?
options:
- Windows
- macOS
- Linux
default: 0
validations:
required: true
- type: dropdown
id: python-version
attributes:
label: Python version
description: Which version of Python are you using?
options:
- Python 3.14
- Python 3.13
- Python 3.12
- Python 3.11
- Python 3.10
- Python 3.9
- Python 3.8
- Python 3.7
default: 1
validations:
required: true
- type: dropdown
id: pymilo-version
attributes:
label: PyMilo version
description: Which version of PyMilo are you using?
options:
- PyMilo 1.6
- PyMilo 1.5
- PyMilo 1.4
- PyMilo 1.3
- PyMilo 1.2
- PyMilo 1.1
- PyMilo 1.0
- PyMilo 0.9
- PyMilo 0.8
- PyMilo 0.7
- PyMilo 0.6
- PyMilo 0.5
- PyMilo 0.4
- PyMilo 0.3
- PyMilo 0.2
- PyMilo 0.1
default: 0
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
- name: Discord
url: https://discord.com/invite/mtuMS8AjDS
about: Ask questions and discuss with other PyMilo community members
- name: Website
url: https://openscilab.com/
about: Check out our website for more information
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.yml
================================================
name: Feature Request
description: Suggest a feature for this project
title: "[Feature]: "
body:
- type: textarea
id: description
attributes:
label: Describe the feature you want to add
placeholder: >
I'd like to be able to [...]
validations:
required: true
- type: textarea
id: possible-solution
attributes:
label: Describe your proposed solution
placeholder: >
I think this could be done by [...]
validations:
required: false
- type: textarea
id: alternatives
attributes:
label: Describe alternatives you've considered, if relevant
placeholder: >
Another way to do this would be [...]
validations:
required: false
- type: textarea
id: aditional-context
attributes:
label: Additional context
placeholder: >
Add any other context or screenshots about the feature request here.
validations:
required: false
================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
#### Reference Issues/PRs
#### What does this implement/fix? Explain your changes.
#### Any other comments?
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
time: "01:30"
open-pull-requests-limit: 10
target-branch: dev
assignees:
- "AHReccese"
================================================
FILE: .github/workflows/publish_conda.yml
================================================
name: publish_conda
permissions: read-all
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
publish:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: publish-to-conda
uses: sepandhaghighi/conda-package-publish-action@v1.2
with:
subDir: 'otherfiles'
AnacondaToken: ${{ secrets.ANACONDA_TOKEN }}
================================================
FILE: .github/workflows/publish_pypi.yml
================================================
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Upload Python Package
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- '*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*.tar.gz
twine upload dist/*.whl
================================================
FILE: .github/workflows/test.yml
================================================
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: CI
on:
push:
branches:
- main
- dev
pull_request:
branches:
- dev
- main
env:
TEST_PYTHON_VERSION: 3.9
TEST_OS: 'ubuntu-22.04'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2022, macos-15-intel]
python-version: [3.7, 3.8, 3.9, 3.10.5, 3.11.0, 3.12.0, 3.13.0, 3.14.0]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Installation
run: |
python -m pip install --upgrade pip
pip install .["streaming"]
- name: Test requirements Installation
run: |
python otherfiles/requirements-splitter.py
pip install --upgrade --upgrade-strategy=only-if-needed -r test-requirements.txt
- name: Pymilo Core Functionality Tests with pytest
env:
COVERAGE_FILE: .coverage.core
run: |
python -m pytest . --ignore=./tests/test_ml_streaming --cov=pymilo --cov-report=term --cov-report=xml:coverage_core.xml
- name: Pymilo Streaming Functionality Tests with pytest
env:
COVERAGE_FILE: .coverage.streaming
run: |
python -m pytest ./tests/test_ml_streaming --cov=pymilo --cov-report=term --cov-report=xml:coverage_streaming.xml
- name: Merge coverage files
run: |
coverage combine
coverage xml -o coverage_combined.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: coverage_combined.xml
fail_ci_if_error: false
if: matrix.python-version == env.TEST_PYTHON_VERSION && matrix.os == env.TEST_OS
- name: Vulture, Bandit and Pydocstyle Tests
run: |
python -m vulture pymilo/ otherfiles/ setup.py --min-confidence 65 --exclude=__init__.py --sort-by-size
python -m bandit -r pymilo -s B311
python -m pydocstyle -v
if: matrix.python-version == env.TEST_PYTHON_VERSION
- name: Version check
run: |
python otherfiles/version_check.py
if: matrix.python-version == env.TEST_PYTHON_VERSION
================================================
FILE: .gitignore
================================================
# Created by .ignore support plugin (hsz.mobi)
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# dotenv
.env
# virtualenv
.venv/
venv/
ENV/
# Spyder project settings
.spyderproject
# Rope project settings
.ropeproject
### Example user template template
### Example user template
# IntelliJ project files
.idea
*.iml
out
gen
/.VSCodeCounter
/tests/exported*
/paper/refs
================================================
FILE: .pydocstyle
================================================
[pydocstyle]
match_dir = ^(?!(tests|build)).*
match = .*\.py
================================================
FILE: AUTHORS.md
================================================
# Core Developers
----------
- AmirHosein Rostami - Open Science Laboratory ([Github](https://github.com/AHReccese)) **
- Sepand Haghighi - Open Science Laboratory ([Github](https://github.com/sepandhaghighi))
- Alireza Zolanvari - Open Science Laboratory ([Github](https://github.com/AlirezaZolanvari))
- Sadra Sabouri - Open Science Laboratory ([Github](https://github.com/sadrasabouri))
** **Maintainer**
# Other Contributors
----------
- [@zhmbshr](https://github.com/zhmbshr) ++
++ **Graphic designer**
================================================
FILE: CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [1.6] - 2026-04-03
### Added
- `_check_response_error` function in `WebSocketClientCommunicator`
- `register_client` function in `WebSocketClientCommunicator`
- `remove_client` function in `WebSocketClientCommunicator`
- `register_model` function in `WebSocketClientCommunicator`
- `remove_model` function in `WebSocketClientCommunicator`
- `get_ml_models` function in `WebSocketClientCommunicator`
- `grant_access` function in `WebSocketClientCommunicator`
- `revoke_access` function in `WebSocketClientCommunicator`
- `get_allowance` function in `WebSocketClientCommunicator`
- `get_allowed_models` function in `WebSocketClientCommunicator`
- `_action_handlers` registry in `WebSocketServerCommunicator`
- `_handle_register_client` function in `WebSocketServerCommunicator`
- `_handle_remove_client` function in `WebSocketServerCommunicator`
- `_handle_register_model` function in `WebSocketServerCommunicator`
- `_handle_remove_model` function in `WebSocketServerCommunicator`
- `_handle_get_ml_models` function in `WebSocketServerCommunicator`
- `_handle_grant_access` function in `WebSocketServerCommunicator`
- `_handle_revoke_access` function in `WebSocketServerCommunicator`
- `_handle_get_allowance` function in `WebSocketServerCommunicator`
- `_handle_get_allowed_models` function in `WebSocketServerCommunicator`
- `scenario4` access control test for streaming
- `--port` argument in test server runner
- `close` function in `WebSocketClientCommunicator`
- `close` function in `PymiloClient`
- Context manager support (`__enter__`/`__exit__`) in `PymiloClient`
### Changed
- Test system modified
- `_ArrayFunctionDispatcher` import in `FunctionTransporter` to use new numpy API
- `datetime.utcnow()` to `datetime.now(timezone.utc)` in `PymiloException`
- `get_allowance` endpoint in `RESTServerCommunicator` to handle empty allowances
- `send_message` function in `WebSocketClientCommunicator`
- `download` function in `WebSocketClientCommunicator`
- `upload` function in `WebSocketClientCommunicator`
- `attribute_call` function in `WebSocketClientCommunicator`
- `attribute_type` function in `WebSocketClientCommunicator`
- `__init__` function in `WebSocketServerCommunicator`
- `handle_message` function in `WebSocketServerCommunicator`
- `_handle_download` function in `WebSocketServerCommunicator`
- `_handle_upload` function in `WebSocketServerCommunicator`
- `_handle_attribute_call` function in `WebSocketServerCommunicator`
- `_handle_attribute_type` function in `WebSocketServerCommunicator`
- `parse` function in `WebSocketServerCommunicator`
- WebSocket streaming tests enabled
## [1.5] - 2026-01-26
### Added
- `_is_remainder_cols_list` function in GeneralDataStructureTransporter
- `ComposeTransporter` Transporter
- Composite params initialized in `pymilo_param.py`
- `get_transporter` in `chains/util.py`
- `deserialize_possible_ml_model` in `chains/util.py`
- `serialize_possible_ml_model` in `chains/util.py`
- `TransformedTargetRegressor` model
- `ColumnTransformer` model
- Composite models test runner
- Composite models chain
- JOSS paper
### Changed
- `serialize` function in FunctionTransporter
- `serialize_spline` function in PreprocessingTransporter
- `deserialize_spline` function in PreprocessingTransporter
- Ensemble models test runner
- `get_deserialized_list` function in GeneralDataStructureTransporter
- `deserialize` function in GeneralDataStructureTransporter
- `serialize` function in GeneralDataStructureTransporter
- `get_deserialized_dict` function in GeneralDataStructureTransporter
- `serialize_dict` function in GeneralDataStructureTransporter
- `serialize_tuple` function in GeneralDataStructureTransporter
- Test system modified
- `README.md` updated
### Removed
- `get_transporter` in `ensemble_chain.py`
- `deserialize_possible_ml_model` in `ensemble_chain.py`
- `serialize_possible_ml_model` in `ensemble_chain.py`
## [1.4] - 2025-12-01
### Added
- `get_allowed_models` function in `PymiloClient`
- `get_allowance` function in `PymiloClient`
- `revoke_access` function in `PymiloClient`
- `grant_access` function in `PymiloClient`
- `get_ml_models` function in `PymiloClient`
- `deregister_ml_model` function in `PymiloClient`
- `register_ml_model` function in `PymiloClient`
- `deregister` function in `PymiloClient`
- `register` function in `PymiloClient`
- `REST_API_PREFIX ` function in `streaming.param.py`
- `register_client` function in `RESTClientCommunicator`
- `remove_client` function in `RESTClientCommunicator`
- `register_model` function in `RESTClientCommunicator`
- `remove_model` function in `RESTClientCommunicator`
- `get_ml_models` function in `RESTClientCommunicator`
- `grant_access` function in `RESTClientCommunicator`
- `revoke_access` function in `RESTClientCommunicator`
- `get_allowance` function in `RESTClientCommunicator`
- `get_allowed_models` function in `RESTClientCommunicator`
- `_validate_id` function in `PymiloServer`
- `init_client` function in `PymiloServer`
- `remove_client` function in `PymiloServer`
- `grant_access` function in `PymiloServer`
- `revoke_access` function in `PymiloServer`
- `get_allowed_models` function in `PymiloServer`
- `get_clients_allowance` function in `PymiloServer`
- `get_clients` function in `PymiloServer`
- `init_ml_model` function in `PymiloServer`
- `set_ml_model` function in `PymiloServer`
- `remove_ml_model` function in `PymiloServer`
- `get_ml_models` function in `PymiloServer`
### Changed
- `is_callable_attribute` function in `PymiloServer`
- `execute_model` function in `PymiloServer`
- `update_model` function in `PymiloServer`
- `export_model` function in `PymiloServer`
- `__getattr__` in `PymiloClient`
- `upload` function in `PymiloClient`
- `download` function in `PymiloClient`
- `encrypt_compress` function in `PymiloClient`
- `ClientCommunicator` interface
- `handle_message` function in `WebSocketServerCommunicator`
- `_handle_download` function in `WebSocketServerCommunicator`
- `setup_routes` function in `RESTServerCommunicator`
- `__init__` function in `RESTClientCommunicator`
- `download` function in `RESTClientCommunicator`
- `upload` function in `RESTClientCommunicator`
- `attribute_call` function in `RESTClientCommunicator`
- `attribute_type` function in `RESTClientCommunicator`
- `README.md` updated
- `__init__` function in `PyMiloServer`
- Test system modified
- `Python 3.14` added to `test.yml`
### Removed
- Python 3.6 support
## [1.3] - 2025-02-26
### Added
- `TfidfVectorizer` feature extractor
- `TfidfTransformer` feature extractor
- `HashingVectorizer` feature extractor
- `CountVectorizer` feature extractor
- `PatchExtractor` feature extractor
- `DictVectorizer` feature extractor
- `FeatureHasher` feature extractor
- `FeatureExtractorTransporter` Transporter
- `FeatureExtraction` support added to Ensemble chain
- FeatureExtraction params initialized in `pymilo_param.py`
- Feature Extraction models test runner
- Zenodo badge to `README.md`
### Changed
- `get_deserialized_list` in `GeneralDataStructureTransporter`
- `get_deserialized_dict` in `GeneralDataStructureTransporter`
- `serialize` in `GeneralDataStructureTransporter`
- `serialize_tuple` in `GeneralDataStructureTransporter`
- `AttributeCallPayload` in `streaming.communicator.py`
- `get_deserialized_regular_primary_types` in `GeneralDataStructureTransporter`
- Test system modified
## [1.2] - 2025-01-22
### Added
- `generate_dockerfile` testcases
- `generate_dockerfile` function in `streaming.util.py`
- `cite` section in `README.md`
- `CLI` handler
- `print_supported_ml_models` function in `pymilo_func.py`
- `pymilo_help` function in `pymilo_func.py`
- `SKLEARN_SUPPORTED_CATEGORIES` in `pymilo_param.py`
- `OVERVIEW` in `pymilo_param.py`
- `get_sklearn_class` in `utils.util.py`
### Changed
- `ML Streaming` testcases modified to use PyMilo CLI
- `to_pymilo_issue` function in `PymiloException`
- `valid_url_valid_file` testcase added in `test_exceptions.py`
- `valid_url_valid_file` function in `import_exceptions.py`
- `StandardPayload` in `RESTServerCommunicator`
- testcase for LogisticRegressionCV, LogisticRegression
- `README.md` updated
- `AUTHORS.md` updated
## [1.1] - 2024-11-25
### Added
- `is_socket_closed` function in `streaming.communicator.py`
- `validate_http_url` function in `streaming.util.py`
- `validate_websocket_url` function in `streaming.util.py`
- `ML Streaming` WebSocket testcases
- `CommunicationProtocol` Enum in `streaming.communicator.py`
- `WebSocketClientCommunicator` class in `streaming.communicator.py`
- `WebSocketServerCommunicator` class in `streaming.communicator.py`
- batch operation testcases
- `batch_export` function in `pymilo/pymilo_obj.py`
- `batch_import` function in `pymilo/pymilo_obj.py`
- `CCA` model
- `PLSCanonical` model
- `PLSRegression` model
- Cross decomposition models test runner
- Cross decomposition chain
- PyMilo exception types added in `pymilo/exceptions/__init__.py`
- PyMilo exception types added in `pymilo/__init__.py`
### Changed
- `core` and `streaming` tests divided in `test.yml`
- `communication_protocol` parameter added to `PyMiloClient` class
- `communication_protocol` parameter added to `PyMiloServer` class
- `ML Streaming` testcases updated to support protocol selection
- `README.md` updated
- Tests config modified
- Cross decomposition params initialized in `pymilo_param`
- Cross decomposition support added to `pymilo_func.py`
- `SUPPORTED_MODELS.md` updated
- `README.md` updated
- GitHub actions are limited to the `dev` and `main` branches
- `Python 3.13` added to `test.yml`
## [1.0] - 2024-09-16
### Added
- Compression method test in `ML Streaming` RESTful testcases
- `CLI` handler in `tests/test_ml_streaming/run_server.py`
- `Compression` Enum in `streaming.compressor.py`
- `GZIPCompressor` class in `streaming.compressor.py`
- `ZLIBCompressor` class in `streaming.compressor.py`
- `LZMACompressor` class in `streaming.compressor.py`
- `BZ2Compressor` class in `streaming.compressor.py`
- `encrypt_compress` function in `PymiloClient`
- `parse` function in `RESTServerCommunicator`
- `is_callable_attribute` function in `PymiloServer`
- `streaming.param.py`
- `attribute_type` function in `RESTServerCommunicator`
- `AttributeTypePayload` class in `RESTServerCommunicator`
- `attribute_type` function in `RESTClientCommunicator`
- `Mode` Enum in `PymiloClient`
- Import from url testcases
- `download_model` function in `utils.util.py`
- `PymiloServer` class in `streaming.pymilo_server.py`
- `PymiloClient` class in `PymiloClient`
- `Communicator` interface in `streaming.interfaces.py`
- `RESTClientCommunicator` class in `streaming.communicator.py`
- `RESTServerCommunicator` class in `streaming.communicator.py`
- `Compressor` interface in `streaming.interfaces.py`
- `DummyCompressor` class in `streaming.compressor.py`
- `Encryptor` interface in `streaming.interfaces.py`
- `DummyEncryptor` class in `streaming.encryptor.py`
- `ML Streaming` RESTful testcases
- `streaming-requirements.txt`
### Changed
- `README.md` updated
- `ML Streaming` RESTful testcases
- `attribute_call` function in `RESTServerCommunicator`
- `AttributeCallPayload` class in `RESTServerCommunicator`
- upload function in `RESTClientCommunicator`
- download function in `RESTClientCommunicator`
- `__init__` function in `RESTClientCommunicator`
- `attribute_calls` function in `RESTClientCommunicator`
- `requests` added to `requirements.txt`
- `uvicorn`, `fastapi`, `requests` and `pydantic` added to `dev-requirements.txt`
- `ML Streaming` RESTful testcases
- `__init__` function in `PymiloServer`
- `__getattr__` function in `PymiloClient`
- `__init__` function in `PymiloClient`
- `toggle_mode` function in `PymiloClient`
- `upload` function in `PymiloClient`
- `download` function in `PymiloClient`
- `__init__` function in `PymiloServer`
- `serialize_cfnode` function in `transporters.cfnode_transporter.py`
- `__init__` function in `Import` class
- `serialize` function in `transporters.tree_transporter.py`
- `deserialize` function in `transporters.tree_transporter.py`
- `serialize` function in `transporters.sgdoptimizer_transporter.py`
- `deserialize` function in `transporters.sgdoptimizer_transporter.py`
- `serialize` function in `transporters.randomstate_transporter.py`
- `deserialize` function in `transporters.randomstate_transporter.py`
- `serialize` function in `transporters.bunch_transporter.py`
- `deserialize` function in `transporters.bunch_transporter.py`
- `serialize` function in `transporters.adamoptimizer_transporter.py`
- `deserialize` function in `transporters.adamoptimizer_transporter.py`
- `serialize_linear_model` function in `chains.linear_model_chain.py`
- `serialize_ensemble` function in `chains.ensemble_chain.py`
- `serialize` function in `GeneralDataStructureTransporter` Transporter refactored
- `get_deserialized_list` function in `GeneralDataStructureTransporter` Transporter refactored
- `Export` class call by reference bug fixed
## [0.9] - 2024-07-01
### Added
- Anaconda workflow
- `prefix_list` function in `utils.util.py`
- `KBinsDiscretizer` preprocessing model
- `PowerTransformer` preprocessing model
- `SplineTransformer` preprocessing model
- `TargetEncoder` preprocessing model
- `QuantileTransformer` preprocessing model
- `RobustScaler` preprocessing model
- `PolynomialFeatures` preprocessing model
- `OrdinalEncoder` preprocessing model
- `Normalizer` preprocessing model
- `MaxAbsScaler` preprocessing model
- `MultiLabelBinarizer` preprocessing model
- `KernelCenterer` preprocessing model
- `FunctionTransformer` preprocessing model
- `Binarizer` preprocessing model
- Preprocessing models test runner
### Changed
- `Command` enum class in `transporter.py`
- `SerializationErrorTypes` enum class in `serialize_exception.py`
- `DeserializationErrorTypes` enum class in `deserialize_exception.py`
- `meta.yaml` modified
- `NaN` type in `pymilo_param`
- `NaN` type transportation in `GeneralDataStructureTransporter` Transporter
- `BSpline` Transportation in `PreprocessingTransporter` Transporter
- one layer deeper transportation in `PreprocessingTransporter` Transporter
- dictating outer ndarray dtype in `GeneralDataStructureTransporter` Transporter
- preprocessing params fulfilled in `pymilo_param`
- `SUPPORTED_MODELS.md` updated
- `README.md` updated
- `serialize_possible_ml_model` in the Ensemble chain
## [0.8] - 2024-05-06
### Added
- `StandardScaler` Transformer in `pymilo_param.py`
- `PreprocessingTransporter` Transporter
- ndarray shape config in `GeneralDataStructure` Transporter
- `util.py` in chains
- `BinMapperTransporter` Transporter
- `BunchTransporter` Transporter
- `GeneratorTransporter` Transporter
- `TreePredictorTransporter` Transporter
- `AdaboostClassifier` model
- `AdaboostRegressor` model
- `BaggingClassifier` model
- `BaggingRegressor` model
- `ExtraTreesClassifier` model
- `ExtraTreesRegressor` model
- `GradientBoosterClassifier` model
- `GradientBoosterRegressor` model
- `HistGradientBoosterClassifier` model
- `HistGradientBoosterRegressor` model
- `RandomForestClassifier` model
- `RandomForestRegressor` model
- `IsolationForest` model
- `RandomTreesEmbedding` model
- `StackingClassifier` model
- `StackingRegressor` model
- `VotingClassifier` model
- `VotingRegressor` model
- `Pipeline` model
- Ensemble models test runner
- Ensemble chain
- `SECURITY.md`
### Changed
- `Pipeline` test updated
- `LabelBinarizer`,`LabelEncoder` and `OneHotEncoder` got embedded in `PreprocessingTransporter`
- Preprocessing support added to Ensemble chain
- Preprocessing params initialized in `pymilo_param`
- `util.py` in utils updated
- `test_pymilo.py` updated
- `pymilo_func.py` updated
- `linear_model_chain.py` updated
- `neural_network_chain.py` updated
- `decision_tree_chain.py` updated
- `clustering_chain.py` updated
- `naive_bayes_chain.py` updated
- `neighbours_chain.py` updated
- `svm_chain.py` updated
- `GeneralDataStructure` Transporter updated
- `LossFunction` Transporter updated
- `AbstractTransporter` updated
- Tests config modified
- Unequal sklearn version error added in `pymilo_param.py`
- Ensemble params initialized in `pymilo_param`
- Ensemble support added to `pymilo_func.py`
- `SUPPORTED_MODELS.md` updated
- `README.md` updated
## [0.7] - 2024-04-03
### Added
- `pymilo_nearest_neighbor_test` function added to `test_pymilo.py`
- `NeighborsTreeTransporter` Transporter
- `LocalOutlierFactor` model
- `RadiusNeighborsClassifier` model
- `RadiusNeighborsRegressor` model
- `NearestCentroid` model
- `NearestNeighbors` model
- `KNeighborsClassifier` model
- `KNeighborsRegressor` model
- Neighbors models test runner
- Neighbors chain
### Changed
- Tests config modified
- Neighbors params initialized in `pymilo_param`
- Neighbors support added to `pymilo_func.py`
- `SUPPORTED_MODELS.md` updated
- `README.md` updated
## [0.6] - 2024-03-27
### Added
- `deserialize_primitive_type` function in `GeneralDataStructureTransporter`
- `is_deserialized_ndarray` function in `GeneralDataStructureTransporter`
- `deep_deserialize_ndarray` function in `GeneralDataStructureTransporter`
- `deep_serialize_ndarray` function in `GeneralDataStructureTransporter`
- `SVR` model
- `SVC` model
- `One Class SVM` model
- `NuSVR` model
- `NuSVC` model
- `Linear SVR` model
- `Linear SVC` model
- SVM models test runner
- SVM chain
### Changed
- `pymilo_param.py` updated
- `pymilo_obj.py` updated to use predefined strings
- `TreeTransporter` updated
- `get_homogeneous_type` function in `util.py` updated
- `GeneralDataStructureTransporter` updated to use deep ndarray serializer & deserializer
- `check_str_in_iterable` updated
- `Label Binarizer` Transporter updated
- `Function` Transporter updated
- `CFNode` Transporter updated
- `Bisecting Tree` Transporter updated
- Tests config modified
- SVM params initialized in `pymilo_param`
- SVM support added to `pymilo_func.py`
- `SUPPORTED_MODELS.md` updated
- `README.md` updated
## [0.5] - 2024-01-31
### Added
- `reset` function in the `Transport` interface
- `reset` function implementation in `AbstractTransporter`
- `Gaussian Naive Bayes` declared as `GaussianNB` model
- `Multinomial Naive Bayes` model declared as `MultinomialNB` model
- `Complement Naive Bayes` model declared as `ComplementNB` model
- `Bernoulli Naive Bayes` model declared as `BernoulliNB` model
- `Categorical Naive Bayes` model declared as `CategoricalNB` model
- Naive Bayes models test runner
- Naive Bayes chain
### Changed
- `Transport` function of `AbstractTransporter` updated
- fix the order of `CFNode` fields serialization in `CFNodeTransporter`
- `GeneralDataStructureTransporter` support list of ndarray with different shapes
- Tests config modified
- Naive Bayes params initialized in `pymilo_param`
- Naive Bayes support added to `pymilo_func.py`
- `SUPPORTED_MODELS.md` updated
- `README.md` updated
## [0.4] - 2024-01-22
### Added
- `has_named_parameter` method in `util.py`
- `CFSubcluster` Transporter(inside `CFNode` Transporter)
- `CFNode` Transporter
- `Birch` model
- `SpectralBiclustering` model
- `SpectralCoclustering` model
- `MiniBatchKMeans` model
- `feature_request.yml` template
- `config.yml` for issue template
- `BayesianGaussianMixture` model
- `serialize_tuple` method in `GeneralDataStructureTransporter`
- `import_function` method in `util.py`
- `Function` Transporter
- `FeatureAgglomeration` model
- `HDBSCAN` model
- `GaussianMixture` model
- `OPTICS` model
- `DBSCAN` model
- `AgglomerativeClustering` model
- `SpectralClustering` model
- `MeanShift` model
- `AffinityPropagation` model
- `Kmeans` model
- Clustering models test runner
- Clustering chain
### Changed
- `LossFunctionTransporter` enhanced to handle scikit 1.4.0 `_loss_function_` field
- Codacy Static Code Analyzer's suggestions applied
- Spectral Clustering test folder refactored
- Bug report template modified
- `GeneralDataStructureTransporter` updated
- Tests config modified
- Clustering data set preparation added to `data_exporter.py`
- Clustering params initialized in `pymilo_param`
- Clustering support added to `pymilo_func.py`
- `Python 3.12` added to `test.yml`
- `dev-requirements.txt` updated
- Code quality badges added to `README.md`
- `SUPPORTED_MODELS.md` updated
- `README.md` updated
## [0.3] - 2023-09-27
### Added
- scikit-learn decision tree models
- `ExtraTreeClassifier` model
- `ExtraTreeRegressor` model
- `DecisionTreeClassifier` model
- `DecisionTreeRegressor` model
- `Tree` Transporter
- Decision Tree chain
### Changed
- Tests config modified
- DecisionTree params initialized in `pymilo_param`
- Decision Tree support added to `pymilo_func.py`
## [0.2] - 2023-08-02
### Added
- scikit-learn neural network models
- `MLP Regressor` model
- `MLP Classifier` model
- `BernoulliRBN` model
- `SGDOptimizer` transporter
- `RandomState(MT19937)` transporter
- `Adamoptimizer` transporter
- Neural Network chain
- Neural Network exceptions
- `ndarray_to_list` method in `GeneralDataStructureTransporter`
- `list_to_ndarray` method in `GeneralDataStructureTransporter`
- `neural_network_chain.py` chain
### Changed
- `GeneralDataStructure` Transporter updated
- `LabelBinerizer` Transporter updated
- `linear model` chain updated
- GeneralDataStructure transporter enhanced
- LabelBinerizer transporter updated
- transporters' chain router added to `pymilo func`
- NeuralNetwork params initialized in `pymilo_param`
- `pymilo_test` updated to support multiple models
- `linear_model_chain` refactored
## [0.1] - 2023-06-29
### Added
- scikit-learn linear models support
- `Export` class
- `Import` class
[Unreleased]: https://github.com/openscilab/pymilo/compare/v1.6...dev
[1.6]: https://github.com/openscilab/pymilo/compare/v1.5...v1.6
[1.5]: https://github.com/openscilab/pymilo/compare/v1.4...v1.5
[1.4]: https://github.com/openscilab/pymilo/compare/v1.3...v1.4
[1.3]: https://github.com/openscilab/pymilo/compare/v1.2...v1.3
[1.2]: https://github.com/openscilab/pymilo/compare/v1.1...v1.2
[1.1]: https://github.com/openscilab/pymilo/compare/v1.0...v1.1
[1.0]: https://github.com/openscilab/pymilo/compare/v0.9...v1.0
[0.9]: https://github.com/openscilab/pymilo/compare/v0.8...v0.9
[0.8]: https://github.com/openscilab/pymilo/compare/v0.7...v0.8
[0.7]: https://github.com/openscilab/pymilo/compare/v0.6...v0.7
[0.6]: https://github.com/openscilab/pymilo/compare/v0.5...v0.6
[0.5]: https://github.com/openscilab/pymilo/compare/v0.4...v0.5
[0.4]: https://github.com/openscilab/pymilo/compare/v0.3...v0.4
[0.3]: https://github.com/openscilab/pymilo/compare/v0.2...v0.3
[0.2]: https://github.com/openscilab/pymilo/compare/v0.1...v0.2
[0.1]: https://github.com/openscilab/pymilo/compare/e887108...v0.1
================================================
FILE: CITATION.cff
================================================
cff-version: "1.2.0"
message: If you use this software, please cite our article in the
Journal of Open Source Software.
title: "PyMilo: A Python Library for ML I/O"
abstract: >-
PyMilo is an open-source Python package that addresses the limitations of
existing machine learning (ML) model storage formats by providing a
transparent, reliable, end-to-end, and safe method for exporting and
deploying trained models. Current tools rely on black-box or executable
formats that obscure internal model structures, making them difficult to
audit, verify, or safely share. Meanwhile, tensor-centric formats securely
store and transfer numerical tensors but do not capture the internal and
structural composition of classical machine-learning models (e.g.,
scikit-learn pipelines), which remain PyMilo’s primary focus. Others apply
structural transformations during export that may degrade predictive
performance and reduce the model to a limited inference-only interface. In
contrast, PyMilo serializes models in a transparent human-readable format
that preserves end-to-end model fidelity and enables reliable, safe, and
interpretable exchange.
authors:
- family-names: Rostami
given-names: AmirHosein
orcid: "https://orcid.org/0009-0000-0638-2263"
- family-names: Haghighi
given-names: Sepand
orcid: "https://orcid.org/0000-0001-9450-2375"
- family-names: Sabouri
given-names: Sadra
orcid: "https://orcid.org/0000-0003-1047-2346"
- family-names: Zolanvari
given-names: Alireza
orcid: "https://orcid.org/0000-0003-2367-8343"
contact:
- family-names: Rostami
given-names: AmirHosein
orcid: "https://orcid.org/0009-0000-0638-2263"
version: 1.4
date-released: 2025-12-23
repository-code: "https://github.com/openscilab/pymilo"
url: "https://github.com/openscilab/pymilo"
license: MIT
keywords:
- Machine Learning
- Model Deployment
- Model Serialization
- Transparency
- MLOPS
doi: 10.5281/zenodo.17783630
preferred-citation:
authors:
- family-names: Rostami
given-names: AmirHosein
orcid: "https://orcid.org/0009-0000-0638-2263"
- family-names: Haghighi
given-names: Sepand
orcid: "https://orcid.org/0000-0001-9450-2375"
- family-names: Sabouri
given-names: Sadra
orcid: "https://orcid.org/0000-0003-1047-2346"
- family-names: Zolanvari
given-names: Alireza
orcid: "https://orcid.org/0000-0003-2367-8343"
date-published: 2025-12-20
doi: 10.21105/joss.08858
issn: 2475-9066
issue: 116
journal: Journal of Open Source Software
publisher:
name: Open Journals
start: 8858
title: "PyMilo: A Python Library for ML I/O"
type: article
url: "https://joss.theoj.org/papers/10.21105/joss.08858"
volume: 10
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2022 OpenSciLab
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
<div align="center">
<img src="https://github.com/openscilab/pymilo/raw/main/otherfiles/logo.png" width="500" height="300">
<br/>
<br/>
<a href="https://codecov.io/gh/openscilab/pymilo"><img src="https://codecov.io/gh/openscilab/pymilo/branch/main/graph/badge.svg" alt="Codecov"/></a>
<a href="https://badge.fury.io/py/pymilo"><img src="https://badge.fury.io/py/pymilo.svg" alt="PyPI version"></a>
<a href="https://anaconda.org/openscilab/pymilo"><img src="https://anaconda.org/openscilab/pymilo/badges/version.svg"></a>
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3"></a>
<a href="https://github.com/openscilab/pymilo"><img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/openscilab/pymilo"></a>
<a href="https://discord.gg/mtuMS8AjDS"><img src="https://img.shields.io/discord/1064533716615049236.svg" alt="Discord Channel"></a>
</div>
----------
## Overview
<p align="justify">
PyMilo is an open source Python package that provides a simple, efficient, and safe way for users to export pre-trained machine learning models in a transparent way. By this, the exported model can be used in other environments, transferred across different platforms, and shared with others. PyMilo allows the users to export the models that are trained using popular Python libraries like scikit-learn, and then use them in deployment environments, or share them without exposing the underlying code or dependencies. The transparency of the exported models ensures reliability and safety for the end users, as it eliminates the risks of binary or pickle formats.
</p>
<table>
<tr>
<td align="center">PyPI Counter</td>
<td align="center">
<a href="https://pepy.tech/projects/pymilo">
<img src="https://static.pepy.tech/badge/pymilo" alt="PyPI Downloads">
</a>
</td>
</tr>
<tr>
<td align="center">Github Stars</td>
<td align="center">
<a href="https://github.com/openscilab/pymilo">
<img src="https://img.shields.io/github/stars/openscilab/pymilo.svg?style=social&label=Stars">
</a>
</td>
</tr>
</table>
<table>
<tr>
<td align="center">Branch</td>
<td align="center">main</td>
<td align="center">dev</td>
</tr>
<tr>
<td align="center">CI</td>
<td align="center">
<img src="https://github.com/openscilab/pymilo/actions/workflows/test.yml/badge.svg?branch=main">
</td>
<td align="center">
<img src="https://github.com/openscilab/pymilo/actions/workflows/test.yml/badge.svg?branch=dev">
</td>
</tr>
</table>
<table>
<tr>
<td align="center">Code Quality</td>
<td align="center"><a href="https://www.codefactor.io/repository/github/openscilab/pymilo"><img src="https://www.codefactor.io/repository/github/openscilab/pymilo/badge" alt="CodeFactor" /></a></td>
<td align="center"><a href="https://app.codacy.com/gh/openscilab/pymilo/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade"><img src="https://app.codacy.com/project/badge/Grade/9eeec99ed11f4d9b86af36dc90f5f753"></a></td>
</tr>
</table>
## Installation
### PyPI
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)
- Run `pip install pymilo==1.6`
### Source code
- Download [Version 1.6](https://github.com/openscilab/pymilo/archive/v1.6.zip) or [Latest Source](https://github.com/openscilab/pymilo/archive/dev.zip)
- Run `pip install .`
### Conda
- Check [Conda Managing Package](https://conda.io/)
- Update Conda using `conda update conda`
- Run `conda install -c openscilab pymilo`
## Usage
### Import/Export
Imagine you want to train a `LinearRegression` model representing this equation: $y = x_0 + 2x_1 + 3$. You will create data points (`X`, `y`) and train your model as follows.
```python
import numpy as np
from sklearn.linear_model import LinearRegression
X = np.array([[1, 1], [1, 2], [2, 2], [2, 3]])
y = np.dot(X, np.array([1, 2])) + 3
# y = 1 * x_0 + 2 * x_1 + 3
model = LinearRegression().fit(X, y)
pred = model.predict(np.array([[3, 5]]))
# pred = [16.] (=1 * 3 + 2 * 5 + 3)
```
Using PyMilo `Export` class you can easily serialize and export your trained model into a JSON file.
```python
from pymilo import Export
Export(model).save("model.json")
```
#### Export
The `Export` class facilitates exporting of machine learning models to JSON files.
| **Parameter** | **Description** |
| ------------- | --------------- |
| model | The machine learning model to be exported |
| **Property** | **Description** |
| ------------ | --------------- |
| data | The serialized model data including all learned parameters |
| version | The scikit-learn version used to train the model |
| type | The type/class name of the exported model |
| **Method** | **Description** |
| ---------- | --------------- |
| save | Save the exported model to a JSON file |
| to_json | Return the model as a JSON string representation |
| batch_export | Export multiple models to individual JSON files in a directory |
You can check out your model as a JSON file now.
```json
{
"data": {
"fit_intercept": true,
"copy_X": true,
"n_jobs": null,
"positive": false,
"n_features_in_": 2,
"coef_": {
"pymiloed-ndarray-list": [
1.0000000000000002,
1.9999999999999991
],
"pymiloed-ndarray-dtype": "float64",
"pymiloed-ndarray-shape": [
2
],
"pymiloed-data-structure": "numpy.ndarray"
},
"rank_": 2,
"singular_": {
"pymiloed-ndarray-list": [
1.618033988749895,
0.6180339887498948
],
"pymiloed-ndarray-dtype": "float64",
"pymiloed-ndarray-shape": [
2
],
"pymiloed-data-structure": "numpy.ndarray"
},
"intercept_": {
"value": 3.0000000000000018,
"np-type": "numpy.float64"
}
},
"sklearn_version": "1.4.2",
"pymilo_version": "0.8",
"model_type": "LinearRegression"
}
```
You can see all the learned parameters of the model in this file and change them if you want. This JSON representation is a transparent version of your model.
Now let's load it back. You can do it easily by using PyMilo `Import` class.
```python
from pymilo import Import
model = Import("model.json").to_model()
pred = model.predict(np.array([[3, 5]]))
# pred = [16.] (=1 * 3 + 2 * 5 + 3)
```
#### Import
The `Import` class facilitates importing of serialized models from JSON files, JSON strings, or URLs.
| **Parameter** | **Description** |
| ------------- | --------------- |
| file_adr | Path to the JSON file containing the serialized model |
| json_dump | JSON string representation of the serialized model |
| url | URL to download the serialized model from |
| **Property** | **Description** |
| ------------ | --------------- |
| data | The deserialized model data |
| version | The scikit-learn version of the original model |
| type | The type/class name of the imported model |
| **Method** | **Description** |
| ---------- | --------------- |
| to_model | Convert the imported data back to a scikit-learn model |
| batch_import | Import multiple models from JSON files in a directory |
This loaded model is exactly the same as the original trained model.
### ML streaming
You can easily serve your ML model from a remote server using `ML streaming` feature of PyMilo.
⚠️ `ML streaming` feature exists in versions `>=1.0`
⚠️ In order to use `ML streaming` feature, make sure you've installed the `streaming` mode of PyMilo
⚠️ The `ML streaming` feature is under construction and is not yet considered stable.
You can choose either `REST` or `WebSocket` as the communication medium protocol.
#### Server
Let's assume you are in the remote server and you want to import the exported JSON file and start serving your model through `REST` protocol!
```python
from pymilo import Import
from pymilo.streaming import PymiloServer, CommunicationProtocol
my_model = Import("model.json").to_model()
communicator = PymiloServer(
model=my_model,
port=8000,
communication_protocol=CommunicationProtocol["REST"],
).communicator
communicator.run()
```
#### PymiloServer
The `PymiloServer` class facilitates streaming machine learning models over a network.
| **Parameter** | **Description** |
| ------------- | --------------- |
| port | Port number for the server to listen on (default: 8000) |
| host | Host address for the server (default: "127.0.0.1") |
| compressor | Compression method from `Compression` enum |
| communication_protocol | Communication protocol from `CommunicationProtocol` enum |
The `compressor` parameter accepts values from the `Compression` enum including `NULL` (no compression), `GZIP`, `ZLIB`, `LZMA`, or `BZ2`. The `communication_protocol` parameter accepts values from the `CommunicationProtocol` enum including `REST` or `WEBSOCKET`.
| **Method** | **Description** |
| ---------- | --------------- |
| init_client | Initialize a new client with the given client ID |
| remove_client | Remove an existing client by client ID |
| init_ml_model | Initialize a new ML model for a given client |
| set_ml_model | Set or update the ML model for a client |
| remove_ml_model | Remove an existing ML model for a client |
| get_ml_models | Get all ML model IDs for a client |
| execute_model | Execute model methods or access attributes |
| grant_access | Allow a client to access another client's model |
| revoke_access | Revoke access to a client's model |
| get_allowed_models | Get models a client is allowed to access |
Now `PymiloServer` runs on port `8000` and exposes REST API to `upload`, `download` and retrieve **attributes** either **data attributes** like `model._coef` or **method attributes** like `model.predict(x_test)`.
ℹ️ By default, `PymiloServer` listens on the loopback interface (`127.0.0.1`). To make it accessible over a local network (LAN), specify your machine’s LAN IP address in the `host` parameter of the `PymiloServer` constructor.
#### Client
By using `PymiloClient` you can easily connect to the remote `PymiloServer` and execute any functionalities that the given ML model has, let's say you want to run `predict` function on your remote ML model and get the result:
```python
from pymilo.streaming import PymiloClient, CommunicationProtocol
pymilo_client = PymiloClient(
mode=PymiloClient.Mode.LOCAL,
server_url="SERVER_URL",
communication_protocol=CommunicationProtocol["REST"],
)
pymilo_client.toggle_mode(PymiloClient.Mode.DELEGATE)
result = pymilo_client.predict(x_test)
```
#### PymiloClient
The `PymiloClient` class facilitates working with remote PyMilo servers.
| **Parameter** | **Description** |
| ------------- | --------------- |
| model | The local ML model to wrap around |
| mode | Operating mode (LOCAL or DELEGATE) |
| compressor | Compression method from `Compression` enum |
| server_url | URL of the PyMilo server |
| communication_protocol | Communication protocol from `CommunicationProtocol` enum |
The `mode` parameter accepts two values `LOCAL` to execute operations on the local model, or `DELEGATE` to delegate operations to the remote server. The `compressor` parameter accepts values from the `Compression` enum including `NULL` (no compression), `GZIP`, `ZLIB`, `LZMA`, or `BZ2`. The `communication_protocol` parameter accepts values from the `CommunicationProtocol` enum including `REST` or `WEBSOCKET`.
| **Method** | **Description** |
| ---------- | --------------- |
| toggle_mode | Switch between LOCAL and DELEGATE modes |
| register | Register the client with the remote server |
| deregister | Deregister the client from the server |
| register_ml_model | Register an ML model with the server |
| deregister_ml_model | Deregister an ML model from the server |
| upload | Upload the local model to the remote server |
| download | Download the remote model to local |
| get_ml_models | Get all registered ML models for this client |
| grant_access | Grant access to this client's model to another client |
| revoke_access | Revoke access previously granted to another client |
| get_allowance | Get clients who have access to this client's models |
| get_allowed_models | Get models this client is allowed to access from another client |
ℹ️ If you've deployed `PymiloServer` locally (on port `8000` for instance), then `SERVER_URL` would be `http://127.0.0.1:8000` or `ws://127.0.0.1:8000` based on the selected protocol for the communication medium.
You can also download the remote ML model into your local and execute functions locally on your model.
Calling `download` function on `PymiloClient` will sync the local model that `PymiloClient` wraps upon with the remote ML model, and it doesn't save model directly to a file.
```python
pymilo_client.download()
```
If you want to save the ML model to a file in your local, you can use `Export` class.
```python
from pymilo import Export
Export(pymilo_client.model).save("model.json")
```
Now that you've synced the remote model with your local model, you can run functions.
```python
pymilo_client.toggle_mode(mode=PymiloClient.Mode.LOCAL)
result = pymilo_client.predict(x_test)
```
`PymiloClient` wraps around the ML model, either to the local ML model or the remote ML model, and you can work with `PymiloClient` in the exact same way that you did with the ML model, you can run exact same functions with same signature.
ℹ️ Through the usage of `toggle_mode` function you can specify whether `PymiloClient` applies requests on the local ML model `pymilo_client.toggle_mode(mode=Mode.LOCAL)` or delegates it to the remote server `pymilo_client.toggle_mode(mode=Mode.DELEGATE)`
## Supported ML models
| scikit-learn | PyTorch |
| ---------------- | ---------------- |
| Linear Models ✅ | - |
| Neural Networks ✅ | - |
| Trees ✅ | - |
| Clustering ✅ | - |
| Naïve Bayes ✅ | - |
| Support Vector Machines (SVMs) ✅ | - |
| Nearest Neighbors ✅ | - |
| Ensemble Models ✅ | - |
| Pipeline Model ✅ | - |
| Preprocessing Models ✅ | - |
| Cross Decomposition Models ✅ | - |
| Feature Extractor Models ✅ | - |
| Composite Models ✅ | - |
Details are available in [Supported Models](https://github.com/openscilab/pymilo/blob/main/SUPPORTED_MODELS.md).
## Issues & bug reports
Just fill an issue and describe it. We'll check it ASAP! or send an email to [pymilo@openscilab.com](mailto:pymilo@openscilab.com "pymilo@openscilab.com").
- Please complete the issue template
You can also join our discord server
<a href="https://discord.gg/mtuMS8AjDS">
<img src="https://img.shields.io/discord/1064533716615049236.svg?style=for-the-badge" alt="Discord Channel">
</a>
## Contributing
We welcome contributions! Please read our **[Contributing Guidelines](.github/CONTRIBUTING.md)** before submitting any changes.
## Acknowledgments
[Python Software Foundation (PSF)](https://www.python.org/psf/) grants PyMilo library partially for versions **1.0, 1.1**. [PSF](https://www.python.org/psf/) is the organization behind Python. Their mission is to promote, protect, and advance the Python programming language and to support and facilitate the growth of a diverse and international community of Python programmers.
<a href="https://www.python.org/psf/"><img src="https://github.com/openscilab/pymilo/raw/main/otherfiles/psf.png" height="65px" alt="Python Software Foundation"></a>
[Trelis Research](https://trelis.com/) grants PyMilo library partially for version **1.0**. [Trelis Research](https://trelis.com/) provides tools and tutorials for businesses and developers looking to fine-tune and deploy large language models.
<a href="https://trelis.com/"><img src="https://trelis.com/wp-content/uploads/2023/10/android-chrome-512x512-1.png" height="75px" alt="Trelis Research"></a>
## Cite
If you use PyMilo in your research, we would appreciate citations to the following paper:
[Rostami, A., Haghighi, S., Sabouri, S. and Zolanvari, A., 2025. PyMilo: A Python Library for ML I/O. *Journal of Open Source Software*, 10(116), p.8858.](https://joss.theoj.org/papers/10.21105/joss.08858)
```bibtex
@article{Rostami2025,
doi = {10.21105/joss.08858},
url = {https://doi.org/10.21105/joss.08858},
year = {2025},
publisher = {The Open Journal},
volume = {10},
number = {116},
pages = {8858},
author = {Rostami, AmirHosein and Haghighi, Sepand and Sabouri, Sadra and Zolanvari, Alireza},
title = {PyMilo: A Python Library for ML I/O},
journal = {Journal of Open Source Software}
}
```
Download [PyMilo.bib](https://raw.githubusercontent.com/openscilab/pymilo/main/paper/PyMilo.bib)
<a href="https://doi.org/10.21105/joss.08858">
<img src="https://joss.theoj.org/papers/10.21105/joss.08858/status.svg" alt="JOSS DOI: 10.21105/joss.08858">
</a>
## Show your support
### Star this repo
Give a ⭐️ if this project helped you!
### Donate to our project
If you do like our project and we hope that you do, can you please support us? Our project is not and is never going to be working for profit. We need the money just so we can continue doing what we do ;-) .
<a href="https://openscilab.com/#donation" target="_blank"><img src="https://github.com/openscilab/pymilo/raw/main/otherfiles/donation.png" height="90px" width="270px" alt="PyMilo Donation"></a>
================================================
FILE: SECURITY.md
================================================
# Security policy
## Supported versions
| Version | Supported |
| ------------- | ------------------ |
| 1.6 | :white_check_mark: |
| < 1.6 | :x: |
## Reporting a vulnerability
Please report security vulnerabilities by email to [pymilo@openscilab.com](mailto:pymilo@openscilab.com "pymilo@openscilab.com").
If the security vulnerability is accepted, a dedicated bugfix release will be issued as soon as possible (depending on the complexity of the fix).
================================================
FILE: SUPPORTED_MODELS.md
================================================
# Supported Models
**Last Update: 2025-12-30**
<h2 id="scikit-learn">Scikit-Learn</h2>
<h3 id="scikit-learn-linear">Linear Models</h3>
📚 <a href="https://scikit-learn.org/stable/modules/linear_model.html" target="_blank"><b>Models Document</b></a>
<table>
<tr align="center">
<th>ID</th>
<th>Model Name</th>
<th>PyMilo Version</th>
</tr>
<tr align="center">
<td>1</td>
<td><b>Linear Regressor</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>2</td>
<td><b>Ridge Regressor</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>3</td>
<td><b>Ridge Classifier</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>4</td>
<td><b>Ridge Regressor CV</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>5</td>
<td><b>Ridge Classifier CV</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>6</td>
<td><b>Lasso</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>7</td>
<td><b>Lasso CV</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>8</td>
<td><b>Lasso Lars</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>9</td>
<td><b>Lasso Lars CV</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>10</td>
<td><b>Lasso Lars IC</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>11</td>
<td><b>Multi Task Lasso</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>12</td>
<td><b>Multi Task Lasso CV</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>13</td>
<td><b>Elastic Net</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>14</td>
<td><b>Elastic Net CV</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>15</td>
<td><b>Multi Task Elastic Net</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>16</td>
<td><b>Multi Task Elastic Net CV</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>17</td>
<td><b>Orthogonal Matching Pursuit</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>18</td>
<td><b>Orthogonal Matching Pursuit CV</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>19</td>
<td><b>Bayesian Regressor</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>20</td>
<td><b>Automatic Relevance Determination Regressor</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>21</td>
<td><b>Logistic Regressor</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>22</td>
<td><b>Logistic Regressor CV</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>23</td>
<td><b>Tweedie Regressor</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>24</td>
<td><b>Poisson Regressor</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>25</td>
<td><b>Gamma Regressor</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>26</td>
<td><b>SGD Regressor</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>27</td>
<td><b>SGD Classifier</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>28</td>
<td><b>SGD oneclass SVM</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>29</td>
<td><b>Perceptron</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>30</td>
<td><b>Passive Aggressive Regressor</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>31</td>
<td><b>Passive Aggressive Classifier</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>32</td>
<td><b>OMP</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>33</td>
<td><b>OMP CV</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>34</td>
<td><b>Ransac Regressor</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>35</td>
<td><b>Theil Regressor</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>36</td>
<td><b>Huber Regressor</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>37</td>
<td><b>Quantile Regressor</b></td>
<td>>=0.1</td>
</tr>
</table>
<h3 id="scikit-learn-nn">Neural Networks</h3>
📚 <a href="https://scikit-learn.org/stable/modules/neural_networks_supervised.html" target="_blank"><b>Models Document</b></a>
<table>
<tr align="center">
<th>ID</th>
<th>Model Name</th>
<th>PyMilo Version</th>
</tr>
<tr align="center">
<td>1</td>
<td><b>Multi Layer Perceptron Regression</b></td>
<td>>=0.2</td>
</tr>
<tr align="center">
<td>2</td>
<td><b>Multi Layer Perceptron Classifier</b></td>
<td>>=0.2</td>
</tr>
<tr align="center">
<td>3</td>
<td><b>Bernoulli RBM</b></td>
<td>>=0.2</td>
</tr>
</table>
<h3 id="scikit-learn-trees">Decision Trees</h3>
📚 <a href="https://scikit-learn.org/stable/modules/tree.html" target="_blank"><b>Models Document</b></a>
<table>
<tr align="center">
<th>ID</th>
<th>Model Name</th>
<th>PyMilo Version</th>
</tr>
<tr align="center">
<td>1</td>
<td><b>Decision Tree Regressor</b></td>
<td>>=0.3</td>
</tr>
<tr align="center">
<td>2</td>
<td><b>Decision Tree Classifier</b></td>
<td>>=0.3</td>
</tr>
<tr align="center">
<td>3</td>
<td><b>Extra Tree Regressor</b></td>
<td>>=0.3</td>
</tr>
<tr align="center">
<td>4</td>
<td><b>Extra Tree Classifier</b></td>
<td>>=0.3</td>
</tr>
</table>
<h3 id="scikit-learn-clustering">Clustering Models</h3>
📚 <a href="https://scikit-learn.org/stable/modules/clustering.html" target="_blank"><b>Models Document</b></a>
<table>
<tr align="center">
<th>ID</th>
<th>Model Name</th>
<th>PyMilo Version</th>
</tr>
<tr align="center">
<td>1</td>
<td><b>Kmeans</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>2</td>
<td><b>Bisecting Kmeans</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>3</td>
<td><b>Mini Batch KMeans</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>4</td>
<td><b>Affinity Propagation</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>5</td>
<td><b>Mean Shift</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>6</td>
<td><b>Spectral Clustering</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>7</td>
<td><b>Spectral Biclustering</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>8</td>
<td><b>Spectral Coclustering</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>9</td>
<td><b>Agglomerative Clustering</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>10</td>
<td><b>Feature Agglomeration</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>11</td>
<td><b>DBScan</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>12</td>
<td><b>HDBScan</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>13</td>
<td><b>Optics</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>14</td>
<td><b>Gaussian Mixture</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>15</td>
<td><b>Bayesian Gaussian Mixture</b></td>
<td>>=0.4</td>
</tr>
<tr align="center">
<td>16</td>
<td><b>Birch</b></td>
<td>>=0.4</td>
</tr>
</table>
<h3 id="scikit-learn-naivebayes">Naive Bayes</h3>
📚 <a href="https://scikit-learn.org/stable/modules/naive_bayes.html" target="_blank"><b>Models Document</b></a>
<table>
<tr align="center">
<th>ID</th>
<th>Model Name</th>
<th>PyMilo Version</th>
</tr>
<tr align="center">
<td>1</td>
<td><b>Gaussian Naive Bayes</b></td>
<td>>=0.5</td>
</tr>
<tr align="center">
<td>2</td>
<td><b>Multinomial Naive Bayes</b></td>
<td>>=0.5</td>
</tr>
<tr align="center">
<td>3</td>
<td><b>Bernoulli Naive Bayes</b></td>
<td>>=0.5</td>
</tr>
<tr align="center">
<td>4</td>
<td><b>Complement Naive Bayes</b></td>
<td>>=0.5</td>
</tr>
<tr align="center">
<td>5</td>
<td><b>Categorical Naive Bayes</b></td>
<td>>=0.5</td>
</tr>
</table>
<h3 id="scikit-learn-svm">Support Vector Machine</h3>
📚 <a href="https://scikit-learn.org/stable/modules/svm.html" target="_blank"><b>Models Document</b></a>
<table>
<tr align="center">
<th>ID</th>
<th>Model Name</th>
<th>PyMilo Version</th>
</tr>
<tr align="center">
<td>1</td>
<td><b>Linear SVC</b></td>
<td>>=0.6</td>
</tr>
<tr align="center">
<td>2</td>
<td><b>Linear SVR</b></td>
<td>>=0.6</td>
</tr>
<tr align="center">
<td>3</td>
<td><b>NuSVC</b></td>
<td>>=0.6</td>
</tr>
<tr align="center">
<td>4</td>
<td><b>NuSVR</b></td>
<td>>=0.6</td>
</tr>
<tr align="center">
<td>5</td>
<td><b>One Class SVM</b></td>
<td>>=0.6</td>
</tr>
<tr align="center">
<td>6</td>
<td><b>SVC</b></td>
<td>>=0.6</td>
</tr>
<tr align="center">
<td>7</td>
<td><b>SVR</b></td>
<td>>=0.6</td>
</tr>
</table>
<h3 id="scikit-learn-neighbors">Neighbors</h3>
📚 <a href="https://scikit-learn.org/stable/modules/neighbors.html" target="_blank"><b>Models Document</b></a>
<table>
<tr align="center">
<th>ID</th>
<th>Model Name</th>
<th>PyMilo Version</th>
</tr>
<tr align="center">
<td>1</td>
<td><b>KNeighborsClassifier</b></td>
<td>>=0.7</td>
</tr>
<tr align="center">
<td>2</td>
<td><b>KNeighborsRegressor</b></td>
<td>>=0.7</td>
</tr>
<tr align="center">
<td>3</td>
<td><b>NearestNeighbors</b></td>
<td>>=0.7</td>
</tr>
<tr align="center">
<td>4</td>
<td><b>NearestCentroid</b></td>
<td>>=0.7</td>
</tr>
<tr align="center">
<td>5</td>
<td><b>RadiusNeighborsClassifier</b></td>
<td>>=0.7</td>
</tr>
<tr align="center">
<td>6</td>
<td><b>RadiusNeighborsRegressor</b></td>
<td>>=0.7</td>
</tr>
<tr align="center">
<td>7</td>
<td><b>LocalOutlierFactor</b></td>
<td>>=0.7</td>
</tr>
</table>
<h3 id="scikit-learn-ensemble">Ensemble</h3>
📚 <a href="https://scikit-learn.org/stable/modules/ensemble.html" target="_blank"><b>Models Document</b></a>
<table>
<tr align="center">
<th>ID</th>
<th>Model Name</th>
<th>PyMilo Version</th>
</tr>
<tr align="center">
<td>1</td>
<td><b>AdaboostClassifier</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>2</td>
<td><b>AdaboostRegressor</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>3</td>
<td><b>BaggingClassifier</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>4</td>
<td><b>BaggingRegressor</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>5</td>
<td><b>ExtraTreesClassifier</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>6</td>
<td><b>ExtraTreesRegressor</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>7</td>
<td><b>GradientBoosterClassifier</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>8</td>
<td><b>GradientBoosterRegressor</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>9</td>
<td><b>HistGradientBoostingClassifier</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>10</td>
<td><b>HistGradientBoostingRegressor</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>11</td>
<td><b>RandomForestClassifier</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>12</td>
<td><b>RandomForestRegressor</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>13</td>
<td><b>StackingClassifier</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>14</td>
<td><b>StackingRegressor</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>15</td>
<td><b>VotingClassifier</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>16</td>
<td><b>VotingRegressor</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>17</td>
<td><b>IsolationForest</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>18</td>
<td><b>RandomTreesEmbedding</b></td>
<td>>=0.8</td>
</tr>
</table>
<h3 id="scikit-learn-pipeline">Pipeline</h3>
📚 <a href="https://scikit-learn.org/stable/modules/compose.html#pipeline-chaining-estimators" target="_blank"><b>Models Document</b></a>
<table>
<tr align="center">
<th>ID</th>
<th>Model Name</th>
<th>PyMilo Version</th>
</tr>
<tr align="center">
<td>1</td>
<td><b>Pipeline</b></td>
<td>>=0.8</td>
</tr>
</table>
<h3 id="scikit-learn-preprocessing">Preprocessing Modules</h3>
📚 <a href="https://scikit-learn.org/stable/modules/classes.html#module-sklearn.preprocessing" target="_blank"><b>Models Document</b></a>
<table>
<tr align="center">
<th>ID</th>
<th>Model Name</th>
<th>PyMilo Version</th>
</tr>
<tr align="center">
<td>1</td>
<td><b>OneHotEncoder</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>2</td>
<td><b>LabelBinarizer</b></td>
<td>>=0.1</td>
</tr>
<tr align="center">
<td>3</td>
<td><b>LabelEncoder</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>4</td>
<td><b>StandardScaler</b></td>
<td>>=0.8</td>
</tr>
<tr align="center">
<td>5</td>
<td><b>Binarizer</b></td>
<td>>=0.9</td>
</tr>
<tr align="center">
<td>6</td>
<td><b>FunctionTransformer</b></td>
<td>>=0.9</td>
</tr>
<tr align="center">
<td>7</td>
<td><b>KernelCenterer</b></td>
<td>>=0.9</td>
</tr>
<tr align="center">
<td>8</td>
<td><b>MultiLabelBinarizer</b></td>
<td>>=0.9</td>
</tr>
<tr align="center">
<td>9</td>
<td><b>MaxAbsScaler</b></td>
<td>>=0.9</td>
</tr>
<tr align="center">
<td>10</td>
<td><b>Normalizer</b></td>
<td>>=0.9</td>
</tr>
<tr align="center">
<td>11</td>
<td><b>OrdinalEncoder</b></td>
<td>>=0.9</td>
</tr>
<tr align="center">
<td>12</td>
<td><b>PolynomialFeatures</b></td>
<td>>=0.9</td>
</tr>
<tr align="center">
<td>13</td>
<td><b>RobustScaler</b></td>
<td>>=0.9</td>
</tr>
<tr align="center">
<td>14</td>
<td><b>QuantileTransformer</b></td>
<td>>=0.9</td>
</tr>
<tr align="center">
<td>15</td>
<td><b>KBinsDiscretizer</b></td>
<td>>=0.9</td>
</tr>
<tr align="center">
<td>16</td>
<td><b>PowerTransformer</b></td>
<td>>=0.9</td>
</tr>
<tr align="center">
<td>17</td>
<td><b>SplineTransformer</b></td>
<td>>=0.9</td>
</tr>
<tr align="center">
<td>18</td>
<td><b>TargetEncoder</b></td>
<td>>=0.9</td>
</tr>
</table>
<h3 id="scikit-learn-cross-decomposition">Cross Decomposition Modules</h3>
📚 <a href="https://scikit-learn.org/stable/api/sklearn.cross_decomposition.html" target="_blank"><b>Models Document</b></a>
<table>
<tr align="center">
<th>ID</th>
<th>Model Name</th>
<th>PyMilo Version</th>
</tr>
<tr align="center">
<td>1</td>
<td><b>PLSRegression</b></td>
<td>>=1.1</td>
</tr>
<tr align="center">
<td>2</td>
<td><b>PLSCanonical</b></td>
<td>>=1.1</td>
</tr>
<tr align="center">
<td>3</td>
<td><b>CCA</b></td>
<td>>=1.1</td>
</tr>
</table>
<h3 id="scikit-learn-feature-extraction">Feature Extraction Modules</h3>
📚 <a href="https://scikit-learn.org/stable/api/sklearn.feature_extraction.html" target="_blank"><b>Models Document</b></a>
<table>
<tr align="center">
<th>ID</th>
<th>Model Name</th>
<th>PyMilo Version</th>
</tr>
<tr align="center">
<td>1</td>
<td><b>DictVectorizer</b></td>
<td>>=1.3</td>
</tr>
<tr align="center">
<td>2</td>
<td><b>FeatureHasher</b></td>
<td>>=1.3</td>
</tr>
<tr align="center">
<td>3</td>
<td><b>PatchExtractor</b></td>
<td>>=1.3</td>
</tr>
<tr align="center">
<td>4</td>
<td><b>CountVectorizer</b></td>
<td>>=1.3</td>
</tr>
<tr align="center">
<td>5</td>
<td><b>HashingVectorizer</b></td>
<td>>=1.3</td>
</tr>
<tr align="center">
<td>6</td>
<td><b>TfidfTransformer</b></td>
<td>>=1.3</td>
</tr>
<tr align="center">
<td>7</td>
<td><b>TfidfVectorizer</b></td>
<td>>=1.3</td>
</tr>
</table>
<h3 id="scikit-learn-feature-extraction">Composite Modules</h3>
📚 <a href="https://scikit-learn.org/stable/api/sklearn.compose.html" target="_blank"><b>Models Document</b></a>
<table>
<tr align="center">
<th>ID</th>
<th>Model Name</th>
<th>PyMilo Version</th>
</tr>
<tr align="center">
<td>1</td>
<td><b>ColumnTransformer</b></td>
<td>>=1.5</td>
</tr>
<tr align="center">
<td>2</td>
<td><b>TransformedTargetRegressor</b></td>
<td>>=1.5</td>
</tr>
</table>
================================================
FILE: autopep8.bat
================================================
python -m autopep8 pymilo --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --verbose --ignore=E721
python -m autopep8 otherfiles --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --verbose --ignore=E721
python -m autopep8 setup.py --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --verbose
================================================
FILE: autopep8.sh
================================================
#!/bin/sh
python -m autopep8 pymilo --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --verbose --ignore=E721
python -m autopep8 otherfiles --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --verbose --ignore=E721
python -m autopep8 setup.py --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --verbose
================================================
FILE: codecov.yml
================================================
codecov:
require_ci_to_pass: yes
coverage:
precision: 2
round: up
range: "70...100"
status:
patch:
default:
enabled: no
project:
default:
threshold: 1%
================================================
FILE: dev-requirements.txt
================================================
numpy==2.2.4
scikit-learn==1.6.1
scipy>=0.19.1
uvicorn==0.39.0
fastapi==0.128.8
requests==2.32.5
websockets==15.0.1
pydantic==2.12.5
setuptools>=40.8.0
vulture>=1.0
bandit>=1.5.1
pydocstyle>=3.0.0
pytest>=4.3.1
pytest-cov>=2.6.1
Pillow>=8.4.0
================================================
FILE: otherfiles/RELEASE.md
================================================
# PyMilo Release Instructions
#### Last Update: 2024-04-24
1. Create the `release` branch under `dev`
2. Update all version tags
1. `setup.py`
2. `README.md`
3. `SECURITY.md`
4. `otherfiles/version_check.py`
5. `otherfiles/meta.yaml`
6. `pymilo/pymilo_param.py`
3. Update `CHANGELOG.md`
1. Add a new header under `Unreleased` section (Example: `## [0.1] - 2022-08-17`)
2. Add a new compare link to the end of the file (Example: `[0.2]: https://github.com/openscilab/pymilo/compare/v0.1...v0.2`)
3. Update `dev` compare link (Example: `[Unreleased]: https://github.com/openscilab/pymilo/compare/v0.2...dev`)
4. Update `.github/ISSUE_TEMPLATE/bug_report.yml`
1. Add new version tag to `PyMilo version` dropbox options
5. Create a PR from `release` to `dev`
1. Title: `Version x.x` (Example: `Version 0.1`)
2. Tag all related issues
3. Labels: `release`
4. Set milestone
5. Wait for all CI pass
6. Need review (**2** reviewers)
7. Squash and merge
8. Delete `release` branch
6. Merge `dev` branch into `main`
1. `git checkout main`
2. `git merge dev`
3. `git push origin main`
4. Wait for all CI pass
7. Create a new release
1. Target branch: `main`
2. Tag: `vx.x` (Example: `v0.1`)
3. Title: `Version x.x` (Example: `Version 0.1`)
4. Copy changelogs
5. Tag all related issues
8. Bump!!
9. Close this version issues
10. Close milestone
================================================
FILE: otherfiles/meta.yaml
================================================
{% set name = "pymilo" %}
{% set version = "1.6" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
git_url: https://github.com/openscilab/pymilo
git_rev: v{{ version }}
build:
noarch: python
number: 0
script: {{ PYTHON }} -m pip install . -vv
requirements:
host:
- pip
- setuptools
- python >=3.7
run:
- python >=3.7
- numpy >=1.9.0
- scikit-learn >=0.22.2
- scipy >=0.19.1
- requests>=2.0.0
- uvicorn>=0.14.0
- fastapi>=0.68.0
- pydantic>=1.5.0
- websockets>=9.0
about:
home: https://github.com/openscilab/pymilo
license: MIT
license_family: MIT
summary: Python library for machine learning input and output
description: |
Pymilo is an open source Python package that provides a simple, efficient, and
safe way for users to export pre-trained machine learning models in a transparent way.
By this, the exported model can be used in other environments, transferred across different platforms,
and shared with others. Pymilo allows the users to export the models that are
trained using popular Python libraries like scikit-learn, and then use them in deployment environments,
or share them without exposing the underlying code or dependencies.
The transparency of the exported models ensures reliability and safety for the end users,
as it eliminates the risks of binary or pickle formats.
Website: https://openscilab.com
Repo: https://github.com/openscilab/pymilo
extra:
recipe-maintainers:
- AHReccese
================================================
FILE: otherfiles/requirements-splitter.py
================================================
# -*- coding: utf-8 -*-
"""Requirements splitter."""
test_req = ""
with open('dev-requirements.txt', 'r') as f:
for line in f:
if '==' not in line:
test_req += line
with open('test-requirements.txt', 'w') as f:
f.write(test_req)
================================================
FILE: otherfiles/version_check.py
================================================
# -*- coding: utf-8 -*-
"""Version-check script."""
import os
import sys
import codecs
Failed = 0
PYMILO_VERSION = "1.6"
SETUP_ITEMS = [
"version='{0}'",
'https://github.com/openscilab/pymilo/tarball/v{0}']
README_ITEMS = [
"[Version {0}](https://github.com/openscilab/pymilo/archive/v{0}.zip)",
"pip install pymilo=={0}"]
CHANGELOG_ITEMS = [
"## [{0}]",
"https://github.com/openscilab/pymilo/compare/v{0}...dev",
"[{0}]:"]
PARAMS_ITEMS = ['PYMILO_VERSION = "{0}"']
META_ITEMS = ['% set version = "{0}" %']
ISSUE_TEMPLATE_ITEMS = ["- PyMilo {0}"]
SECURITY_ITEMS = ["| {0} | :white_check_mark: |", "| < {0} | :x: |"]
FILES = {
os.path.join("otherfiles", "meta.yaml"): META_ITEMS,
"setup.py": SETUP_ITEMS,
"README.md": README_ITEMS,
"CHANGELOG.md": CHANGELOG_ITEMS,
"SECURITY.md": SECURITY_ITEMS,
os.path.join("pymilo", "pymilo_param.py"): PARAMS_ITEMS,
os.path.join(".github", "ISSUE_TEMPLATE", "bug_report.yml"): ISSUE_TEMPLATE_ITEMS,
}
TEST_NUMBER = len(FILES)
def print_result(failed=False):
"""
Print final result.
:param failed: failed flag
:type failed: bool
:return: None
"""
message = "Version tag tests "
if not failed:
print("\n" + message + "passed!")
else:
print("\n" + message + "failed!")
print("Passed : " + str(TEST_NUMBER - Failed) + "/" + str(TEST_NUMBER))
if __name__ == "__main__":
for file_name in FILES:
try:
file_content = codecs.open(
file_name, "r", "utf-8", 'ignore').read()
for test_item in FILES[file_name]:
if file_content.find(test_item.format(PYMILO_VERSION)) == -1:
print("Incorrect version tag in " + file_name)
Failed += 1
break
except Exception as e:
Failed += 1
print("Error in " + file_name + "\n" + "Message : " + str(e))
if Failed == 0:
print_result(False)
sys.exit(0)
else:
print_result(True)
sys.exit(1)
================================================
FILE: paper/.gitignore
================================================
/refs
================================================
FILE: paper/PyMilo.bib
================================================
@article{Rostami2025,
doi = {10.21105/joss.08858},
url = {https://doi.org/10.21105/joss.08858},
year = {2025},
publisher = {The Open Journal},
volume = {10},
number = {116},
pages = {8858},
author = {Rostami, AmirHosein and Haghighi, Sepand and Sabouri, Sadra and Zolanvari, Alireza},
title = {PyMilo: A Python Library for ML I/O},
journal = {Journal of Open Source Software}
}
================================================
FILE: paper/paper.bib
================================================
@article{Raschka2020,
author = {Sebastian Raschka and Joshua Patterson and Corey Nolet},
title = {Machine Learning in {P}ython: Main Developments and Technology Trends in Data Science, Machine Learning, and Artificial Intelligence},
journal = {Information},
volume = {11},
number = {4},
pages = {193},
year = {2020},
doi = {10.3390/info11040193}
}
@inproceedings{parida2025model,
author={Parida, Shreyas Kumar and Gerostathopoulos, Ilias and Bogner, Justus},
booktitle={2025 IEEE/ACM 4th International Conference on AI Engineering – Software Engineering for AI (CAIN)},
title={How Do Model Export Formats Impact the Development of {ML}-Enabled Systems? A Case Study on Model Integration},
year={2025},
volume={},
number={},
pages={48-59},
doi={10.1109/CAIN66642.2025.00014}
}
@inproceedings{davis2023reusing,
title={Reusing Deep Learning Models: Challenges and Directions in Software Engineering},
author={Davis, James C and Jajal, Purvish and Jiang, Wenxin and Schorlemmer, Taylor R and Synovic, Nicholas and Thiruvathukal, George K},
booktitle={2023 IEEE John Vincent Atanasoff International Symposium on Modern Computing (JVA)},
pages={17--30},
year={2023},
organization={IEEE},
doi={10.1109/JVA60410.2023.00015}
}
@article{Garbin2022,
author = {Cristina Garbin and Osvaldo Marques},
title = {Assessing Methods and Tools to Improve Reporting, Increase Transparency, and Reduce Failures in Machine Learning Applications in Health Care},
journal = {Radiology: Artificial Intelligence},
volume = {4},
number = {2},
pages = {e210127},
year = {2022},
doi = {10.1148/ryai.210127},
}
@article{bodimani2024assessing,
title={Assessing The Impact of Transparent {AI} Systems in Enhancing User Trust and Privacy},
volume={5},
url={https://thesciencebrigade.com/jst/article/view/68},
number={1},
journal={Journal of Science \& Technology},
author={Bodimani, Meghasai},
year={2024},
month={Feb.},
pages={50–67},
}
@misc{Brownlee2018,
author = {Jason Brownlee},
title = {Save and Load Machine Learning Models in {P}ython with scikit-learn},
howpublished = {\url{https://machinelearningmastery.com/save-load-machine-learning-models-python-scikit-learn/}},
year = {2018},
note = {Accessed: 2024-05-22}
}
@misc{PythonPickleDocs,
author = {{Python Software Foundation}},
title = {{p}ickle — {P}ython object serialization},
year = {2024},
howpublished = {\url{https://docs.python.org/3/library/pickle.html#security}},
}
@software{onnx,
author = {Bai, Junjie and Lu, Fang and Zhang, Ke and others},
title = {{ONNX} ({O}pen {N}eural {N}etwork {E}xchange)},
url = {https://github.com/onnx/onnx},
version = {1.18.0},
date = {2025-05-12},
}
@article{pmml,
title={{PMML}: An Open Standard for Sharing Models},
author={Guazzelli, Alex and Zeller, Michael and Lin, Wen-Ching and Williams, Graham},
year={2009},
doi={10.32614/RJ-2009-010}
}
@article{jajal2023analysis,
title={Analysis of Failures and Risks in Deep Learning Model Converters: A Case Study in the {ONNX} Ecosystem},
author={Jajal, Purvish and Jiang, Wenxin and Tewari, Arav and Kocinare, Erik and Woo, Joseph and Sarraf, Anusha and Lu, Yung-Hsiang and Thiruvathukal, George K and Davis, James C},
journal={arXiv preprint arXiv:2303.17708},
year={2023},
doi={10.48550/arXiv.2303.17708}
}
@inproceedings{cody2024extending,
title={On Extending the {A}utomatic {T}est {M}arkup {L}anguage ({ATML}) for Machine Learning},
author={Cody, Tyler and Li, Bingtong and Beling, Peter},
booktitle={2024 IEEE International Systems Conference (SysCon)},
pages={1--8},
year={2024},
organization={IEEE},
doi={10.1109/SysCon61195.2024.10553464}
}
@software{skops,
author = {{skops-dev}},
title = {{SKOPS}},
url = {https://github.com/skops-dev/skops},
version = {0.11.0},
date = {2024-12-10},
}
@article{tfjs2019,
title={Tensor{F}low.js: Machine Learning for the Web and Beyond},
author={Smilkov, Daniel and Thorat, Nikhil and Assogba, Yannick and Nicholson, Charles and Kreeger, Nick and Yu, Ping and Cai, Shanqing and Nielsen, Eric and Soegel, David and Bileschi, Stan and others},
journal={Proceedings of Machine Learning and Systems},
volume={1},
pages={309--321},
year={2019},
doi={10.48550/arXiv.1901.05350}
}
@inproceedings{quan2022towards,
title={Towards Understanding the Faults of {J}ava{S}cript-Based Deep Learning Systems},
author={Quan, Lili and Guo, Qianyu and Xie, Xiaofei and Chen, Sen and Li, Xiaohong and Liu, Yang},
booktitle={Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering},
pages={1--13},
year={2022},
doi={10.1145/3551349.3560427}
}
@misc{NerdCorner2025,
author = {{Nerd Corner}},
title = {Tensor{F}low.js vs {T}ensor{F}low ({P}ython)},
year = {2025},
month = {Mar},
howpublished = {\url{https://nerd-corner.com/tensorflow-js-vs-tensorflow-python/}}
}
@inproceedings{rauker2023toward,
title={Toward Transparent {AI}: A Survey on Interpreting the Inner Structures of Deep Neural Networks},
author={R{\"a}uker, Tilman and Ho, Anson and Casper, Stephen and Hadfield-Menell, Dylan},
booktitle={2023 ieee conference on secure and trustworthy machine learning (satml)},
pages={464--483},
year={2023},
organization={IEEE},
doi={10.1109/SaTML54575.2023.00039}
}
@article{macrae2019governing,
title={Governing the safety of artificial intelligence in healthcare},
author={Macrae, Carl},
journal={BMJ quality \& safety},
volume={28},
number={6},
pages={495--498},
year={2019},
publisher={BMJ Publishing Group Ltd},
doi={10.1136/bmjqs-2019-009484}
}
@software{huggingface_safetensors_2022,
author = {{Hugging Face}},
title = {Safetensors - {ML} Safer for All},
year = {2025},
version = {0.6.2},
url = {https://github.com/huggingface/safetensors},
}
================================================
FILE: paper/paper.md
================================================
---
title: 'PyMilo: A Python Library for ML I/O'
tags:
- Machine Learning
- Model Deployment
- Model Serialization
- Transparency
- MLOPS
authors:
- name: AmirHosein Rostami
orcid: 0009-0000-0638-2263
corresponding: true
affiliation: "1, 2"
- name: Sepand Haghighi
orcid: 0000-0001-9450-2375
corresponding: false
affiliation: 1
- name: Sadra Sabouri
orcid: 0000-0003-1047-2346
corresponding: false
affiliation: "1, 3"
- name: Alireza Zolanvari
orcid: 0000-0003-2367-8343
corresponding: false
affiliation: 1
affiliations:
- index: 1
name: Open Science Lab
- index: 2
name: University of Toronto, Toronto, Canada
ror: 03dbr7087
- index: 3
name: University of Southern California, Los Angeles, United States
ror: 03taz7m60
date: 24 June 2025
bibliography: paper.bib
---
# Summary
PyMilo is an open-source Python package that addresses the limitations of existing machine learning (ML) model storage formats by providing a transparent, reliable, end-to-end, and safe method for exporting and deploying trained models.
Current tools rely on black-box or executable formats that obscure internal model structures, making them difficult to audit, verify, or safely share. Meanwhile, tensor-centric formats such as Safetensors [@huggingface_safetensors_2022] securely store and transfer numerical tensors but do not capture the internal and structural composition of classical machine-learning models (e.g., scikit-learn pipelines), which remain PyMilo’s primary focus.
Others apply structural transformations during export that may degrade predictive performance and reduce the model to a limited inference-only interface.
In contrast, PyMilo serializes models in a transparent human-readable format that preserves end-to-end model fidelity and enables reliable, safe, and interpretable exchange. Here, transparent refers to the ability to inspect model internals through a human-readable structure without execution, and end-to-end fidelity denotes that a model exported and re-imported with PyMilo retains the exact same signature, functionality, parameters, and internal structure as the original, ensuring complete behavioral and structural equivalence.
This package is designed to make the preservation and reuse of trained ML models safer, more interpretable, and easier to manage across different stages of the ML workflow (\autoref{fig:overall}).

\newpage
# Statement of Need
Modern machine learning development is largely centered around the Python ecosystem, which has become a dominant platform for building and training models due to its rich libraries and community support [@Raschka2020].
However, once a model is trained, sharing or deploying it securely and transparently remains a significant challenge [@parida2025model; @davis2023reusing]. This issue is especially important in high-stakes domains such as healthcare, where ensuring model accountability and integrity is critical [@Garbin2022].
In such settings, any lack of clarity about a model’s internal logic or origin can reduce trust in its predictions. Researchers have increasingly emphasized that greater transparency in AI systems is critical for maintaining user trust and protecting privacy in machine learning applications [@bodimani2024assessing].
Despite ongoing concerns around transparency and safety, the dominant approach for exchanging pretrained models remains ad hoc binary serialization, most commonly through Python’s `pickle` module or its variant `joblib`.
These formats allow developers to store complex model objects with minimal effort, but they were never designed with security or human interpretability in mind [@parida2025model]. In fact, loading a pickle file may execute arbitrary code contained within it, a known vulnerability that can be exploited if the file is maliciously crafted [@Brownlee2018; @PythonPickleDocs].
While these methods preserve full model fidelity within the Python ecosystem, they pose serious security risks and lack transparency, as the serialized files are opaque binary blobs that cannot be inspected without loading.
Furthermore, compatibility is fragile because pickled models often depend on specific library versions, which may hinder long-term reproducibility [@Brownlee2018].
To improve portability across environments, several standardized model interchange formats have been developed alongside `pickle`.
Most notably, Open Neural Network Exchange (ONNX) and Predictive Model Markup Language (PMML) convert trained models into framework-agnostic representations [@onnx; @pmml], enabling deployment in diverse systems without relying on the original training code.
ONNX uses a graph-based structure built from primitive operators (e.g., linear transforms, activations), while PMML provides an XML-based specification for traditional models like decision trees and regressions.
Although these formats enhance security by avoiding executable serialization, they introduce compatibility and fidelity challenges.
Exporting complex pipelines to ONNX or PMML often leads to structural approximations, missing metadata, or unsupported components, especially for customized models [@pmml].
As a result, the exported model may differ in behavior, resulting in performance degradation or loss of accuracy [@jajal2023analysis].
@jajal2023analysis found that models exported to ONNX can produce incorrect predictions despite successful conversion, indicating semantic inconsistencies between the original and exported versions. This reflects predictive performance degradation and highlights the risks of silent behavioral drift in deployed systems.
Beyond concerns about end-to-end model preservation, ONNX and PMML also present limitations in transparency, scope, and reversibility. ONNX uses a binary protocol buffer format that is not human-readable, which limits interpretability and makes auditing difficult.
PMML, although XML-based and readable, is verbose and narrowly scoped, supporting only a limited subset of scikit-learn models. As noted by @cody2024extending, both ONNX and PMML focus on static model specification rather than operational testing or lifecycle validation workflows. Moreover, PMML does not provide a mechanism to restore exported models into Python, making it a one-way format that limits reproducibility across ML workflows.
Other tools have been developed to address specific use cases, though they remain limited in scope. For example, SKOPS improves the safety of scikit-learn model storage by enabling limited inspection of model internals without requiring code execution [@skops].
However, it supports only scikit-learn models, lacks compatibility with other frameworks, and does not provide a fully transparent or human-readable structure.
TensorFlow.js targets JavaScript environments by converting TensorFlow or Keras models into a JSON configuration file and binary weight files for execution in the browser or Node.js [@tfjs2019].
However, this process has been shown to introduce compatibility issues, performance degradation, and inconsistencies in inference behavior due to backend limitations and environment-specific faults [@quan2022towards].
Models from other frameworks, such as scikit-learn or PyTorch, must be re-implemented or retrained in TensorFlow to be exported.
Additionally, running complex models in JavaScript runtimes introduces memory and performance limitations, often making the deployment of large neural networks prohibitively slow or even infeasible in browser environments [@NerdCorner2025].
In summary, current solutions force practitioners into trade-offs between security, transparency, end-to-end fidelity, and performance preservation.
The machine learning community still lacks a safe and transparent end-to-end model serialization framework through which users can securely share models, inspect them easily, and accurately reconstruct them for use across diverse frameworks and environments.
PyMilo is proposed to address the above gaps. It is an open-source Python library that provides an end-to-end solution for exporting and importing machine learning models in a safe, non-executable, and human-readable format such as JSON. PyMilo serializes trained models into a transparent format and fully reconstructs them without structural changes, preserving their original functionality and behavior.
This process does not affect inference time or performance and imports models on any target device without additional dependencies, enabling seamless execution in inference mode.
While PyMilo may import functions from widely used scientific libraries during deserialization to restore model behavior (for example, NumPy or SciPy), the JSON representation itself never contains executable code; any remaining security risk is therefore inherited from these already-trusted dependencies rather than introduced by PyMilo’s serialization mechanism.
PyMilo benefits a wide range of stakeholders, including machine learning engineers, data scientists, and AI practitioners, by facilitating the development of more transparent and accountable AI systems. Furthermore, researchers working on transparent AI [@rauker2023toward], user privacy in ML [@bodimani2024assessing], and safe AI [@macrae2019governing] can use PyMilo as a framework that provides transparency and safety in the machine learning environment.
# References
================================================
FILE: pymilo/__init__.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo modules."""
from .pymilo_param import PYMILO_VERSION
from .pymilo_obj import Export, Import
from .exceptions import PymiloException, PymiloSerializationException, PymiloDeserializationException
__version__ = PYMILO_VERSION
================================================
FILE: pymilo/__main__.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo main."""
import re
import argparse
from art import tprint
from .pymilo_param import (
PYMILO_VERSION,
URL_REGEX,
CLI_MORE_INFO,
CLI_UNKNOWN_MODEL,
CLI_ML_STREAMING_NOT_INSTALLED,
)
from .pymilo_func import print_supported_ml_models, pymilo_help
from .pymilo_obj import Import
from .utils.util import get_sklearn_class
ml_streaming_support = True
try:
from .streaming import PymiloServer, Compression, CommunicationProtocol
except BaseException:
ml_streaming_support = False
def main():
"""
CLI main function.
:return: None
"""
parser = argparse.ArgumentParser(description='Run the Pymilo server with a specified compression method.')
parser.add_argument(
'--compression',
type=str,
choices=['NULL', 'GZIP', 'ZLIB', 'LZMA', 'BZ2'],
default='NULL',
help='Specify the compression method (NULL, GZIP, ZLIB, LZMA, or BZ2). Default is NULL.'
)
parser.add_argument(
'--port',
type=int,
default=8000,
help='Specify PyMiloServer port number',
metavar="",
)
parser.add_argument(
'--protocol',
type=str,
choices=['REST', 'WEBSOCKET'],
default='REST',
help='Specify the communication protocol (REST or WEBSOCKET). Default is REST.'
)
parser.add_argument(
'--load',
type=str,
default=None,
help='the `load` command specifies the path to the JSON file of the previously exported ML model by PyMilo.',
metavar="",
)
parser.add_argument(
'--init',
type=str,
default=None,
help='the `init` command specifies the ML model to initialize the PyMilo Server with.',
metavar="",
)
parser.add_argument(
'--bare',
default=False,
action='store_true',
help='The `bare` command starts the PyMilo Server without an internal ML model.',
)
parser.add_argument('--version', action='store_true', default=False, help='PyMilo version')
parser.add_argument('-v', action='store_true', default=False, help='PyMilo version')
args = parser.parse_args()
if args.version or args.v:
print(PYMILO_VERSION)
return
if not ml_streaming_support:
print(CLI_ML_STREAMING_NOT_INSTALLED)
print(CLI_MORE_INFO)
tprint("PyMilo")
tprint("V:" + PYMILO_VERSION)
pymilo_help()
parser.print_help()
return
run_ps = False
_model = None
_port = args.port
_compressor = Compression[args.compression]
_communication_protocol = CommunicationProtocol[args.protocol]
if args.load:
path = args.load
run_ps = True
_model = Import(url=path) if re.match(URL_REGEX, path) else Import(file_adr=path)
_model = _model.to_model()
elif args.init:
model_name = args.init
model_class = get_sklearn_class(model_name)
if model_class is None:
print(f"{CLI_UNKNOWN_MODEL}\n{print_supported_ml_models()}")
return
run_ps = True
_model = model_class()
elif args.bare:
run_ps = True
if not run_ps:
tprint("PyMilo")
tprint("V:" + PYMILO_VERSION)
pymilo_help()
parser.print_help()
else:
PymiloServer(
model=_model,
port=_port,
compressor=_compressor,
communication_protocol=_communication_protocol,
).communicator.run()
if __name__ == '__main__':
main()
================================================
FILE: pymilo/chains/__init__.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo chains."""
================================================
FILE: pymilo/chains/chain.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo Chain Module."""
from traceback import format_exc
from abc import ABC, abstractmethod
from ..utils.util import get_sklearn_type
from ..transporters.transporter import Command
from ..exceptions.serialize_exception import PymiloSerializationException, SerializationErrorTypes
from ..exceptions.deserialize_exception import PymiloDeserializationException, DeserializationErrorTypes
class Chain(ABC):
"""
Chain Interface.
Each Chain serializes/deserializes the given model.
"""
@abstractmethod
def is_supported(self, model):
"""
Check if the given model is a sklearn's ML model supported by this chain.
:param model: a string name of an ML model or a sklearn object of it
:type model: any object
:return: check result as bool
"""
@abstractmethod
def transport(self, request, command, is_inner_model=False):
"""
Return the transported (serialized or deserialized) model.
:param request: given ML model to be transported
:type request: any object
:param command: command to specify whether the request should be serialized or deserialized
:type command: transporter.Command
:param is_inner_model: determines whether it is an inner model of a super ML model
:type is_inner_model: boolean
:return: the transported request as a json string or sklearn ML model
"""
@abstractmethod
def serialize(self, model):
"""
Return the serialized json string of the given model.
:param model: given ML model to be get serialized
:type model: sklearn ML model
:return: the serialized json string of the given ML model
"""
@abstractmethod
def deserialize(self, serialized_model, is_inner_model=False):
"""
Return the associated sklearn ML model of the given previously serialized ML model.
:param serialized_model: given json string of a ML model to get deserialized to associated sklearn ML model
:type serialized_model: obj
:param is_inner_model: determines whether it is an inner ML model of a super ML model
:type is_inner_model: boolean
:return: associated sklearn ML model
"""
@abstractmethod
def validate(self, model, command):
"""
Check if the provided inputs are valid in relation to each other.
:param model: a sklearn ML model or a json string of it, serialized through the pymilo export
:type model: obj
:param command: command to specify whether the request should be serialized or deserialized
:type command: transporter.Command
:return: None
"""
class AbstractChain(Chain):
"""Abstract Chain with the general implementation of the Chain interface."""
def __init__(self, transporters, supported_models):
"""
Initialize the AbstractChain instance.
:param transporters: worker transporters dedicated to this chain
:type transporters: transporter.AbstractTransporter[]
:param supported_models: supported sklearn ML models belong to this chain
:type supported_models: dict
:return: an instance of the AbstractChain class
"""
self._transporters = transporters
self._supported_models = supported_models
def is_supported(self, model):
"""
Check if the given model is a sklearn's ML model supported by this chain.
:param model: a string name of an ML model or a sklearn object of it
:type model: any object
:return: check result as bool
"""
model_name = model if isinstance(model, str) else get_sklearn_type(model)
return model_name in self._supported_models
def transport(self, request, command, is_inner_model=False):
"""
Return the transported (serialized or deserialized) model.
:param request: given ML model to be transported
:type request: any object
:param command: command to specify whether the request should be serialized or deserialized
:type command: transporter.Command
:param is_inner_model: determines whether it is an inner model of a super ML model
:type is_inner_model: boolean
:return: the transported request as a json string or sklearn ML model
"""
if not is_inner_model:
self.validate(request, command)
if command == Command.SERIALIZE:
try:
return self.serialize(request)
except Exception as e:
raise PymiloSerializationException(
{
'error_type': SerializationErrorTypes.VALID_MODEL_INVALID_INTERNAL_STRUCTURE,
'error': {
'Exception': repr(e),
'Traceback': format_exc(),
},
'object': request,
})
elif command == Command.DESERIALIZE:
try:
return self.deserialize(request, is_inner_model)
except Exception as e:
raise PymiloDeserializationException(
{
'error_type': DeserializationErrorTypes.VALID_MODEL_INVALID_INTERNAL_STRUCTURE,
'error': {
'Exception': repr(e),
'Traceback': format_exc()},
'object': request
})
def serialize(self, model):
"""
Return the serialized json string of the given model.
:param model: given ML model to be get serialized
:type model: sklearn ML model
:return: the serialized json string of the given ML model
"""
for transporter in self._transporters:
self._transporters[transporter].transport(model, Command.SERIALIZE)
return model.__dict__
def deserialize(self, serialized_model, is_inner_model=False):
"""
Return the associated sklearn ML model of the given previously serialized ML model.
:param serialized_model: given json string of a ML model to get deserialized to associated sklearn ML model
:type serialized_model: obj
:param is_inner_model: determines whether it is an inner ML model of a super ML model
:type is_inner_model: boolean
:return: associated sklearn ML model
"""
raw_model = None
data = None
if is_inner_model:
raw_model = self._supported_models[serialized_model["type"]]()
data = serialized_model["data"]
else:
raw_model = self._supported_models[serialized_model.type]()
data = serialized_model.data
for transporter in self._transporters:
self._transporters[transporter].transport(
serialized_model, Command.DESERIALIZE, is_inner_model)
for item in data:
setattr(raw_model, item, data[item])
return raw_model
def validate(self, model, command):
"""
Check if the provided inputs are valid in relation to each other.
:param model: a sklearn ML model or a json string of it, serialized through the pymilo export
:type model: obj
:param command: command to specify whether the request should be serialized or deserialized
:type command: transporter.Command
:return: None
"""
if command == Command.SERIALIZE:
if self.is_supported(model):
return
else:
raise PymiloSerializationException(
{
'error_type': SerializationErrorTypes.INVALID_MODEL,
'object': model
}
)
elif command == Command.DESERIALIZE:
if self.is_supported(model.type):
return
else:
raise PymiloDeserializationException(
{
'error_type': DeserializationErrorTypes.INVALID_MODEL,
'object': model
}
)
================================================
FILE: pymilo/chains/clustering_chain.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo chain for Clustering models."""
from ..chains.chain import AbstractChain
from ..pymilo_param import SKLEARN_CLUSTERING_TABLE, NOT_SUPPORTED
from ..transporters.cfnode_transporter import CFNodeTransporter
from ..transporters.function_transporter import FunctionTransporter
from ..transporters.general_data_structure_transporter import GeneralDataStructureTransporter
from ..transporters.preprocessing_transporter import PreprocessingTransporter
CLUSTERING_CHAIN = {
"PreprocessingTransporter": PreprocessingTransporter(),
"GeneralDataStructureTransporter": GeneralDataStructureTransporter(),
"FunctionTransporter": FunctionTransporter(),
"CFNodeTransporter": CFNodeTransporter(),
}
if SKLEARN_CLUSTERING_TABLE["BisectingKMeans"] != NOT_SUPPORTED:
from ..transporters.bisecting_tree_transporter import BisectingTreeTransporter
from ..transporters.randomstate_transporter import RandomStateTransporter
CLUSTERING_CHAIN["RandomStateTransporter"] = RandomStateTransporter()
CLUSTERING_CHAIN["BisectingTreeTransporter"] = BisectingTreeTransporter()
clustering_chain = AbstractChain(CLUSTERING_CHAIN, SKLEARN_CLUSTERING_TABLE)
================================================
FILE: pymilo/chains/compose_chain.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo chain for compose models."""
from ..chains.chain import AbstractChain
from ..transporters.compose_transporter import ComposeTransporter
from ..transporters.general_data_structure_transporter import GeneralDataStructureTransporter
from ..transporters.function_transporter import FunctionTransporter
from ..transporters.transporter import Command
from ..pymilo_param import SKLEARN_COMPOSE_TABLE
COMPOSE_CHAIN = {
"ComposeTransporter": ComposeTransporter(),
"GeneralDataStructureTransporter": GeneralDataStructureTransporter(),
"FunctionTransporter": FunctionTransporter(),
}
class ComposeModelChain(AbstractChain):
"""ComposeModelChain developed to handle sklearn Compose ML model transportation."""
def deserialize(self, compose, is_inner_model=False):
"""
Return the associated sklearn compose model of the given compose.
:param compose: given json string of a compose model to get deserialized to associated sklearn compose model
:type compose: obj
:param is_inner_model: determines whether it is an inner compose model of a super ml model
:type is_inner_model: boolean
:return: associated sklearn compose model
"""
data = compose["data"] if is_inner_model else compose.data
_type = compose["type"] if is_inner_model else compose.type
# ColumnTransformer requires 'transformers' arg; others use default constructor
if _type == "ColumnTransformer":
raw_model = self._supported_models[_type](transformers=data.get("transformers", []))
else:
raw_model = self._supported_models[_type]()
for transporter in self._transporters:
self._transporters[transporter].transport(compose, Command.DESERIALIZE, is_inner_model)
for item in data:
setattr(raw_model, item, data[item])
return raw_model
compose_chain = ComposeModelChain(COMPOSE_CHAIN, SKLEARN_COMPOSE_TABLE)
def get_transporter(model):
"""
Get associated transporter for the given ML model.
:param model: given model to get it's transporter
:type model: scikit ML model
:return: model category and transporter function
"""
if isinstance(model, str):
if model.upper() == "COMPOSE":
return "COMPOSE", compose_chain.transport
if compose_chain.is_supported(model):
return "COMPOSE", compose_chain.transport
else:
return None, None
================================================
FILE: pymilo/chains/cross_decomposition_chain.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo chain for Cross Decomposition models."""
from ..chains.chain import AbstractChain
from ..pymilo_param import SKLEARN_CROSS_DECOMPOSITION_TABLE
from ..transporters.general_data_structure_transporter import GeneralDataStructureTransporter
from ..transporters.preprocessing_transporter import PreprocessingTransporter
cross_decomposition_chain = AbstractChain(
{
"PreprocessingTransporter": PreprocessingTransporter(),
"GeneralDataStructureTransporter": GeneralDataStructureTransporter(),
},
SKLEARN_CROSS_DECOMPOSITION_TABLE,
)
================================================
FILE: pymilo/chains/decision_tree_chain.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo chain for Decision Trees models."""
from ..chains.chain import AbstractChain
from ..pymilo_param import SKLEARN_DECISION_TREE_TABLE
from ..transporters.general_data_structure_transporter import GeneralDataStructureTransporter
from ..transporters.preprocessing_transporter import PreprocessingTransporter
from ..transporters.randomstate_transporter import RandomStateTransporter
from ..transporters.tree_transporter import TreeTransporter
decision_trees_chain = AbstractChain(
{
"PreprocessingTransporter": PreprocessingTransporter(),
"GeneralDataStructureTransporter": GeneralDataStructureTransporter(),
"RandomStateTransporter": RandomStateTransporter(),
"TreeTransporter": TreeTransporter(),
},
SKLEARN_DECISION_TREE_TABLE,
)
================================================
FILE: pymilo/chains/ensemble_chain.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo chain for ensemble models."""
import copy
from ast import literal_eval
from numpy import ndarray, asarray
from ..chains.chain import AbstractChain
from ..transporters.feature_extraction_transporter import FeatureExtractorTransporter
from ..transporters.binmapper_transporter import BinMapperTransporter
from ..transporters.bunch_transporter import BunchTransporter
from ..transporters.transporter import Command
from ..transporters.general_data_structure_transporter import GeneralDataStructureTransporter
from ..transporters.generator_transporter import GeneratorTransporter
from ..transporters.lossfunction_transporter import LossFunctionTransporter
from ..transporters.preprocessing_transporter import PreprocessingTransporter
from ..transporters.randomstate_transporter import RandomStateTransporter
from ..transporters.treepredictor_transporter import TreePredictorTransporter
from ..pymilo_param import SKLEARN_ENSEMBLE_TABLE
from ..utils.util import check_str_in_iterable
from .util import serialize_possible_ml_model, deserialize_possible_ml_model
ENSEMBLE_CHAIN = {
"FeatureExtractorTransporter": FeatureExtractorTransporter(),
"PreprocessingTransporter": PreprocessingTransporter(),
"GeneralDataStructureTransporter": GeneralDataStructureTransporter(),
"TreePredictorTransporter": TreePredictorTransporter(),
"BinMapperTransporter": BinMapperTransporter(),
"GeneratorTransporter": GeneratorTransporter(),
"RandomStateTransporter": RandomStateTransporter(),
"LossFunctionTransporter": LossFunctionTransporter(),
"BunchTransporter": BunchTransporter(),
}
class EnsembleModelChain(AbstractChain):
"""EnsembleModelChain developed to handle sklearn Ensemble ML model transportation."""
def serialize(self, ensemble_object):
"""
Return the serialized json string of the given ensemble model.
:param ensemble_object: given model to be get serialized
:type ensemble_object: any sklearn ensemble model
:return: the serialized json string of the given ensemble
"""
for transporter in self._transporters:
if transporter != "GeneralDataStructureTransporter":
self._transporters[transporter].transport(
ensemble_object, Command.SERIALIZE)
pt = ENSEMBLE_CHAIN["PreprocessingTransporter"]
fe = ENSEMBLE_CHAIN["FeatureExtractorTransporter"]
for key, value in ensemble_object.__dict__.items():
if isinstance(value, list):
has_inner_tuple_with_ml_model = False
for idx, item in enumerate(value):
if isinstance(item, tuple):
listed_tuple = list(item)
for inner_idx, inner_item in enumerate(listed_tuple):
if pt.is_preprocessing_module(inner_item):
listed_tuple[inner_idx] = pt.serialize_pre_module(inner_item)
elif fe.is_fe_module(inner_item):
listed_tuple[inner_idx] = fe.serialize_fe_module(inner_item)
else:
has_inner_model, result = serialize_possible_ml_model(inner_item)
if has_inner_model:
has_inner_tuple_with_ml_model = True
listed_tuple[inner_idx] = result
value[idx] = listed_tuple
else:
value[idx] = serialize_possible_ml_model(item)[1]
if has_inner_tuple_with_ml_model:
ensemble_object.__dict__[key] = {
"pymiloed-data-structure": "list of (str, estimator) tuples",
"pymiloed-data": value,
}
elif isinstance(value, dict):
if check_str_in_iterable("pymilo-bunch", value):
new_value = {}
for inner_key, inner_value in value["pymilo-bunch"].items():
new_value[inner_key] = serialize_possible_ml_model(inner_value)[1]
value["pymilo-bunch"] = new_value
else:
new_value = {}
for inner_key, inner_value in value.items():
new_value[inner_key] = serialize_possible_ml_model(inner_value)[1]
ensemble_object.__dict__[key] = new_value
elif isinstance(value, ndarray):
has_inner_model, result = serialize_models_in_ndarray(value)
if has_inner_model:
ensemble_object.__dict__[key] = result
else:
ensemble_object.__dict__[key] = serialize_possible_ml_model(value)[1]
self._transporters["GeneralDataStructureTransporter"].transport(ensemble_object, Command.SERIALIZE)
return ensemble_object.__dict__
def deserialize(self, ensemble, is_inner_model=False):
"""
Return the associated sklearn ensemble model of the given ensemble.
:param ensemble: given json string of a ensemble model to get deserialized to associated sklearn ensemble model
:type ensemble: obj
:param is_inner_model: determines whether it is an inner ensemble model of a super ml model
:type is_inner_model: boolean
:return: associated sklearn ensemble model
"""
data = None
if is_inner_model:
data = ensemble["data"]
else:
data = ensemble.data
for transporter in self._transporters:
if transporter != "GeneralDataStructureTransporter":
self._transporters[transporter].transport(
ensemble, Command.DESERIALIZE, is_inner_model)
pt = ENSEMBLE_CHAIN["PreprocessingTransporter"]
fe = ENSEMBLE_CHAIN["FeatureExtractorTransporter"]
for key, value in data.items():
if isinstance(value, dict):
if check_str_in_iterable("pymiloed-data-structure",
value) and value["pymiloed-data-structure"] == "list of (str, estimator) tuples":
listed_tuples = value["pymiloed-data"]
list_of_tuples = []
for listed_tuple in listed_tuples:
name, serialized_model = listed_tuple
retrieved_model = None
if pt.is_preprocessing_module(serialized_model):
retrieved_model = pt.deserialize_pre_module(serialized_model)
elif fe.is_fe_module(serialized_model):
retrieved_model = fe.deserialize_fe_module(serialized_model)
else:
retrieved_model = deserialize_possible_ml_model(serialized_model)[1]
list_of_tuples.append(
(name, retrieved_model)
)
data[key] = list_of_tuples
elif GeneralDataStructureTransporter().is_deserialized_ndarray(value):
has_inner_model, result = deserialize_models_in_ndarray(value)
if has_inner_model:
data[key] = result
if isinstance(value, list):
for idx, item in enumerate(value):
has_ml_model, result = deserialize_possible_ml_model(item)
if has_ml_model:
value[idx] = result
has_ml_model, result = deserialize_possible_ml_model(value)
if has_ml_model:
data[key] = result
self._transporters["GeneralDataStructureTransporter"].transport(ensemble, Command.DESERIALIZE, is_inner_model)
_type = None
raw_model = None
meta_learnings = ["StackingRegressor", "StackingClassifier", "VotingRegressor", "VotingClassifier"]
pipeline_models = ["Pipeline"]
if is_inner_model:
_type = ensemble["type"]
else:
_type = ensemble.type
if _type in meta_learnings:
raw_model = self._supported_models[_type](estimators=data["estimators"])
elif _type in pipeline_models:
raw_model = self._supported_models[_type](steps=data["steps"])
else:
raw_model = self._supported_models[_type]()
for item in data:
setattr(raw_model, item, data[item])
return raw_model
ensemble_chain = EnsembleModelChain(ENSEMBLE_CHAIN, SKLEARN_ENSEMBLE_TABLE)
def serialize_models_in_ndarray(ndarray_instance):
"""
Serialize the ml models inside the given ndarray.
:param ndarray_instance: given ndarray needed to get it's inner ML models serialized
:type ndarray_instance: numpy.ndarray
:return: dict
"""
if not isinstance(ndarray_instance, ndarray):
return None # throw error
ndarray_instance_copy = copy.deepcopy(ndarray_instance)
has_inner_model = True
dtype = ndarray_instance.dtype
new_list = []
for item in ndarray_instance:
if isinstance(item, ndarray):
has_inside_model, result = serialize_models_in_ndarray(item)
if not has_inside_model:
has_inner_model = False
break
else:
new_list.append(result)
else:
has_ml_model, result = serialize_possible_ml_model(item)
if has_ml_model:
new_list.append(result)
else:
has_inner_model = False
break
if not has_inner_model:
return False, ndarray_instance_copy
else:
return True, {
'pymiloed-ndarray-list': new_list,
'pymiloed-ndarray-dtype': str(dtype),
'pymiloed-data-structure': 'numpy.ndarray'
}
def deserialize_models_in_ndarray(serialized_ndarray):
"""
Deserializes possible ML models within the given ndarray instance.
:param serialized_ndarray: given ndarray to deserialize possible previously serialized inner ML models
:type serialized_ndarray: obj
:return: numpy.ndarray
"""
gdst = GeneralDataStructureTransporter()
if not gdst.is_deserialized_ndarray(serialized_ndarray):
return False, None # throw error
serialized_ndarray_copy = copy.deepcopy(serialized_ndarray)
has_inner_model = True
inner_list = serialized_ndarray['pymiloed-ndarray-list']
new_list = []
for _, item in enumerate(inner_list):
if gdst.is_deserialized_ndarray(item):
has_inside_model, result = deserialize_models_in_ndarray(item)
if not has_inside_model:
has_inside_model = False
break
else:
new_list.append(result)
else:
has_ml_model, result = deserialize_possible_ml_model(item)
if has_ml_model:
new_list.append(result)
else:
has_inner_model = False
break
if not has_inner_model:
return False, serialized_ndarray_copy
else:
dtype = serialized_ndarray['pymiloed-ndarray-dtype']
if dtype.startswith("["):
dtype = literal_eval(dtype)
return True, asarray(new_list, dtype=dtype)
================================================
FILE: pymilo/chains/linear_model_chain.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo chain for linear models."""
from .chain import AbstractChain
from ..transporters.baseloss_transporter import BaseLossTransporter
from ..transporters.transporter import Command
from ..transporters.general_data_structure_transporter import GeneralDataStructureTransporter
from ..transporters.lossfunction_transporter import LossFunctionTransporter
from ..transporters.preprocessing_transporter import PreprocessingTransporter
from ..utils.util import get_sklearn_type, is_iterable
from ..pymilo_param import SKLEARN_LINEAR_MODEL_TABLE
LINEAR_MODEL_CHAIN = {
"PreprocessingTransporter": PreprocessingTransporter(),
"GeneralDataStructureTransporter": GeneralDataStructureTransporter(),
"BaseLossTransporter": BaseLossTransporter(),
"LossFunctionTransporter": LossFunctionTransporter(),
}
class LinearModelChain(AbstractChain):
"""LinearModelChain developed to handle sklearn Linear ML model transportation."""
def serialize(self, linear_model_object):
"""
Return the serialized json string of the given linear model.
:param linear_model_object: given model to be get serialized
:type linear_model_object: any sklearn linear model
:return: the serialized json string of the given linear model
"""
# first serializing the inner linear models...
for key in linear_model_object.__dict__:
if self.is_supported(linear_model_object.__dict__[key]):
linear_model_object.__dict__[key] = {
"pymilo-inner-model-data": self.transport(linear_model_object.__dict__[key], Command.SERIALIZE, True),
"pymilo-inner-model-type": get_sklearn_type(linear_model_object.__dict__[key]),
"pymilo-bypass": True
}
# now serializing non-linear model fields
for transporter in self._transporters:
self._transporters[transporter].transport(
linear_model_object, Command.SERIALIZE)
return linear_model_object.__dict__
def deserialize(self, linear_model, is_inner_model=False):
"""
Return the associated sklearn linear model of the given linear_model.
:param linear_model: given json string of a linear model to get deserialized to associated sklearn linear model
:type linear_model: obj
:param is_inner_model: determines whether it is an inner model of a super ml model
:type is_inner_model: boolean
:return: associated sklearn linear model
"""
raw_model = None
data = None
if is_inner_model:
raw_model = self._supported_models[linear_model["type"]]()
data = linear_model["data"]
else:
raw_model = self._supported_models[linear_model.type]()
data = linear_model.data
# first deserializing the inner linear models(one depth inner linear
# models have been deserialized -> TODO full depth).
for key in data:
if is_deserialized_linear_model(data[key]):
data[key] = self.transport({
"data": data[key]["pymilo-inner-model-data"],
"type": data[key]["pymilo-inner-model-type"]
}, Command.DESERIALIZE, is_inner_model=True)
# now deserializing non-linear models fields
for transporter in self._transporters:
self._transporters[transporter].transport(
linear_model, Command.DESERIALIZE, is_inner_model)
for item in data:
setattr(raw_model, item, data[item])
return raw_model
linear_chain = LinearModelChain(LINEAR_MODEL_CHAIN, SKLEARN_LINEAR_MODEL_TABLE)
def is_deserialized_linear_model(content):
"""
Check if the given content is a previously serialized model by Pymilo's Export or not.
:param content: given object to be authorized as a valid pymilo exported serialized model
:type content: any object
:return: check result as bool
"""
if not is_iterable(content):
return False
return "pymilo-inner-model-type" in content and "pymilo-inner-model-data" in content
================================================
FILE: pymilo/chains/naive_bayes_chain.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo chain for Naive Bayes models."""
from ..chains.chain import AbstractChain
from ..pymilo_param import SKLEARN_NAIVE_BAYES_TABLE
from ..transporters.general_data_structure_transporter import GeneralDataStructureTransporter
from ..transporters.preprocessing_transporter import PreprocessingTransporter
naive_bayes_chain = AbstractChain(
{
"PreprocessingTransporter": PreprocessingTransporter(),
"GeneralDataStructureTransporter": GeneralDataStructureTransporter(),
},
SKLEARN_NAIVE_BAYES_TABLE,
)
================================================
FILE: pymilo/chains/neighbours_chain.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo chain for Neighbors models."""
from ..chains.chain import AbstractChain
from ..pymilo_param import SKLEARN_NEIGHBORS_TABLE
from ..transporters.general_data_structure_transporter import GeneralDataStructureTransporter
from ..transporters.neighbors_tree_transporter import NeighborsTreeTransporter
from ..transporters.preprocessing_transporter import PreprocessingTransporter
neighbors_chain = AbstractChain(
{
"PreprocessingTransporter": PreprocessingTransporter(),
"GeneralDataStructureTransporter": GeneralDataStructureTransporter(),
"NeighborsTreeTransporter": NeighborsTreeTransporter(),
},
SKLEARN_NEIGHBORS_TABLE,
)
================================================
FILE: pymilo/chains/neural_network_chain.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo chain for Neural Network models."""
from ..chains.chain import AbstractChain
from ..pymilo_param import SKLEARN_NEURAL_NETWORK_TABLE
from ..transporters.adamoptimizer_transporter import AdamOptimizerTransporter
from ..transporters.general_data_structure_transporter import GeneralDataStructureTransporter
from ..transporters.preprocessing_transporter import PreprocessingTransporter
from ..transporters.randomstate_transporter import RandomStateTransporter
from ..transporters.sgdoptimizer_transporter import SGDOptimizerTransporter
neural_network_chain = AbstractChain(
{
"PreprocessingTransporter": PreprocessingTransporter(),
"GeneralDataStructureTransporter": GeneralDataStructureTransporter(),
"RandomStateTransporter": RandomStateTransporter(),
"SGDOptimizer": SGDOptimizerTransporter(),
"AdamOptimizerTransporter": AdamOptimizerTransporter(),
},
SKLEARN_NEURAL_NETWORK_TABLE,
)
================================================
FILE: pymilo/chains/svm_chain.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo chain for SVM models."""
from ..chains.chain import AbstractChain
from ..pymilo_param import SKLEARN_SVM_TABLE
from ..transporters.preprocessing_transporter import PreprocessingTransporter
from ..transporters.general_data_structure_transporter import GeneralDataStructureTransporter
from ..transporters.randomstate_transporter import RandomStateTransporter
svm_chain = AbstractChain(
{
"PreprocessingTransporter": PreprocessingTransporter(),
"GeneralDataStructureTransporter": GeneralDataStructureTransporter(),
"RandomStateTransporter": RandomStateTransporter(),
},
SKLEARN_SVM_TABLE,
)
================================================
FILE: pymilo/chains/util.py
================================================
# -*- coding: utf-8 -*-
"""useful utilities for chains."""
from .linear_model_chain import linear_chain
from .neural_network_chain import neural_network_chain
from .decision_tree_chain import decision_trees_chain
from .clustering_chain import clustering_chain
from .naive_bayes_chain import naive_bayes_chain
from .svm_chain import svm_chain
from .neighbours_chain import neighbors_chain
from .cross_decomposition_chain import cross_decomposition_chain
from ..utils.util import get_sklearn_type, check_str_in_iterable
MODEL_TYPE_TRANSPORTER = {
"LINEAR_MODEL": linear_chain.transport,
"NEURAL_NETWORK": neural_network_chain.transport,
"DECISION_TREE": decision_trees_chain.transport,
"CLUSTERING": clustering_chain.transport,
"NAIVE_BAYES": naive_bayes_chain.transport,
"SVM": svm_chain.transport,
"NEIGHBORS": neighbors_chain.transport,
"CROSS_DECOMPOSITION": cross_decomposition_chain.transport,
}
def get_concrete_transporter(model):
"""
Get associated transporter for the given concrete(not ensemble) ML model.
:param model: given model to get it's transporter
:type model: scikit ML model
:return: model category and transporter function
"""
if isinstance(model, str):
upper_model = model.upper()
if upper_model in MODEL_TYPE_TRANSPORTER.keys():
return upper_model, MODEL_TYPE_TRANSPORTER[upper_model]
if linear_chain.is_supported(model):
return "LINEAR_MODEL", linear_chain.transport
elif neural_network_chain.is_supported(model):
return "NEURAL_NETWORK", neural_network_chain.transport
elif decision_trees_chain.is_supported(model):
return "DECISION_TREE", decision_trees_chain.transport
elif clustering_chain.is_supported(model):
return "CLUSTERING", clustering_chain.transport
elif naive_bayes_chain.is_supported(model):
return "NAIVE_BAYES", naive_bayes_chain.transport
elif svm_chain.is_supported(model):
return "SVM", svm_chain.transport
elif neighbors_chain.is_supported(model):
return "NEIGHBORS", neighbors_chain.transport
elif cross_decomposition_chain.is_supported(model):
return "CROSS_DECOMPOSITION", cross_decomposition_chain.transport
else:
return None, None
def get_transporter(model):
"""
Get associated transporter for the given ML model.
:param model: given model to get it's transporter
:type model: scikit ML model or str
:return: model category and transporter function
"""
# String routing
if isinstance(model, str):
upper = model.upper()
if upper == "COMPOSE":
from .compose_chain import compose_chain
return "COMPOSE", compose_chain.transport
if upper == "ENSEMBLE":
from .ensemble_chain import ensemble_chain
return "ENSEMBLE", ensemble_chain.transport
# Object routing (check higher-level categories first)
from .compose_chain import compose_chain
if compose_chain.is_supported(model):
return "COMPOSE", compose_chain.transport
from .ensemble_chain import ensemble_chain
if ensemble_chain.is_supported(model):
return "ENSEMBLE", ensemble_chain.transport
return get_concrete_transporter(model)
def serialize_possible_ml_model(model):
"""
Serialize the given object if it is a supported ML model.
:param model: given object
:type model: any
:return: ML model flag and serialized result
"""
if isinstance(model, str):
return False, model
ml_category, transporter = get_transporter(model)
if transporter is None:
return False, model
from ..transporters.transporter import Command
return True, {
"pymilo-bypass": True,
"pymilo-inner-model-data": transporter(model, Command.SERIALIZE),
"pymilo-inner-model-type": get_sklearn_type(model),
"pymilo-ml-category": ml_category
}
def deserialize_possible_ml_model(serialized_model):
"""
Deserialize the given object if it is a previously serialized ML model.
:param serialized_model: given obj to check
:type serialized_model: obj
:return: ML model flag and deserialized result
"""
if check_str_in_iterable("pymilo-inner-model-type", serialized_model):
_, transporter = get_transporter(serialized_model["pymilo-ml-category"])
from ..transporters.transporter import Command
return True, transporter({
"data": serialized_model["pymilo-inner-model-data"],
"type": serialized_model["pymilo-inner-model-type"]
}, Command.DESERIALIZE, is_inner_model=True)
else:
return False, serialized_model
================================================
FILE: pymilo/exceptions/__init__.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo exceptions."""
from .pymilo_exception import PymiloException
from .serialize_exception import PymiloSerializationException
from .deserialize_exception import PymiloDeserializationException
================================================
FILE: pymilo/exceptions/deserialize_exception.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo Deserialization Exception."""
from enum import Enum
from .pymilo_exception import PymiloException
class DeserializationErrorTypes(Enum):
"""An enum class to determine the type of deserialization errors."""
CORRUPTED_JSON_FILE = 1
INVALID_MODEL = 2
VALID_MODEL_INVALID_INTERNAL_STRUCTURE = 3
class PymiloDeserializationException(PymiloException):
"""
Handle exceptions associated with Deserialization.
There are 3 different types of deserialization exceptions:
1-CORRUPTED_JSON_FILE: This error type claims that the given json string file which is supposed to be an
output of Pymilo Export, is corrupted and can not be parsed as a valid json.
2-INVALID_MODEL: This error type claims that the given json string file(or object) is not a deserialized export of
a valid sklearn linear model.
3-VALID_MODEL_INVALID_INTERNAL_STRUCTURE: This error occurs when attempting to load a JSON file or object that
does not conform to the expected format of a serialized scikit-learn linear model.
The file may have been modified after being exported from Pymilo Export, causing it to become invalid.
"""
def __init__(self, meta_data):
"""
Initialize the PymiloDeserializationException instance.
:param meta_data: Details pertain to the populated error.
:type meta_data: dict [str:str]
:return: an instance of the PymiloDeserializationException class
"""
# Call the base class constructor with the parameters it needs
message = "Pymilo Deserialization failed since {reason}"
error_type = meta_data['error_type']
error_type_to_message = {
DeserializationErrorTypes.CORRUPTED_JSON_FILE:
'the given file is not a valid .json file.',
DeserializationErrorTypes.INVALID_MODEL:
'the given model is not supported or is not a valid model.',
DeserializationErrorTypes.VALID_MODEL_INVALID_INTERNAL_STRUCTURE:
'the given model has some non-standard customized internal objects or functions.'}
if error_type in error_type_to_message:
reason = error_type_to_message[error_type]
else:
reason = "an Unknown error occurred."
message.format(reason=reason)
super().__init__(message, meta_data)
def to_pymilo_log(self):
"""
Generate a comprehensive report of the populated error.
:return: a dictionary of error details.
"""
pymilo_report = super().to_pymilo_log()
if self.meta_data['error_type'] == DeserializationErrorTypes.CORRUPTED_JSON_FILE:
pymilo_report['object']['json_file'] = self.meta_data['json_file']
return pymilo_report
================================================
FILE: pymilo/exceptions/pymilo_exception.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo Abstract Exception Class."""
import pymilo
import sklearn
import platform
from datetime import datetime, timezone
from abc import ABC, abstractmethod
class PymiloException(Exception, ABC):
"""An abstract class for handling pymilo associated exceptions."""
def __init__(self, message, meta_data):
"""
Initialize the PymiloException instance.
:param message: Error message associated with the populated error.
:type message: str
:param meta_data: Details pertain to the populated error.
:type meta_data: dict [str:str]
:return: an instance of the PymiloDeserializationException class
"""
# Call the base class constructor with the parameters it needs
super().__init__(message)
# gathered meta_data
self.message = message
self.meta_data = meta_data
def to_pymilo_log(self):
"""
Generate a comprehensive report of the populated error.
:return: error's details as dictionary
"""
pymilo_report = {
'os': {
'name': platform.system(),
'version': platform.version(),
'release': platform.release(),
'full-description': platform.platform()
},
'versions': {
'pymilo-version': pymilo.__version__,
'scikit-version': sklearn.__version__,
'python-version': platform.python_version()
},
'object': {
'type': type(self.meta_data['object']),
'content': self.meta_data['object']
},
'error': {
'date-utc': datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M:%S'),
'pymilo-error': self.message,
'inner-error': self.meta_data['error'] if "error" in self.meta_data else ""
}
}
return pymilo_report
def to_pymilo_issue(self):
"""
Generate an issue form from the populated error.
:return: issue form of the associated error as string
"""
pymilo_report = self.to_pymilo_log()
help_request = """
\n\nIn order to help us enhance Pymilo's functionality, please open an issue associated with this error and put the message below inside.\n
"""
associated_pymilo_class = "Export" if "Serialization" in self.message else "Import"
description = "#### Description\n Pymilo {pymilo_class} failed.".format(pymilo_class=associated_pymilo_class)
steps_to_produce = "\n#### Steps/Code to Reproduce\n It is auto-reported from the pymilo logger."
expected_behavior = "\n#### Expected Behavior\n A successful Pymilo {pymilo_class}.".format(
pymilo_class=associated_pymilo_class)
actual_behavior = "\n#### Actual Behavior\n Pymilo {pymilo_class} failed.".format(
pymilo_class=associated_pymilo_class)
operating_system = "#### Operating System\n {os}".format(os=pymilo_report['os']['full-description'])
python_version = "#### Python Version\n {python_version}".format(
python_version=pymilo_report['versions']["python-version"])
pymilo_version = "#### PyMilo Version\n {pymilo_version}".format(
pymilo_version=pymilo_report['versions']["pymilo-version"])
gathered_data = "#### Logged Data\n {logged_data}".format(logged_data=str(pymilo_report))
full_issue_form = help_request + description + steps_to_produce + expected_behavior + \
actual_behavior + operating_system + python_version + pymilo_version + gathered_data
return full_issue_form
def __str__(self):
"""
Override the base __str__ function.
:return: issue form of the associated error as string
"""
return self.to_pymilo_issue()
================================================
FILE: pymilo/exceptions/serialize_exception.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo Serialization Exception."""
from enum import Enum
from .pymilo_exception import PymiloException
class SerializationErrorTypes(Enum):
"""An enum class used to determine the type of serialization errors."""
INVALID_MODEL = 1
VALID_MODEL_INVALID_INTERNAL_STRUCTURE = 2
class PymiloSerializationException(PymiloException):
"""
Handle exceptions associated with Serializations.
There are 2 different types of serialization exceptions:
1-INVALID_MODEL: This error type claims that the given model is not a valid sklearn's linear model.
2-VALID_MODEL_INVALID_INTERNAL_STRUCTURE: This error occurs when attempting to serialize a model that
is one of the sklearn's linear models but it's internal structure has changed in a way that can't be serialized.
"""
def __init__(self, meta_data):
"""
Initialize the PymiloSerializationException instance.
:param meta_data: Details pertain to the populated error.
:type meta_data: dict [str:str]
:return: an instance of the PymiloSerializationException class
"""
# Call the base class constructor with the parameters it needs
message = "Pymilo Serialization failed since "
error_type = meta_data['error_type']
error_type_to_message = {
SerializationErrorTypes.INVALID_MODEL: 'the given model is not supported or is not a valid model.',
SerializationErrorTypes.VALID_MODEL_INVALID_INTERNAL_STRUCTURE: 'the given model has some non-standard customized internal objects or functions.'}
if error_type in error_type_to_message:
message += error_type_to_message[error_type]
else:
message += "an Unknown error occurred."
super().__init__(message, meta_data)
def to_pymilo_log(self):
"""
Generate a comprehensive report of the populated error.
:return: error's details as dictionary
"""
pymilo_report = super().to_pymilo_log()
# TODO add any serializable field to `object` field of pymilo_report
return pymilo_report
================================================
FILE: pymilo/pymilo_func.py
================================================
# -*- coding: utf-8 -*-
"""Functions."""
import numpy as np
import sklearn
from .chains.util import get_transporter
from .transporters.transporter import Command
from .pymilo_param import SKLEARN_SUPPORTED_CATEGORIES, NOT_SUPPORTED, OVERVIEW
def get_sklearn_version():
"""
Return sklearn version.
:return: sklearn version as a str
"""
return sklearn.__version__
def get_sklearn_data(model):
"""
Return sklearn data by serializing given model.
:param model: given model
:type model: any sklearn's model class
:return: sklearn data
"""
_, transporter = get_transporter(model)
return transporter(model, Command.SERIALIZE)
def to_sklearn_model(import_obj):
"""
Deserialize the imported object as a sklearn model.
:param import_obj: given object
:type import_obj: pymilo.Import
:return: sklearn model
"""
_, transporter = get_transporter(import_obj.type)
return transporter(import_obj, Command.DESERIALIZE)
def compare_model_outputs(exported_output,
imported_output,
epsilon_error=10**(-8)):
"""
Check if the given models outputs are the same.
:param exported_output: exported model output
:type exported_output: dict
:param imported_output: imported model output
:type imported_output: dict
:param epsilon_error: error threshold for numeric comparisons
:type epsilon_error: float
:return: check result as bool
"""
if len(exported_output) != len(imported_output):
return False # TODO: throw exception
total_error = 0
for key in exported_output:
if key not in imported_output:
return False # TODO: throw exception
total_error += np.abs(imported_output[key] - exported_output[key])
return np.abs(total_error) < epsilon_error
def print_supported_ml_models():
"""
Print the supported sklearn ML models categorized by type.
:return: None
"""
print("Supported Machine Learning Models:")
for category, table in SKLEARN_SUPPORTED_CATEGORIES.items():
print(f"**{category}**:")
for model_name in table:
if table[model_name] != NOT_SUPPORTED:
print(f"- {model_name}")
def pymilo_help():
"""
Print PyMilo details.
:return: None
"""
print(OVERVIEW)
print("Repo : https://github.com/openscilab/pymilo")
print("Webpage : https://openscilab.com/\n")
================================================
FILE: pymilo/pymilo_obj.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo modules."""
import os
import re
import json
from copy import deepcopy
from warnings import warn
from traceback import format_exc
from .utils.util import get_sklearn_type, download_model
from concurrent.futures import ThreadPoolExecutor, as_completed
from .pymilo_func import get_sklearn_data, get_sklearn_version, to_sklearn_model
from .exceptions.serialize_exception import PymiloSerializationException, SerializationErrorTypes
from .exceptions.deserialize_exception import PymiloDeserializationException, DeserializationErrorTypes
from .pymilo_param import PYMILO_VERSION, UNEQUAL_PYMILO_VERSIONS, UNEQUAL_SKLEARN_VERSIONS
from .pymilo_param import INVALID_IMPORT_INIT_PARAMS, BATCH_IMPORT_INVALID_DIRECTORY
class Export:
"""
The Pymilo Export class facilitates exporting of models to json files.
>>> exported_model = Export(model) # the model could be any sklearn linear model.
>>> exported_model_serialized_path = os.path.join(os.getcwd(), "MODEL_NAME.json")
>>> exported_model.save(exported_model_serialized_path)
"""
def __init__(self, model):
"""
Initialize the Pymilo Export instance.
:param model: given model(any sklearn linear model)
:type model: any class of the sklearn's linear models
:return: an instance of the Pymilo Export class
"""
self.data = get_sklearn_data(deepcopy(model))
self.version = get_sklearn_version()
self.type = get_sklearn_type(model)
def save(self, file_adr):
"""
Save model in a file.
:param file_adr: file address
:type file_adr: str
:return: None
"""
with open(file_adr, 'w') as fp:
fp.write(self.to_json())
def to_json(self):
"""
Return a json-like representation of model.
:return: model's representation as str
"""
try:
return json.dumps(
{
"data": self.data,
"sklearn_version": self.version,
"pymilo_version": PYMILO_VERSION,
"model_type": self.type
},
indent=4
)
except Exception as e:
raise PymiloSerializationException(
{
'error_type': SerializationErrorTypes.VALID_MODEL_INVALID_INTERNAL_STRUCTURE,
'error': {
'Exception': repr(e),
'Traceback': format_exc()},
'object': {
"data": self.data,
"sklearn_version": self.version,
"pymilo_version": PYMILO_VERSION,
"model_type": self.type},
})
@staticmethod
def batch_export(models, file_addr, run_parallel=False):
"""
Export a batch of models to individual JSON files in a specified directory.
This method takes a list of trained models and exports each one into a JSON file. The models
are exported concurrently using multiple threads, where each model is saved to a file named
'model_{index}.json' in the provided directory.
:param models: list of models to get exported.
:type models: list
:param file_addr: the directory where exported JSON files will be saved.
:type file_addr: str
:param run_parallel: flag indicating the parallel execution of exports
:type run_parallel: boolean
:return: the count of models exported successfully
"""
if not os.path.exists(file_addr):
os.mkdir(file_addr)
def export_model(model, index):
try:
Export(model).save(file_adr=os.path.join(file_addr, f"model_{index}.json"))
return 1
except Exception as _:
return 0
if run_parallel:
with ThreadPoolExecutor() as executor:
futures = [executor.submit(export_model, model, index) for index, model in enumerate(models)]
count = 0
for future in as_completed(futures):
count += future.result()
return count
else:
count = 0
for index, model in enumerate(models):
count += export_model(model, index)
return count
class Import:
"""
The Pymilo Import class facilitates importing of serialized models from either a designated file path or a JSON string dump.
>>> imported_model = Import(exported_model_serialized_path)
>>> imported_sklearn_model = imported_model.to_model()
>>> imported_sklearn_model.predict(x_test)
"""
def __init__(self, file_adr=None, json_dump=None, url=None):
"""
Initialize the Pymilo Import instance.
:param file_adr: the file path where the serialized model's JSON file is located.
:type file_adr: str or None
:param json_dump: the json dump of the associated model, it can be None(reading from the file_adr)
:type json_dump: str or None
:param url: url to exported JSON file
:type: str or None
:return: an instance of the Pymilo Import class
"""
serialized_model_obj = None
if url is not None:
serialized_model_obj = download_model(url)
elif json_dump is not None and isinstance(json_dump, str):
serialized_model_obj = json.loads(json_dump)
elif file_adr is not None:
with open(file_adr, 'r') as fp:
serialized_model_obj = json.load(fp)
else:
raise Exception(INVALID_IMPORT_INIT_PARAMS)
try:
if not serialized_model_obj["pymilo_version"] == PYMILO_VERSION:
warn(UNEQUAL_PYMILO_VERSIONS, category=Warning)
if not serialized_model_obj["sklearn_version"] == get_sklearn_version():
warn(UNEQUAL_SKLEARN_VERSIONS, category=Warning)
self.data = serialized_model_obj["data"]
self.version = serialized_model_obj["sklearn_version"]
self.type = serialized_model_obj["model_type"]
except Exception as e:
json_content = None
if json_dump and isinstance(json_dump, str):
json_content = json_dump
elif file_adr is not None:
with open(file_adr) as f:
json_content = f.readlines()
else:
json_content = serialized_model_obj
raise PymiloDeserializationException(
{
'json_file': json_content,
'error_type': DeserializationErrorTypes.CORRUPTED_JSON_FILE,
'error': {
'Exception': repr(e),
'Traceback': format_exc()},
'object': ""})
def to_model(self):
"""
Convert imported model to sklearn model.
:return: sklearn model
"""
return to_sklearn_model(self)
@staticmethod
def batch_import(file_addr, run_parallel=False):
"""
Import a batch of models from individual JSON files in a specified directory.
This method takes a directory containing JSON files and imports each one into a model.
The models are imported concurrently using multiple threads, ensuring that the files are
processed in the order determined by their numeric suffixes. The function returns the
successfully imported models in the same order as their filenames.
:param file_addr: the directory where the JSON files to be imported are located.
:type file_addr: str
:param run_parallel: flag indicating the parallel execution of imports
:type run_parallel: boolean
:return: a tuple containing the count of models imported successfully and a list of the
imported models in their filename order.
"""
if not os.path.exists(file_addr):
raise FileNotFoundError(BATCH_IMPORT_INVALID_DIRECTORY)
json_files = [f for f in os.listdir(file_addr) if f.endswith('.json')]
json_files.sort(key=lambda x: int(re.search(r'_(\d+)\.json$', x).group(1)))
models = [None] * len(json_files)
count = 0
def import_model(file_path, index):
try:
model = Import(file_path).to_model()
return index, model
except Exception as _:
return index, None
if run_parallel:
with ThreadPoolExecutor() as executor:
futures = {
executor.submit(
import_model,
os.path.join(
file_addr,
file),
index): index for index,
file in enumerate(json_files)}
for future in as_completed(futures):
index, model = future.result()
if model is not None:
models[index] = model
count += 1
return count, models
else:
count = 0
for index, file in enumerate(json_files):
model = Import(os.path.join(file_addr, file)).to_model()
if model is not None:
models[index] = model
count += 1
return count, models
================================================
FILE: pymilo/pymilo_param.py
================================================
# -*- coding: utf-8 -*-
"""Parameters and constants."""
import numpy as np
import sklearn.linear_model as linear_model
import sklearn.neural_network as neural_network
import sklearn.tree as tree
import sklearn.cluster as cluster
import sklearn.mixture as mixture
import sklearn.naive_bayes as naive_bayes
import sklearn.svm as svm
import sklearn.neighbors as neighbors
import sklearn.dummy as dummy
import sklearn.ensemble as ensemble
import sklearn.pipeline as pipeline
import sklearn.preprocessing as preprocessing
import sklearn.cross_decomposition as cross_decomposition
import sklearn.feature_extraction as feature_extraction
import sklearn.compose as compose
quantile_regressor_support = False
try:
from sklearn.linear_model import QuantileRegressor
quantile_regressor_support = True
except BaseException:
pass
glm_support = {
'GammaRegressor': False,
'PoissonRegressor': False,
'TweedieRegressor': False
}
try:
from sklearn.linear_model import TweedieRegressor
glm_support['TweedieRegressor'] = True
from sklearn.linear_model import PoissonRegressor
glm_support['PoissonRegressor'] = True
from sklearn.linear_model import GammaRegressor
glm_support['GammaRegressor'] = True
except BaseException:
pass
sgd_one_class_svm_support = False
try:
from sklearn.linear_model import SGDOneClassSVM
sgd_one_class_svm_support = True
except BaseException:
pass
bisecting_kmeans_support = False
try:
from sklearn.cluster import BisectingKMeans
bisecting_kmeans_support = True
except BaseException:
pass
hdbscan_support = False
try:
from sklearn.cluster import HDBSCAN
hdbscan_support = True
except BaseException:
pass
hist_gradient_boosting_support = False
try:
from sklearn.ensemble import HistGradientBoostingRegressor
from sklearn.ensemble import HistGradientBoostingClassifier
hist_gradient_boosting_support = True
except BaseException:
pass
spline_transformer_support = False
try:
from sklearn.preprocessing import SplineTransformer
spline_transformer_support = True
except BaseException:
pass
target_encoder_support = False
try:
from sklearn.preprocessing import TargetEncoder
target_encoder_support = True
except BaseException:
pass
OVERVIEW = """
PyMilo is an open source Python package that provides a simple, efficient, and safe way for users to export pre-trained machine learning models in a transparent way.
"""
PYMILO_VERSION = "1.6"
NOT_SUPPORTED = "NOT_SUPPORTED"
PYMILO_VERSION_DOES_NOT_EXIST = "Corrupted JSON file, `pymilo_version` doesn't exist in this file."
UNEQUAL_PYMILO_VERSIONS = "warning: Installed PyMilo version differs from the PyMilo version used to create the JSON file."
UNEQUAL_SKLEARN_VERSIONS = "warning: Installed Scikit version differs from the Scikit version used to create the JSON file and it may prevent PyMilo from transporting seamlessly."
INVALID_IMPORT_INIT_PARAMS = "Invalid input parameters, you should either pass a valid file_adr or a json_dump or a url to initiate Import class."
URL_REGEX = r'^(http|https)://[a-zA-Z0-9.-_]+\.[a-zA-Z]{2,}(/\S*)?$'
DOWNLOAD_MODEL_FAILED = "Failed to download the JSON file, Server didn't respond."
INVALID_DOWNLOADED_MODEL = "The downloaded content is not a valid JSON file."
BATCH_IMPORT_INVALID_DIRECTORY = "The given directory does not exist."
CLI_ML_STREAMING_NOT_INSTALLED = """ML Streaming is not installed.
To install ML Streaming, run the following command:
pip install pymilo[streaming]"""
CLI_MORE_INFO = "For more information, visit the PyMilo README at https://github.com/openscilab/pymilo"
CLI_UNKNOWN_MODEL = "The provided ML model name is either invalid or unsupported."
SKLEARN_LINEAR_MODEL_TABLE = {
"DummyRegressor": dummy.DummyRegressor,
"DummyClassifier": dummy.DummyClassifier,
"LinearRegression": linear_model.LinearRegression,
"Ridge": linear_model.Ridge,
"RidgeCV": linear_model.RidgeCV,
"RidgeClassifier": linear_model.RidgeClassifier,
"RidgeClassifierCV": linear_model.RidgeClassifierCV,
"Lasso": linear_model.Lasso,
"LassoCV": linear_model.LassoCV,
"LassoLars": linear_model.LassoLars,
"LassoLarsCV": linear_model.LassoLarsCV,
"LassoLarsIC": linear_model.LassoLarsIC,
"MultiTaskLasso": linear_model.MultiTaskLasso,
"MultiTaskLassoCV": linear_model.MultiTaskLassoCV,
"ElasticNet": linear_model.ElasticNet,
"ElasticNetCV": linear_model.ElasticNetCV,
"MultiTaskElasticNet": linear_model.MultiTaskElasticNet,
"MultiTaskElasticNetCV": linear_model.MultiTaskElasticNetCV,
"OrthogonalMatchingPursuit": linear_model.OrthogonalMatchingPursuit,
"OrthogonalMatchingPursuitCV": linear_model.OrthogonalMatchingPursuitCV,
"BayesianRidge": linear_model.BayesianRidge,
"ARDRegression": linear_model.ARDRegression,
"LogisticRegression": linear_model.LogisticRegression,
"LogisticRegressionCV": linear_model.LogisticRegressionCV,
"TweedieRegressor": TweedieRegressor if glm_support['TweedieRegressor'] else NOT_SUPPORTED,
"PoissonRegressor": PoissonRegressor if glm_support['PoissonRegressor'] else NOT_SUPPORTED,
"GammaRegressor": GammaRegressor if glm_support['GammaRegressor'] else NOT_SUPPORTED,
"SGDRegressor": linear_model.SGDRegressor,
"SGDClassifier": linear_model.SGDClassifier,
"SGDOneClassSVM": SGDOneClassSVM if sgd_one_class_svm_support else NOT_SUPPORTED,
"Perceptron": linear_model.Perceptron,
"PassiveAggressiveRegressor": linear_model.PassiveAggressiveRegressor,
"PassiveAggressiveClassifier": linear_model.PassiveAggressiveClassifier,
"RANSACRegressor": linear_model.RANSACRegressor,
"TheilSenRegressor": linear_model.TheilSenRegressor,
"HuberRegressor": linear_model.HuberRegressor,
"QuantileRegressor": QuantileRegressor if quantile_regressor_support else NOT_SUPPORTED,
}
SKLEARN_NEURAL_NETWORK_TABLE = {
"MLPRegressor": neural_network.MLPRegressor,
"MLPClassifier": neural_network.MLPClassifier,
"BernoulliRBM": neural_network.BernoulliRBM,
}
SKLEARN_DECISION_TREE_TABLE = {
"DecisionTreeRegressor": tree.DecisionTreeRegressor,
"DecisionTreeClassifier": tree.DecisionTreeClassifier,
"ExtraTreeRegressor": tree.ExtraTreeRegressor,
"ExtraTreeClassifier": tree.ExtraTreeClassifier
}
SKLEARN_CLUSTERING_TABLE = {
"KMeans": cluster.KMeans,
"MiniBatchKMeans": cluster.MiniBatchKMeans,
"BisectingKMeans": BisectingKMeans if bisecting_kmeans_support else NOT_SUPPORTED,
"AffinityPropagation": cluster.AffinityPropagation,
"MeanShift": cluster.MeanShift,
"SpectralClustering": cluster.SpectralClustering,
"SpectralBiclustering": cluster.SpectralBiclustering,
"SpectralCoclustering": cluster.SpectralCoclustering,
"AgglomerativeClustering": cluster.AgglomerativeClustering,
"FeatureAgglomeration": cluster.FeatureAgglomeration,
"DBSCAN": cluster.DBSCAN,
"HDBSCAN": HDBSCAN if hdbscan_support else NOT_SUPPORTED,
"OPTICS": cluster.OPTICS,
"Birch": cluster.Birch,
"GaussianMixture": mixture.GaussianMixture,
"BayesianGaussianMixture": mixture.BayesianGaussianMixture,
}
SKLEARN_NAIVE_BAYES_TABLE = {
"GaussianNB": naive_bayes.GaussianNB,
"MultinomialNB": naive_bayes.MultinomialNB,
"ComplementNB": naive_bayes.ComplementNB,
"BernoulliNB": naive_bayes.BernoulliNB,
"CategoricalNB": naive_bayes.CategoricalNB,
}
SKLEARN_SVM_TABLE = {
"LinearSVC": svm.LinearSVC,
"LinearSVR": svm.LinearSVR,
"NuSVC": svm.NuSVC,
"NuSVR": svm.NuSVR,
"OneClassSVM": svm.OneClassSVM,
"SVC": svm.SVC,
"SVR": svm.SVR,
}
SKLEARN_NEIGHBORS_TABLE = {
"KNeighborsRegressor": neighbors.KNeighborsRegressor,
"KNeighborsClassifier": neighbors.KNeighborsClassifier,
"RadiusNeighborsRegressor": neighbors.RadiusNeighborsRegressor,
"RadiusNeighborsClassifier": neighbors.RadiusNeighborsClassifier,
"NearestNeighbors": neighbors.NearestNeighbors,
"NearestCentroid": neighbors.NearestCentroid,
"LocalOutlierFactor": neighbors.LocalOutlierFactor,
}
SKLEARN_ENSEMBLE_TABLE = {
"AdaBoostRegressor": ensemble.AdaBoostRegressor,
"AdaBoostClassifier": ensemble.AdaBoostClassifier,
"BaggingRegressor": ensemble.BaggingRegressor,
"BaggingClassifier": ensemble.BaggingClassifier,
"ExtraTreesClassifier": ensemble.ExtraTreesClassifier,
"ExtraTreesRegressor": ensemble.ExtraTreesRegressor,
"GradientBoostingRegressor": ensemble.GradientBoostingRegressor,
"GradientBoostingClassifier": ensemble.GradientBoostingClassifier,
"IsolationForest": ensemble.IsolationForest,
"RandomForestClassifier": ensemble.RandomForestClassifier,
"RandomForestRegressor": ensemble.RandomForestRegressor,
"RandomTreesEmbedding": ensemble.RandomTreesEmbedding,
"StackingRegressor": ensemble.StackingRegressor,
"StackingClassifier": ensemble.StackingClassifier,
"VotingRegressor": ensemble.VotingRegressor,
"VotingClassifier": ensemble.VotingClassifier,
"HistGradientBoostingRegressor": HistGradientBoostingRegressor if hist_gradient_boosting_support else NOT_SUPPORTED,
"HistGradientBoostingClassifier": HistGradientBoostingClassifier if hist_gradient_boosting_support else NOT_SUPPORTED,
####
"Pipeline": pipeline.Pipeline,
}
SKLEARN_PREPROCESSING_TABLE = {
"StandardScaler": preprocessing.StandardScaler,
"MinMaxScaler": preprocessing.MinMaxScaler,
"OneHotEncoder": preprocessing.OneHotEncoder,
"LabelBinarizer": preprocessing.LabelBinarizer,
"LabelEncoder": preprocessing.LabelEncoder,
"Binarizer": preprocessing.Binarizer,
"FunctionTransformer": preprocessing.FunctionTransformer,
"KernelCenterer": preprocessing.KernelCenterer,
"MultiLabelBinarizer": preprocessing.MultiLabelBinarizer,
"MaxAbsScaler": preprocessing.MaxAbsScaler,
"Normalizer": preprocessing.Normalizer,
"OrdinalEncoder": preprocessing.OrdinalEncoder,
"PolynomialFeatures": preprocessing.PolynomialFeatures,
"RobustScaler": preprocessing.RobustScaler,
"QuantileTransformer": preprocessing.QuantileTransformer,
"KBinsDiscretizer": preprocessing.KBinsDiscretizer,
"PowerTransformer": preprocessing.PowerTransformer,
"SplineTransformer": SplineTransformer if spline_transformer_support else NOT_SUPPORTED,
"TargetEncoder": TargetEncoder if target_encoder_support else NOT_SUPPORTED,
}
SKLEARN_FEATURE_EXTRACTION_TABLE = {
# for raw data:
"DictVectorizer": feature_extraction.DictVectorizer,
"FeatureHasher": feature_extraction.FeatureHasher,
# for image data:
"PatchExtractor": feature_extraction.image.PatchExtractor,
# for text data:
"CountVectorizer": feature_extraction.text.CountVectorizer,
"HashingVectorizer": feature_extraction.text.HashingVectorizer,
"TfidfTransformer": feature_extraction.text.TfidfTransformer,
"TfidfVectorizer": feature_extraction.text.TfidfVectorizer,
}
SKLEARN_CROSS_DECOMPOSITION_TABLE = {
"PLSRegression": cross_decomposition.PLSRegression,
"PLSCanonical": cross_decomposition.PLSCanonical,
"CCA": cross_decomposition.CCA,
}
SKLEARN_COMPOSE_TABLE = {
"ColumnTransformer": compose.ColumnTransformer,
"TransformedTargetRegressor": compose.TransformedTargetRegressor,
}
KEYS_NEED_PREPROCESSING_BEFORE_DESERIALIZATION = {
"_label_binarizer": preprocessing.LabelBinarizer, # in Ridge Classifier
"active_": np.int32, # in Lasso Lars
"n_nonzero_coefs_": np.int64, # in OMP-CV
"scores_": dict, # in Logistic Regression CV,
"_base_loss": {}, # BaseLoss in Logistic Regression,
"loss_function_": {}, # LossFunction in SGD Classifier,
"estimator_": {}, # LinearRegression model inside RANSAC
}
NUMPY_TYPE_DICT = {
"numpy.intc": np.intc,
"numpy.int32": np.int32,
"numpy.int64": np.int64,
"numpy.float64": np.float64,
"numpy.infinity": lambda _: np.inf,
"numpy.uint8": np.uint8,
"numpy.uint64": np.uint64,
"numpy.dtype": np.dtype,
"numpy.nan": np.nan,
}
EXPORTED_MODELS_PATH = {
"LINEAR_MODEL": "exported_linear_models",
"NEURAL_NETWORK": "exported_neural_networks",
"DECISION_TREE": "exported_decision_trees",
"CLUSTERING": "exported_clusterings",
"NAIVE_BAYES": "exported_naive_bayes",
"SVM": "exported_svms",
"NEIGHBORS": "exported_neighbors",
"ENSEMBLE": "exported_ensembles",
"CROSS_DECOMPOSITION": "exported_cross_decomposition",
"COMPOSE": "exported_composes",
}
SKLEARN_SUPPORTED_CATEGORIES = {
"LINEAR_MODEL": SKLEARN_LINEAR_MODEL_TABLE,
"NEURAL_NETWORK": SKLEARN_NEURAL_NETWORK_TABLE,
"DECISION_TREE": SKLEARN_DECISION_TREE_TABLE,
"CLUSTERING": SKLEARN_CLUSTERING_TABLE,
"NAIVE_BAYES": SKLEARN_NAIVE_BAYES_TABLE,
"SVM": SKLEARN_SVM_TABLE,
"NEIGHBORS": SKLEARN_NEIGHBORS_TABLE,
"ENSEMBLE": SKLEARN_ENSEMBLE_TABLE,
"CROSS_DECOMPOSITION": SKLEARN_CROSS_DECOMPOSITION_TABLE,
"COMPOSE": SKLEARN_COMPOSE_TABLE,
}
================================================
FILE: pymilo/streaming/__init__.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo ML Streaming."""
from .pymilo_client import PymiloClient
from .pymilo_server import PymiloServer
from .compressor import Compression
from .communicator import CommunicationProtocol
================================================
FILE: pymilo/streaming/communicator.py
================================================
# -*- coding: utf-8 -*-
"""PyMilo Communication Mediums."""
from __future__ import annotations
import uuid
import json
import asyncio
from typing import Any, Dict, List, Optional, Union
import uvicorn
import requests
import websockets
from enum import Enum
from fastapi import FastAPI, Request, WebSocket, WebSocketDisconnect, HTTPException
from .interfaces import ClientCommunicator
from .param import (
PYMILO_INVALID_URL,
PYMILO_CLIENT_WEBSOCKET_NOT_CONNECTED,
REST_API_PREFIX,
MSG_DOWNLOAD_REQUEST,
MSG_UPLOAD_REQUEST,
MSG_ATTRIBUTE_CALL_REQUEST,
MSG_ATTRIBUTE_TYPE_REQUEST,
MSG_REST_DOWNLOAD_REQUEST,
MSG_REST_UPLOAD_REQUEST,
MSG_REST_ATTRIBUTE_CALL_REQUEST,
MSG_REST_ATTRIBUTE_TYPE_REQUEST,
)
from .util import validate_websocket_url, validate_http_url
class RESTClientCommunicator(ClientCommunicator):
"""Facilitate working with the communication medium from the client side for the REST protocol."""
def __init__(self, server_url: str) -> None:
"""
Initialize the Pymilo RESTClientCommunicator instance.
:param server_url: the url to which PyMilo Server listens
"""
is_valid, server_url = validate_http_url(server_url)
if not is_valid:
raise Exception(PYMILO_INVALID_URL)
self._server_url = server_url.rstrip("/") + "/api/v1"
self.session = requests.Session()
retries = requests.adapters.Retry(
total=10,
backoff_factor=0.1,
status_forcelist=[500, 502, 503, 504]
)
adapter = requests.adapters.HTTPAdapter(max_retries=retries)
self.session.mount('http://', adapter)
self.session.mount('https://', adapter)
def download(self, client_id: str, model_id: str) -> str:
"""
Request for the remote ML model to download.
:param client_id: ID of the requesting client
:param model_id: ID of the model to download
"""
url = f"{self._server_url}/clients/{client_id}/models/{model_id}/download"
response = self.session.get(url, timeout=5)
response.raise_for_status()
return response.json()["payload"]
def upload(self, client_id: str, model_id: str, model: Any) -> bool:
"""
Upload the local ML model to the remote server.
:param client_id: ID of the client
:param model_id: ID of the model
:param model: serialized model content
"""
url = f"{self._server_url}/clients/{client_id}/models/{model_id}/upload"
response = self.session.post(url, json=model, timeout=5)
return response.status_code == 200
def attribute_call(self, client_id: str, model_id: str, call_payload: Dict) -> Dict:
"""
Delegate the requested attribute call to the remote server.
:param client_id: ID of the client
:param model_id: ID of the model
:param call_payload: payload containing attribute name, args, and kwargs
"""
url = f"{self._server_url}/clients/{client_id}/models/{model_id}/attribute-call"
response = self.session.post(url, json=call_payload, timeout=5)
response.raise_for_status()
return response.json()
def attribute_type(self, client_id: str, model_id: str, type_payload: Dict) -> Dict:
"""
Identify the attribute type of the requested attribute.
:param client_id: ID of the client
:param model_id: ID of the model
:param type_payload: payload containing attribute data to inspect
"""
url = f"{self._server_url}/clients/{client_id}/models/{model_id}/attribute-type"
response = self.session.post(url, json=type_payload, timeout=5)
response.raise_for_status()
return response.json()
def register_client(self) -> str:
"""Register client in the PyMiloServer."""
response = self.session.get(f"{self._server_url}/clients/register", timeout=5)
response.raise_for_status()
return response.json()["client_id"]
def remove_client(self, client_id: str) -> bool:
"""
Remove client from the PyMiloServer.
:param client_id: id of the client to remove
"""
response = self.session.delete(f"{self._server_url}/clients/{client_id}", timeout=5)
return response.status_code == 200
def register_model(self, client_id: str) -> str:
"""
Register ML model in the PyMiloServer.
:param client_id: id of the client who owns the model
"""
response = self.session.post(f"{self._server_url}/clients/{client_id}/models/register", timeout=5)
response.raise_for_status()
return response.json()["ml_model_id"]
def remove_model(self, client_id: str, model_id: str) -> bool:
"""
Remove ML model from the PyMiloServer.
:param client_id: client owning the model
:param model_id: model to remove
"""
response = self.session.delete(f"{self._server_url}/clients/{client_id}/models/{model_id}", timeout=5)
return response.status_code == 200
def get_ml_models(self, client_id: str) -> List[str]:
"""
Get all ML models registered for this specific client in the PyMiloServer.
:param client_id: client whose models are being queried
"""
response = self.session.get(f"{self._server_url}/clients/{client_id}/models", timeout=5)
response.raise_for_status()
return response.json()["ml_models_id"]
def grant_access(self, allower_id: str, allowee_id: str, model_id: str) -> bool:
"""
Grant access to a model to another client.
:param allower_id: ID of the client granting access
:param allowee_id: ID of the client being granted access
:param model_id: ID of the model being shared
"""
url = f"{self._server_url}/clients/{allower_id}/grant/{allowee_id}/models/{model_id}"
response = self.session.post(url, timeout=5)
return response.status_code == 200
def revoke_access(self, revoker_id: str, revokee_id: str, model_id: str) -> bool:
"""
Revoke previously granted model access.
:param revoker_id: ID of the client revoking access
:param revokee_id: ID of the client whose access is being revoked
:param model_id: ID of the model
"""
url = f"{self._server_url}/clients/{revoker_id}/revoke/{revokee_id}/models/{model_id}"
response = self.session.post(url, timeout=5)
return response.status_code == 200
def get_allowance(self, allower_id: str) -> Dict[str, List[str]]:
"""
Get the list of all allowees and their allowed models from a given allower.
:param allower_id: ID of the allower
"""
response = self.session.get(f"{self._server_url}/clients/{allower_id}/allowances", timeout=5)
response.raise_for_status()
return response.json()["allowance"]
def get_allowed_models(self, allower_id: str, allowee_id: str) -> List[str]:
"""
Get the list of models that one client is allowed to access from another.
:param allower_id: ID of the model owner
:param allowee_id: ID of the requesting client
"""
url = f"{self._server_url}/clients/{allower_id}/allowances/{allowee_id}"
response = self.session.get(url, timeout=5)
response.raise_for_status()
return response.json()["allowed_models"]
class RESTServerCommunicator():
"""Facilitate working with the communication medium from the server side for the REST protocol."""
def __init__(
self,
ps,
host: str = "127.0.0.1",
port: int = 8000,
):
"""
Initialize the Pymilo RESTServerCommunicator instance.
:param ps: reference to the PyMilo server
:param host: the url to which PyMilo Server listens
:param port: the port to which PyMilo Server listens
"""
self._ps = ps
self.host = host
self.port = port
self.app = FastAPI()
self.setup_routes()
def setup_routes(self):
"""Configure endpoints to handle RESTClientCommunicator requests."""
@self.app.get(f"{REST_API_PREFIX}/health")
async def health():
return {"status": "ok"}
@self.app.get(f"{REST_API_PREFIX}/clients/register")
async def request_client_id():
client_id = str(uuid.uuid4())
self._ps.init_client(client_id)
return {"client_id": client_id}
@self.app.delete(f"{REST_API_PREFIX}/clients/{{client_id}}")
async def remove_client(client_id: str):
is_succeed, detail_message = self._ps.remove_client(client_id)
if not is_succeed:
raise HTTPException(status_code=404, detail=detail_message)
return {"client_id": client_id}
@self.app.post(f"{REST_API_PREFIX}/clients/{{client_id}}/models/register")
async def request_model(client_id: str):
model_id = str(uuid.uuid4())
is_succeed, detail_message = self._ps.init_ml_model(client_id, model_id)
if not is_succeed:
raise HTTPException(status_code=404, detail=detail_message)
return {"client_id": client_id, "ml_model_id": model_id}
@self.app.delete(f"{REST_API_PREFIX}/clients/{{client_id}}/models/{{ml_model_id}}")
async def remove_model(client_id: str, ml_model_id: str):
is_succeed, detail_message = self._ps.remove_ml_model(client_id, ml_model_id)
if not is_succeed:
raise HTTPException(status_code=404, detail=detail_message)
return {"client_id": client_id, "ml_model_id": ml_model_id}
@self.app.get(f"{REST_API_PREFIX}/clients/{{client_id}}/models")
async def get_client_models(client_id: str):
return {"client_id": client_id, "ml_models_id": self._ps.get_ml_models(client_id)}
@self.app.post(f"{REST_API_PREFIX}/clients/{{allower_id}}/grant/{{allowee_id}}/models/{{model_id}}")
async def grant_model_access(allower_id: str, allowee_id: str, model_id: str):
is_succeed, detail_message = self._ps.grant_access(allower_id, allowee_id, model_id)
if not is_succeed:
raise HTTPException(status_code=404, detail=detail_message)
return {
"allower_id": allower_id,
"allowee_id": allowee_id,
"allowed_model_id": model_id
}
@self.app.post(f"{REST_API_PREFIX}/clients/{{revoker_id}}/revoke/{{revokee_id}}/models/{{model_id}}")
async def revoke_model_access(revoker_id: str, revokee_id: str, model_id: str):
is_succeed, detail_message = self._ps.revoke_access(revoker_id, revokee_id, model_id)
if not is_succeed:
raise HTTPException(status_code=404, detail=detail_message)
return {
"revoker_id": revoker_id,
"revokee_id": revokee_id,
"revoked_model_id": model_id
}
@self.app.get(f"{REST_API_PREFIX}/clients/{{allower_id}}/allowances")
async def get_allowance(allower_id: str):
allowance, reason = self._ps.get_clients_allowance(allower_id)
if allowance is None:
raise HTTPException(status_code=404, detail=reason)
return {"allower_id": allower_id, "allowance": allowance}
@self.app.get(f"{REST_API_PREFIX}/clients/{{allower_id}}/allowances/{{allowee_id}}")
async def get_allowed_models(allower_id: str, allowee_id: str):
models, reason = self._ps.get_allowed_models(allower_id, allowee_id)
if models is None:
raise HTTPException(status_code=404, detail=reason)
return {"allower_id": allower_id, "allowee_id": allowee_id, "allowed_models": models}
@self.app.get(f"{REST_API_PREFIX}/clients/{{client_id}}/models/{{ml_model_id}}/download")
async def download_model(client_id: str, ml_model_id: str):
is_valid, reason = self._ps._validate_id(client_id, ml_model_id)
if not is_valid:
raise HTTPException(status_code=404, detail=reason)
return {
"message": MSG_REST_DOWNLOAD_REQUEST.format(client_id=client_id, ml_model_id=ml_model_id),
"payload": self._ps.export_model(client_id, ml_model_id)
}
@self.app.post(f"{REST_API_PREFIX}/clients/{{client_id}}/models/{{ml_model_id}}/upload")
async def upload_model(client_id: str, ml_model_id: str, request: Request):
model_data = self.parse(await request.json()).get("model")
if model_data is None:
raise HTTPException(status_code=400, detail="Missing 'model' in request")
is_valid, reason = self._ps._validate_id(client_id, ml_model_id)
if not is_valid:
raise HTTPException(status_code=404, detail=reason)
return {
"message": MSG_REST_UPLOAD_REQUEST.format(client_id=client_id, ml_model_id=ml_model_id),
"payload": self._ps.update_model(client_id, ml_model_id, model_data)
}
@self.app.post(f"{REST_API_PREFIX}/clients/{{client_id}}/models/{{ml_model_id}}/attribute-call")
async def attribute_call(client_id: str, ml_model_id: str, request: Request):
request_payload = self.parse(await request.json())
is_valid, reason = self._ps._validate_id(client_id, ml_model_id)
if not is_valid:
raise HTTPException(status_code=404, detail=reason)
result = self._ps.execute_model(request_payload)
return {
"message": MSG_REST_ATTRIBUTE_CALL_REQUEST.format(client_id=client_id, ml_model_id=ml_model_id),
"payload": result or "The ML model has been updated in place."
}
@self.app.post(f"{REST_API_PREFIX}/clients/{{client_id}}/models/{{ml_model_id}}/attribute-type")
async def attribute_type(client_id: str, ml_model_id: str, request: Request):
request = self.parse(await request.json())
is_valid, reason = self._ps._validate_id(client_id, ml_model_id)
if not is_valid:
raise HTTPException(status_code=404, detail=reason)
is_callable, field_value = self._ps.is_callable_attribute(request)
return {
"message": MSG_REST_ATTRIBUTE_TYPE_REQUEST.format(client_id=client_id, ml_model_id=ml_model_id),
"attribute type": "method" if is_callable else "field",
"attribute value": "" if is_callable else field_value,
}
def parse(self, body: str) -> Dict:
"""
Parse the compressed encrypted body of the request.
:param body: request body
"""
return json.loads(
self._ps._compressor.extract(
self._ps._encryptor.decrypt(body)
)
)
def run(self):
"""Run internal fastapi server."""
uvicorn.run(self.app, host=self.host, port=self.port)
class WebSocketClientCommunicator(ClientCommunicator):
"""Facilitate working with the communication medium from the client side for the WebSocket protocol."""
def __init__(
self,
server_url: str = "ws://127.0.0.1:8000"
):
"""
Initialize the WebSocketClientCommunicator instance.
:param server_url: the WebSocket server URL to connect to.
"""
is_valid, url = validate_websocket_url(server_url)
if not is_valid:
raise Exception(PYMILO_INVALID_URL)
self.server_url = url
self.websocket = None
self.connection_established = asyncio.Event()
if asyncio._get_running_loop() is None:
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)
else:
self.loop = asyncio.get_event_loop()
self.loop.run_until_complete(self.connect())
def is_socket_closed(self) -> bool:
"""Check if the WebSocket connection is closed."""
if self.websocket is None:
return True
elif hasattr(self.websocket, "closed"):
return self.websocket.closed
elif hasattr(self.websocket, "state"):
return self.websocket.state is websockets.protocol.State.CLOSED
async def connect(self):
"""Establish a WebSocket connection with the server."""
if self.is_socket_closed():
self.websocket = await websockets.connect(self.server_url)
print("Connected to the WebSocket server.")
self.connection_established.set()
async def disconnect(self):
gitextract_4tl_xksm/
├── .coveragerc
├── .github/
│ ├── CODE_OF_CONDUCT.md
│ ├── CONTRIBUTING.md
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.yml
│ │ ├── config.yml
│ │ └── feature_request.yml
│ ├── PULL_REQUEST_TEMPLATE.md
│ ├── dependabot.yml
│ └── workflows/
│ ├── publish_conda.yml
│ ├── publish_pypi.yml
│ └── test.yml
├── .gitignore
├── .pydocstyle
├── AUTHORS.md
├── CHANGELOG.md
├── CITATION.cff
├── LICENSE
├── README.md
├── SECURITY.md
├── SUPPORTED_MODELS.md
├── autopep8.bat
├── autopep8.sh
├── codecov.yml
├── dev-requirements.txt
├── otherfiles/
│ ├── RELEASE.md
│ ├── meta.yaml
│ ├── requirements-splitter.py
│ └── version_check.py
├── paper/
│ ├── .gitignore
│ ├── PyMilo.bib
│ ├── paper.bib
│ └── paper.md
├── pymilo/
│ ├── __init__.py
│ ├── __main__.py
│ ├── chains/
│ │ ├── __init__.py
│ │ ├── chain.py
│ │ ├── clustering_chain.py
│ │ ├── compose_chain.py
│ │ ├── cross_decomposition_chain.py
│ │ ├── decision_tree_chain.py
│ │ ├── ensemble_chain.py
│ │ ├── linear_model_chain.py
│ │ ├── naive_bayes_chain.py
│ │ ├── neighbours_chain.py
│ │ ├── neural_network_chain.py
│ │ ├── svm_chain.py
│ │ └── util.py
│ ├── exceptions/
│ │ ├── __init__.py
│ │ ├── deserialize_exception.py
│ │ ├── pymilo_exception.py
│ │ └── serialize_exception.py
│ ├── pymilo_func.py
│ ├── pymilo_obj.py
│ ├── pymilo_param.py
│ ├── streaming/
│ │ ├── __init__.py
│ │ ├── communicator.py
│ │ ├── compressor.py
│ │ ├── encryptor.py
│ │ ├── interfaces.py
│ │ ├── param.py
│ │ ├── pymilo_client.py
│ │ ├── pymilo_server.py
│ │ └── util.py
│ ├── transporters/
│ │ ├── __init__.py
│ │ ├── adamoptimizer_transporter.py
│ │ ├── baseloss_transporter.py
│ │ ├── binmapper_transporter.py
│ │ ├── bisecting_tree_transporter.py
│ │ ├── bunch_transporter.py
│ │ ├── cfnode_transporter.py
│ │ ├── compose_transporter.py
│ │ ├── feature_extraction_transporter.py
│ │ ├── function_transporter.py
│ │ ├── general_data_structure_transporter.py
│ │ ├── generator_transporter.py
│ │ ├── lossfunction_transporter.py
│ │ ├── neighbors_tree_transporter.py
│ │ ├── preprocessing_transporter.py
│ │ ├── randomstate_transporter.py
│ │ ├── sgdoptimizer_transporter.py
│ │ ├── transporter.py
│ │ ├── tree_transporter.py
│ │ └── treepredictor_transporter.py
│ └── utils/
│ ├── __init__.py
│ ├── data_exporter.py
│ ├── test_pymilo.py
│ └── util.py
├── requirements.txt
├── setup.py
├── streaming-requirements.txt
└── tests/
├── test_clusterings/
│ ├── affinity_propagation.py
│ ├── birch.py
│ ├── bisecting_kmeans.py
│ ├── dbscan.py
│ ├── gaussian_mixture/
│ │ ├── bayesian_gaussian_mixture.py
│ │ └── gaussian_mixture.py
│ ├── hdbscan.py
│ ├── hierarchical_clustering/
│ │ ├── agglomerative_clustering.py
│ │ └── feature_agglomeration.py
│ ├── kmeans.py
│ ├── mean_shift.py
│ ├── minibatch_kmeans.py
│ ├── optics.py
│ ├── spectral_clustering/
│ │ ├── spectral_biclustering.py
│ │ ├── spectral_clustering.py
│ │ └── spectral_coclustering.py
│ └── test_clusterings.py
├── test_composes/
│ ├── column_transformer.py
│ ├── test_compose_models.py
│ ├── transformed_target_regressor.py
│ └── util.py
├── test_cross_decomposition/
│ ├── cca.py
│ ├── pls_canonical.py
│ ├── pls_regression.py
│ └── test_cross_decompositions.py
├── test_decision_trees/
│ ├── decision_tree/
│ │ ├── decision_tree_classification.py
│ │ └── decision_tree_regression.py
│ ├── extra_tree/
│ │ ├── extra_tree_classification.py
│ │ └── extra_tree_regression.py
│ └── test_decision_trees.py
├── test_ensembles/
│ ├── adaboost/
│ │ ├── adaboost_classifier.py
│ │ └── adaboost_regressor.py
│ ├── bagging/
│ │ ├── bagging_classifier.py
│ │ └── bagging_regressor.py
│ ├── extra_trees/
│ │ ├── extra_trees_classifier.py
│ │ └── extra_trees_regressor.py
│ ├── gradient_booster/
│ │ ├── gradient_booster_classifier.py
│ │ └── gradient_booster_regressor.py
│ ├── hist_gradient_boosting/
│ │ ├── hist_gradient_boosting_classifier.py
│ │ └── hist_gradient_boosting_regressor.py
│ ├── isolation_forest.py
│ ├── pipeline.py
│ ├── random_forests/
│ │ ├── random_forest_classifier.py
│ │ └── random_forest_regressor.py
│ ├── random_trees_embedding.py
│ ├── stacking/
│ │ ├── stacking_classifier.py
│ │ └── stacking_regressor.py
│ ├── test_ensembles.py
│ └── voting/
│ ├── voting_classifier.py
│ └── voting_regressor.py
├── test_exceptions/
│ ├── custom_models.py
│ ├── export_exceptions.py
│ ├── import_exceptions.py
│ ├── invalid_jsons/
│ │ ├── corrupted.json
│ │ └── unknown-model.json
│ ├── test_exceptions.py
│ └── valid_jsons/
│ └── linear_regression.json
├── test_feature_extraction/
│ ├── count_vectorizer.py
│ ├── dict_vectorizer.py
│ ├── feature_hasher.py
│ ├── hashing_vectorizer.py
│ ├── patch_extractor.py
│ ├── pipeline.py
│ ├── test_feature_extractions.py
│ ├── tfidf_transformer.py
│ ├── tfidf_vectorizer.py
│ └── util.py
├── test_linear_models/
│ ├── bayesian/
│ │ ├── ard_regression.py
│ │ └── bayesian_regression.py
│ ├── elasticnet/
│ │ ├── elastic_net.py
│ │ ├── elastic_net_cv.py
│ │ ├── multi_task_elastic_net.py
│ │ └── multi_task_elastic_net_cv.py
│ ├── glm/
│ │ ├── gamma_regression.py
│ │ ├── poisson_regression.py
│ │ └── tweedie_regression.py
│ ├── lasso_lars/
│ │ ├── lasso.py
│ │ ├── lasso_cv.py
│ │ ├── lasso_lars.py
│ │ ├── lasso_lars_cv.py
│ │ ├── lasso_lars_ic.py
│ │ ├── multi_task_lasso.py
│ │ └── multi_task_lasso_cv.py
│ ├── linear_regression/
│ │ └── linear_regression.py
│ ├── logistic/
│ │ ├── logistic_regression.py
│ │ └── logistic_regression_cv.py
│ ├── omp/
│ │ ├── omp.py
│ │ └── omp_cv.py
│ ├── passive_aggressive/
│ │ ├── passive_aggressive_classifier.py
│ │ └── passive_aggressive_regressor.py
│ ├── perceptron/
│ │ └── perception.py
│ ├── quantile/
│ │ └── quantile.py
│ ├── ridge/
│ │ ├── ridge_classifier.py
│ │ ├── ridge_classifier_cv.py
│ │ ├── ridge_regression.py
│ │ └── ridge_regression_cv.py
│ ├── robustness/
│ │ ├── huber_regression.py
│ │ ├── ransac_regression.py
│ │ └── theil_sen_regression.py
│ ├── sgd/
│ │ ├── sgd_classifier.py
│ │ ├── sgd_oneclass_svm.py
│ │ └── sgd_regression.py
│ └── test_linear_models.py
├── test_misc_functionalities.py/
│ └── test_batch.py
├── test_ml_streaming/
│ ├── docker_files/
│ │ ├── Dockerfile1
│ │ └── Dockerfile2
│ ├── run_server.py
│ ├── scenarios/
│ │ ├── scenario1.py
│ │ ├── scenario2.py
│ │ ├── scenario3.py
│ │ └── scenario4.py
│ └── test_streaming.py
├── test_naive_bayes/
│ ├── bernoulli.py
│ ├── categorical.py
│ ├── complement.py
│ ├── gaussian.py
│ ├── multinomial.py
│ └── test_naive_bayes_models.py
├── test_neighbors/
│ ├── kneighbors_classifier.py
│ ├── kneighbors_regressor.py
│ ├── local_outlier_factor.py
│ ├── nearest_centroid.py
│ ├── nearest_neighbor.py
│ ├── radius_neighbors_classifier.py
│ ├── radius_neighbors_regressor.py
│ └── test_neighbors.py
├── test_neural_networks/
│ ├── bernoulli_rbm/
│ │ └── bernoulli_rbm.py
│ ├── mlp/
│ │ ├── mlp_classification.py
│ │ └── mlp_regression.py
│ └── test_neural_networks.py
├── test_preprocessings/
│ ├── binarizer.py
│ ├── function_transformer.py
│ ├── kbins_discretizer.py
│ ├── kernel_centerer.py
│ ├── label_binarizer.py
│ ├── label_encoder.py
│ ├── max_abs_scaler.py
│ ├── multilabel_binarizer.py
│ ├── normalizer.py
│ ├── one_hot_encoder.py
│ ├── ordinal_encoder.py
│ ├── polynomial_features.py
│ ├── power_transformer.py
│ ├── quantile_transformer.py
│ ├── robust_scaler.py
│ ├── spline_transformer.py
│ ├── standard_scaler.py
│ ├── target_encoder.py
│ ├── test_preprocessings.py
│ └── util.py
└── test_svms/
├── linear_svc.py
├── linear_svr.py
├── nu_svc.py
├── nu_svr.py
├── one_class_svm.py
├── svc.py
├── svr.py
└── test_svms.py
SYMBOL INDEX (533 symbols across 195 files)
FILE: otherfiles/version_check.py
function print_result (line 38) | def print_result(failed=False):
FILE: pymilo/__main__.py
function main (line 24) | def main():
FILE: pymilo/chains/chain.py
class Chain (line 13) | class Chain(ABC):
method is_supported (line 21) | def is_supported(self, model):
method transport (line 31) | def transport(self, request, command, is_inner_model=False):
method serialize (line 45) | def serialize(self, model):
method deserialize (line 55) | def deserialize(self, serialized_model, is_inner_model=False):
method validate (line 67) | def validate(self, model, command):
class AbstractChain (line 79) | class AbstractChain(Chain):
method __init__ (line 82) | def __init__(self, transporters, supported_models):
method is_supported (line 95) | def is_supported(self, model):
method transport (line 106) | def transport(self, request, command, is_inner_model=False):
method serialize (line 148) | def serialize(self, model):
method deserialize (line 160) | def deserialize(self, serialized_model, is_inner_model=False):
method validate (line 185) | def validate(self, model, command):
FILE: pymilo/chains/compose_chain.py
class ComposeModelChain (line 18) | class ComposeModelChain(AbstractChain):
method deserialize (line 21) | def deserialize(self, compose, is_inner_model=False):
function get_transporter (line 51) | def get_transporter(model):
FILE: pymilo/chains/ensemble_chain.py
class EnsembleModelChain (line 37) | class EnsembleModelChain(AbstractChain):
method serialize (line 40) | def serialize(self, ensemble_object):
method deserialize (line 104) | def deserialize(self, ensemble, is_inner_model=False):
function serialize_models_in_ndarray (line 188) | def serialize_models_in_ndarray(ndarray_instance):
function deserialize_models_in_ndarray (line 231) | def deserialize_models_in_ndarray(serialized_ndarray):
FILE: pymilo/chains/linear_model_chain.py
class LinearModelChain (line 22) | class LinearModelChain(AbstractChain):
method serialize (line 25) | def serialize(self, linear_model_object):
method deserialize (line 47) | def deserialize(self, linear_model, is_inner_model=False):
function is_deserialized_linear_model (line 85) | def is_deserialized_linear_model(content):
FILE: pymilo/chains/util.py
function get_concrete_transporter (line 27) | def get_concrete_transporter(model):
function get_transporter (line 60) | def get_transporter(model):
function serialize_possible_ml_model (line 90) | def serialize_possible_ml_model(model):
function deserialize_possible_ml_model (line 112) | def deserialize_possible_ml_model(serialized_model):
FILE: pymilo/exceptions/deserialize_exception.py
class DeserializationErrorTypes (line 7) | class DeserializationErrorTypes(Enum):
class PymiloDeserializationException (line 15) | class PymiloDeserializationException(PymiloException):
method __init__ (line 32) | def __init__(self, meta_data):
method to_pymilo_log (line 57) | def to_pymilo_log(self):
FILE: pymilo/exceptions/pymilo_exception.py
class PymiloException (line 11) | class PymiloException(Exception, ABC):
method __init__ (line 14) | def __init__(self, message, meta_data):
method to_pymilo_log (line 30) | def to_pymilo_log(self):
method to_pymilo_issue (line 61) | def to_pymilo_issue(self):
method __str__ (line 89) | def __str__(self):
FILE: pymilo/exceptions/serialize_exception.py
class SerializationErrorTypes (line 8) | class SerializationErrorTypes(Enum):
class PymiloSerializationException (line 15) | class PymiloSerializationException(PymiloException):
method __init__ (line 27) | def __init__(self, meta_data):
method to_pymilo_log (line 47) | def to_pymilo_log(self):
FILE: pymilo/pymilo_func.py
function get_sklearn_version (line 11) | def get_sklearn_version():
function get_sklearn_data (line 20) | def get_sklearn_data(model):
function to_sklearn_model (line 32) | def to_sklearn_model(import_obj):
function compare_model_outputs (line 44) | def compare_model_outputs(exported_output,
function print_supported_ml_models (line 68) | def print_supported_ml_models():
function pymilo_help (line 82) | def pymilo_help():
FILE: pymilo/pymilo_obj.py
class Export (line 18) | class Export:
method __init__ (line 27) | def __init__(self, model):
method save (line 39) | def save(self, file_adr):
method to_json (line 50) | def to_json(self):
method batch_export (line 81) | def batch_export(models, file_addr, run_parallel=False):
class Import (line 120) | class Import:
method __init__ (line 129) | def __init__(self, file_adr=None, json_dump=None, url=None):
method to_model (line 177) | def to_model(self):
method batch_import (line 186) | def batch_import(file_addr, run_parallel=False):
FILE: pymilo/streaming/communicator.py
class RESTClientCommunicator (line 31) | class RESTClientCommunicator(ClientCommunicator):
method __init__ (line 34) | def __init__(self, server_url: str) -> None:
method download (line 54) | def download(self, client_id: str, model_id: str) -> str:
method upload (line 66) | def upload(self, client_id: str, model_id: str, model: Any) -> bool:
method attribute_call (line 78) | def attribute_call(self, client_id: str, model_id: str, call_payload: ...
method attribute_type (line 91) | def attribute_type(self, client_id: str, model_id: str, type_payload: ...
method register_client (line 104) | def register_client(self) -> str:
method remove_client (line 110) | def remove_client(self, client_id: str) -> bool:
method register_model (line 119) | def register_model(self, client_id: str) -> str:
method remove_model (line 129) | def remove_model(self, client_id: str, model_id: str) -> bool:
method get_ml_models (line 139) | def get_ml_models(self, client_id: str) -> List[str]:
method grant_access (line 149) | def grant_access(self, allower_id: str, allowee_id: str, model_id: str...
method revoke_access (line 161) | def revoke_access(self, revoker_id: str, revokee_id: str, model_id: st...
method get_allowance (line 173) | def get_allowance(self, allower_id: str) -> Dict[str, List[str]]:
method get_allowed_models (line 183) | def get_allowed_models(self, allower_id: str, allowee_id: str) -> List...
class RESTServerCommunicator (line 196) | class RESTServerCommunicator():
method __init__ (line 199) | def __init__(
method setup_routes (line 218) | def setup_routes(self):
method parse (line 343) | def parse(self, body: str) -> Dict:
method run (line 355) | def run(self):
class WebSocketClientCommunicator (line 360) | class WebSocketClientCommunicator(ClientCommunicator):
method __init__ (line 363) | def __init__(
method is_socket_closed (line 385) | def is_socket_closed(self) -> bool:
method connect (line 394) | async def connect(self):
method disconnect (line 401) | async def disconnect(self):
method _disconnect_sync (line 407) | def _disconnect_sync(self) -> None:
method close (line 413) | def close(self) -> None:
method __del__ (line 422) | def __del__(self) -> None:
method send_message (line 426) | async def send_message(self, action: str, payload: Optional[Dict] = No...
method _check_response_error (line 443) | def _check_response_error(self, response: Dict) -> None:
method download (line 452) | def download(self, client_id: str, model_id: str) -> str:
method upload (line 468) | def upload(self, client_id: str, model_id: str, model: Any) -> bool:
method attribute_call (line 486) | def attribute_call(self, client_id: str, model_id: str, call_payload: ...
method attribute_type (line 504) | def attribute_type(self, client_id: str, model_id: str, type_payload: ...
method register_client (line 522) | def register_client(self) -> str:
method remove_client (line 530) | def remove_client(self, client_id: str) -> bool:
method register_model (line 542) | def register_model(self, client_id: str) -> str:
method remove_model (line 554) | def remove_model(self, client_id: str, model_id: str) -> bool:
method get_ml_models (line 570) | def get_ml_models(self, client_id: str) -> List[str]:
method grant_access (line 582) | def grant_access(self, allower_id: str, allowee_id: str, model_id: str...
method revoke_access (line 600) | def revoke_access(self, revoker_id: str, revokee_id: str, model_id: st...
method get_allowance (line 618) | def get_allowance(self, allower_id: str) -> Dict[str, List[str]]:
method get_allowed_models (line 630) | def get_allowed_models(self, allower_id: str, allowee_id: str) -> List...
class WebSocketServerCommunicator (line 647) | class WebSocketServerCommunicator:
method __init__ (line 650) | def __init__(
method setup_routes (line 685) | def setup_routes(self):
method connect (line 697) | async def connect(self, websocket: WebSocket) -> None:
method disconnect (line 706) | def disconnect(self, websocket: WebSocket) -> None:
method handle_message (line 714) | async def handle_message(self, websocket: WebSocket, message: str) -> ...
method _handle_register_client (line 738) | def _handle_register_client(self, payload: dict) -> dict:
method _handle_remove_client (line 751) | def _handle_remove_client(self, payload: dict) -> dict:
method _handle_register_model (line 766) | def _handle_register_model(self, payload: dict) -> dict:
method _handle_remove_model (line 783) | def _handle_remove_model(self, payload: dict) -> dict:
method _handle_get_ml_models (line 800) | def _handle_get_ml_models(self, payload: dict) -> dict:
method _handle_grant_access (line 813) | def _handle_grant_access(self, payload: dict) -> dict:
method _handle_revoke_access (line 832) | def _handle_revoke_access(self, payload: dict) -> dict:
method _handle_get_allowance (line 851) | def _handle_get_allowance(self, payload: dict) -> dict:
method _handle_get_allowed_models (line 867) | def _handle_get_allowed_models(self, payload: dict) -> dict:
method _handle_download (line 885) | def _handle_download(self, payload: dict) -> dict:
method _handle_upload (line 901) | def _handle_upload(self, payload: dict) -> dict:
method _handle_attribute_call (line 924) | def _handle_attribute_call(self, payload: dict) -> dict:
method _handle_attribute_type (line 945) | def _handle_attribute_type(self, payload: dict) -> dict:
method parse (line 967) | def parse(self, message: Union[str, Dict]) -> Dict:
method run (line 981) | def run(self):
class CommunicationProtocol (line 986) | class CommunicationProtocol(Enum):
FILE: pymilo/streaming/compressor.py
class DummyCompressor (line 13) | class DummyCompressor(Compressor):
method compress (line 17) | def compress(payload):
method extract (line 22) | def extract(payload):
class GZIPCompressor (line 27) | class GZIPCompressor(Compressor):
method compress (line 31) | def compress(payload):
method extract (line 41) | def extract(payload):
class ZLIBCompressor (line 47) | class ZLIBCompressor(Compressor):
method compress (line 51) | def compress(payload):
method extract (line 61) | def extract(payload):
class LZMACompressor (line 67) | class LZMACompressor(Compressor):
method compress (line 71) | def compress(payload):
method extract (line 81) | def extract(payload):
class BZ2Compressor (line 87) | class BZ2Compressor(Compressor):
method compress (line 91) | def compress(payload):
method extract (line 101) | def extract(payload):
class Compression (line 107) | class Compression(Enum):
FILE: pymilo/streaming/encryptor.py
class DummyEncryptor (line 6) | class DummyEncryptor(Encryptor):
method encrypt (line 10) | def encrypt(payload):
method decrypt (line 15) | def decrypt(payload):
FILE: pymilo/streaming/interfaces.py
class Compressor (line 6) | class Compressor(ABC):
method compress (line 14) | def compress(payload):
method extract (line 24) | def extract(payload):
class Encryptor (line 34) | class Encryptor(ABC):
method encrypt (line 42) | def encrypt(payload):
method decrypt (line 52) | def decrypt(payload):
class ClientCommunicator (line 62) | class ClientCommunicator(ABC):
method register_client (line 74) | def register_client(self):
method remove_client (line 83) | def remove_client(self, client_id):
method register_model (line 94) | def register_model(self, client_id):
method remove_model (line 105) | def remove_model(self, client_id, model_id):
method get_ml_models (line 118) | def get_ml_models(self, client_id):
method grant_access (line 129) | def grant_access(self, allower_id, allowee_id, model_id):
method revoke_access (line 144) | def revoke_access(self, revoker_id, revokee_id, model_id):
method get_allowance (line 159) | def get_allowance(self, allower_id):
method get_allowed_models (line 170) | def get_allowed_models(self, allower_id, allowee_id):
method upload (line 183) | def upload(self, client_id, model_id, model):
method download (line 194) | def download(self, client_id, model_id):
method attribute_call (line 204) | def attribute_call(self, client_id, model_id, call_payload):
method attribute_type (line 215) | def attribute_type(self, client_id, model_id, type_payload):
FILE: pymilo/streaming/pymilo_client.py
class PymiloClient (line 14) | class PymiloClient:
class Mode (line 17) | class Mode(Enum):
method __init__ (line 23) | def __init__(
method encrypt_compress (line 54) | def encrypt_compress(self, body):
method toggle_mode (line 66) | def toggle_mode(self, mode=Mode.LOCAL):
method download (line 77) | def download(self):
method upload (line 93) | def upload(self):
method register (line 109) | def register(self):
method deregister (line 117) | def deregister(self):
method register_ml_model (line 126) | def register_ml_model(self):
method deregister_ml_model (line 134) | def deregister_ml_model(self):
method get_ml_models (line 143) | def get_ml_models(self):
method grant_access (line 151) | def grant_access(self, allowee_id):
method revoke_access (line 164) | def revoke_access(self, revokee_id):
method get_allowance (line 177) | def get_allowance(self):
method get_allowed_models (line 185) | def get_allowed_models(self, allower_id):
method close (line 194) | def close(self):
method __enter__ (line 203) | def __enter__(self):
method __exit__ (line 211) | def __exit__(self, _exc_type, _exc_val, _exc_tb):
method __del__ (line 220) | def __del__(self):
method __getattr__ (line 224) | def __getattr__(self, attribute):
FILE: pymilo/streaming/pymilo_server.py
class PymiloServer (line 11) | class PymiloServer:
method __init__ (line 14) | def __init__(
method export_model (line 43) | def export_model(self, client_id, ml_model_id):
method update_model (line 51) | def update_model(self, client_id, ml_model_id, serialized_model):
method execute_model (line 61) | def execute_model(self, request):
method is_callable_attribute (line 89) | def is_callable_attribute(self, request):
method _validate_id (line 107) | def _validate_id(self, client_id, ml_model_id):
method init_client (line 123) | def init_client(self, client_id):
method remove_client (line 137) | def remove_client(self, client_id):
method grant_access (line 151) | def grant_access(self, allower_id, allowee_id, allowed_model_id):
method revoke_access (line 180) | def revoke_access(self, allower_id, allowee_id, allowed_model_id=None):
method get_allowed_models (line 214) | def get_allowed_models(self, allower_id, allowee_id):
method get_clients_allowance (line 231) | def get_clients_allowance(self, client_id):
method get_clients (line 243) | def get_clients(self):
method init_ml_model (line 251) | def init_ml_model(self, client_id, ml_model_id):
method set_ml_model (line 270) | def set_ml_model(self, client_id, ml_model_id, ml_model):
method remove_ml_model (line 284) | def remove_ml_model(self, client_id, ml_model_id):
method get_ml_models (line 303) | def get_ml_models(self, client_id):
FILE: pymilo/streaming/util.py
function validate_websocket_url (line 8) | def validate_websocket_url(url: str) -> str:
function validate_http_url (line 27) | def validate_http_url(url: str) -> str:
function generate_dockerfile (line 46) | def generate_dockerfile(
FILE: pymilo/transporters/adamoptimizer_transporter.py
class AdamOptimizerTransporter (line 8) | class AdamOptimizerTransporter(AbstractTransporter):
method serialize (line 11) | def serialize(self, data, key, model_type):
method deserialize (line 39) | def deserialize(self, data, key, model_type):
FILE: pymilo/transporters/baseloss_transporter.py
class BaseLossTransporter (line 42) | class BaseLossTransporter(AbstractTransporter): # pragma: no cover
method serialize (line 45) | def serialize(self, data, key, model_type):
method get_deserialized_base_loss (line 155) | def get_deserialized_base_loss(self, model_type, content):
method deserialize (line 177) | def deserialize(self, data, key, model_type):
FILE: pymilo/transporters/binmapper_transporter.py
class BinMapperTransporter (line 9) | class BinMapperTransporter(AbstractTransporter):
method serialize (line 12) | def serialize(self, data, key, model_type):
method deserialize (line 42) | def deserialize(self, data, key, model_type):
FILE: pymilo/transporters/bisecting_tree_transporter.py
class BisectingTreeTransporter (line 14) | class BisectingTreeTransporter(AbstractTransporter):
method serialize (line 17) | def serialize(self, data, key, model_type):
method deserialize (line 33) | def deserialize(self, data, key, model_type):
method serialize_bisecting_tree (line 57) | def serialize_bisecting_tree(self, bisecting_tree, gdst=None):
method deserialize_bisecting_tree (line 78) | def deserialize_bisecting_tree(self, bisecting_tree_obj, gdst=None):
function is_pymilo_serialized_bisecting_tree (line 108) | def is_pymilo_serialized_bisecting_tree(psbt):
FILE: pymilo/transporters/bunch_transporter.py
class BunchTransporter (line 14) | class BunchTransporter(AbstractTransporter):
method serialize (line 17) | def serialize(self, data, key, model_type):
method deserialize (line 41) | def deserialize(self, data, key, model_type):
FILE: pymilo/transporters/cfnode_transporter.py
class CFNodeTransporter (line 12) | class CFNodeTransporter(AbstractTransporter):
method __init__ (line 15) | def __init__(self):
method reset (line 24) | def reset(self):
method serialize (line 33) | def serialize(self, data, key, model_type):
method deserialize (line 49) | def deserialize(self, data, key, model_type):
method serialize_cfnode (line 67) | def serialize_cfnode(self, cfnode, gdst):
method deserialize_cfnode (line 101) | def deserialize_cfnode(self, cfnode_pymiloed_obj, gdst):
method serialize_cfsubcluster (line 139) | def serialize_cfsubcluster(self, cfsubcluster, gdst):
method deserialize_cfsubcluster (line 157) | def deserialize_cfsubcluster(self, cfsubcluster_pymiloed_obj, gdst):
method get_cfnode_id (line 178) | def get_cfnode_id(self, cfnode):
method get_base_cfnode (line 191) | def get_base_cfnode(self, cfnode_pymiloed_obj):
FILE: pymilo/transporters/compose_transporter.py
class ComposeTransporter (line 18) | class ComposeTransporter(AbstractTransporter):
method is_compose_internal_model (line 21) | def is_compose_internal_model(self, internal_model):
method _is_ml_model (line 46) | def _is_ml_model(self, obj):
method serialize_compose_internal_model (line 56) | def serialize_compose_internal_model(self, internal_model):
method deserialize_compose_internal_model (line 81) | def deserialize_compose_internal_model(self, serialized_internal_model):
method _serialize_nested (line 105) | def _serialize_nested(self, obj):
method _deserialize_nested (line 123) | def _deserialize_nested(self, obj):
method serialize (line 142) | def serialize(self, data, key, model_type):
method deserialize (line 164) | def deserialize(self, data, key, model_type):
FILE: pymilo/transporters/feature_extraction_transporter.py
class FeatureExtractorTransporter (line 17) | class FeatureExtractorTransporter(AbstractTransporter):
method serialize (line 20) | def serialize(self, data, key, model_type):
method deserialize (line 40) | def deserialize(self, data, key, model_type):
method is_fe_module (line 62) | def is_fe_module(self, fe_module):
method serialize_fe_module (line 76) | def serialize_fe_module(self, fe_module):
method deserialize_fe_module (line 105) | def deserialize_fe_module(self, serialized_fe_module):
FILE: pymilo/transporters/function_transporter.py
class FunctionTransporter (line 21) | class FunctionTransporter(AbstractTransporter):
method serialize (line 24) | def serialize(self, data, key, model_type):
method deserialize (line 56) | def deserialize(self, data, key, model_type):
FILE: pymilo/transporters/general_data_structure_transporter.py
class GeneralDataStructureTransporter (line 14) | class GeneralDataStructureTransporter(AbstractTransporter):
method _is_remainder_cols_list (line 17) | def _is_remainder_cols_list(self, obj):
method serialize_tuple (line 33) | def serialize_tuple(self, tuple_field):
method serialize_dict (line 65) | def serialize_dict(self, dictionary):
method serialize (line 112) | def serialize(self, data, key, model_type):
method deserialize (line 222) | def deserialize(self, data, key, model_type):
method get_deserialized_dict (line 265) | def get_deserialized_dict(self, content):
method get_deserialized_list (line 325) | def get_deserialized_list(self, content):
method get_deserialized_regular_primary_types (line 350) | def get_deserialized_regular_primary_types(self, content):
method is_numpy_primary_type (line 373) | def is_numpy_primary_type(self, content):
method ndarray_to_list (line 388) | def ndarray_to_list(self, ndarray_item):
method list_to_ndarray (line 408) | def list_to_ndarray(self, list_item):
method deserialize_primitive_type (line 448) | def deserialize_primitive_type(self, primitive):
method deep_serialize_ndarray (line 463) | def deep_serialize_ndarray(self, ndarray):
method is_deserialized_ndarray (line 491) | def is_deserialized_ndarray(self, deserialized_ndarray):
method deep_deserialize_ndarray (line 508) | def deep_deserialize_ndarray(self, deserialized_ndarray):
FILE: pymilo/transporters/generator_transporter.py
class GeneratorTransporter (line 9) | class GeneratorTransporter(AbstractTransporter):
method serialize (line 12) | def serialize(self, data, key, model_type):
method deserialize (line 38) | def deserialize(self, data, key, model_type):
FILE: pymilo/transporters/lossfunction_transporter.py
class LossFunctionTransporter (line 40) | class LossFunctionTransporter(AbstractTransporter):
method serialize (line 43) | def serialize(self, data, key, model_type):
method deserialize (line 137) | def deserialize(self, data, key, model_type):
FILE: pymilo/transporters/neighbors_tree_transporter.py
class NeighborsTreeTransporter (line 14) | class NeighborsTreeTransporter(AbstractTransporter):
method serialize (line 17) | def serialize(self, data, key, model_type):
method deserialize (line 41) | def deserialize(self, data, key, model_type):
FILE: pymilo/transporters/preprocessing_transporter.py
class PreprocessingTransporter (line 16) | class PreprocessingTransporter(AbstractTransporter):
method serialize (line 19) | def serialize(self, data, key, model_type):
method deserialize (line 39) | def deserialize(self, data, key, model_type):
method is_preprocessing_module (line 61) | def is_preprocessing_module(self, pre_module):
method serialize_pre_module (line 75) | def serialize_pre_module(self, pre_module):
method deserialize_pre_module (line 102) | def deserialize_pre_module(self, serialized_pre_module):
method is_bspline (line 130) | def is_bspline(self, bspline):
method serialize_spline (line 144) | def serialize_spline(self, bspline):
method deserialize_spline (line 160) | def deserialize_spline(self, serialized_bspline):
FILE: pymilo/transporters/randomstate_transporter.py
class RandomStateTransporter (line 8) | class RandomStateTransporter(AbstractTransporter):
method serialize (line 11) | def serialize(self, data, key, model_type):
method deserialize (line 39) | def deserialize(self, data, key, model_type):
FILE: pymilo/transporters/sgdoptimizer_transporter.py
class SGDOptimizerTransporter (line 8) | class SGDOptimizerTransporter(AbstractTransporter):
method serialize (line 11) | def serialize(self, data, key, model_type):
method deserialize (line 39) | def deserialize(self, data, key, model_type):
FILE: pymilo/transporters/transporter.py
class Command (line 9) | class Command(Enum):
class Transporter (line 16) | class Transporter(ABC):
method serialize (line 24) | def serialize(self, data, key, model_type):
method deserialize (line 41) | def deserialize(self, data, key, model_type):
method bypass (line 59) | def bypass(self, content):
method reset (line 69) | def reset(self):
method transport (line 79) | def transport(self, request, command):
class AbstractTransporter (line 95) | class AbstractTransporter(Transporter):
method bypass (line 98) | def bypass(self, content):
method transport (line 114) | def transport(self, request, command, is_inner_model=False):
method reset (line 158) | def reset(self):
FILE: pymilo/transporters/tree_transporter.py
class TreeTransporter (line 11) | class TreeTransporter(AbstractTransporter):
method serialize (line 14) | def serialize(self, data, key, model_type):
method deserialize (line 50) | def deserialize(self, data, key, model_type):
FILE: pymilo/transporters/treepredictor_transporter.py
class TreePredictorTransporter (line 9) | class TreePredictorTransporter(AbstractTransporter):
method serialize (line 12) | def serialize(self, data, key, model_type):
method deserialize (line 34) | def deserialize(self, data, key, model_type):
method is_treepredictor (line 58) | def is_treepredictor(self, treepredictor):
method is_serialized_treepredictor (line 69) | def is_serialized_treepredictor(self, serialized_treepredictor):
method serialize_tree_predictor (line 82) | def serialize_tree_predictor(self, treepredictor):
method deserialize_tree_predictor (line 102) | def deserialize_tree_predictor(self, serialized_tree_predictor):
method serialize_possible_inner_tree_predictor (line 128) | def serialize_possible_inner_tree_predictor(self, _list):
method deserialize_possible_inner_tree_predictor (line 144) | def deserialize_possible_inner_tree_predictor(self, _list):
FILE: pymilo/utils/data_exporter.py
function _split_X_y (line 6) | def _split_X_y(X, y, threshold=20):
function prepare_simple_classification_datasets (line 23) | def prepare_simple_classification_datasets(threshold=50):
function prepare_simple_regression_datasets (line 35) | def prepare_simple_regression_datasets(threshold=20):
function prepare_simple_clustering_datasets (line 47) | def prepare_simple_clustering_datasets():
FILE: pymilo/utils/test_pymilo.py
function pymilo_export_path (line 17) | def pymilo_export_path(model):
function pymilo_test (line 29) | def pymilo_test(model, model_name):
function pymilo_regression_test (line 50) | def pymilo_regression_test(regressor, model_name, test_data):
function pymilo_classification_test (line 80) | def pymilo_classification_test(classifier, model_name, test_data):
function pymilo_clustering_test (line 110) | def pymilo_clustering_test(clusterer, model_name, x_test, support_predic...
function pymilo_nearest_neighbor_test (line 138) | def pymilo_nearest_neighbor_test(nearest_neighbor, model_name, test_data):
function report_status (line 157) | def report_status(result, model_name):
FILE: pymilo/utils/util.py
function get_sklearn_type (line 9) | def get_sklearn_type(model):
function is_primitive (line 21) | def is_primitive(obj):
function is_iterable (line 34) | def is_iterable(obj):
function check_str_in_iterable (line 49) | def check_str_in_iterable(field, content):
function get_homogeneous_type (line 65) | def get_homogeneous_type(seq):
function all_same (line 82) | def all_same(arr):
function import_function (line 94) | def import_function(module_name, function_name):
function has_named_parameter (line 110) | def has_named_parameter(func, param_name):
function prefix_list (line 126) | def prefix_list(list1, list2):
function download_model (line 142) | def download_model(url):
function get_sklearn_class (line 170) | def get_sklearn_class(model_name):
FILE: setup.py
function get_requires (line 14) | def get_requires(mode='core'):
function read_description (line 21) | def read_description():
FILE: tests/test_clusterings/affinity_propagation.py
function affinity_propagation (line 8) | def affinity_propagation():
FILE: tests/test_clusterings/birch.py
function birch (line 8) | def birch():
FILE: tests/test_clusterings/bisecting_kmeans.py
function bisecting_kmeans (line 8) | def bisecting_kmeans():
FILE: tests/test_clusterings/dbscan.py
function dbscan (line 8) | def dbscan():
FILE: tests/test_clusterings/gaussian_mixture/bayesian_gaussian_mixture.py
function bayesian_gaussian_mixture (line 8) | def bayesian_gaussian_mixture():
FILE: tests/test_clusterings/gaussian_mixture/gaussian_mixture.py
function gaussian_mixture (line 8) | def gaussian_mixture():
FILE: tests/test_clusterings/hdbscan.py
function hdbscan (line 8) | def hdbscan():
FILE: tests/test_clusterings/hierarchical_clustering/agglomerative_clustering.py
function agglomerative_clustering (line 8) | def agglomerative_clustering():
FILE: tests/test_clusterings/hierarchical_clustering/feature_agglomeration.py
function feature_agglomeration (line 8) | def feature_agglomeration():
FILE: tests/test_clusterings/kmeans.py
function kmeans (line 8) | def kmeans():
FILE: tests/test_clusterings/mean_shift.py
function mean_shift (line 8) | def mean_shift():
FILE: tests/test_clusterings/minibatch_kmeans.py
function minibatch_kmeans (line 8) | def minibatch_kmeans():
FILE: tests/test_clusterings/optics.py
function optics (line 8) | def optics():
FILE: tests/test_clusterings/spectral_clustering/spectral_biclustering.py
function spectral_biclustering (line 8) | def spectral_biclustering():
FILE: tests/test_clusterings/spectral_clustering/spectral_clustering.py
function spectral_clustering (line 8) | def spectral_clustering():
FILE: tests/test_clusterings/spectral_clustering/spectral_coclustering.py
function spectral_coclustering (line 8) | def spectral_coclustering():
FILE: tests/test_clusterings/test_clusterings.py
function reset_exported_models_directory (line 42) | def reset_exported_models_directory():
function test_full (line 54) | def test_full():
FILE: tests/test_composes/column_transformer.py
function column_transformer (line 11) | def column_transformer():
function complex_column_transformer (line 34) | def complex_column_transformer():
function nested_column_transformer_with_pipeline (line 57) | def nested_column_transformer_with_pipeline():
FILE: tests/test_composes/test_compose_models.py
function reset_exported_models_directory (line 22) | def reset_exported_models_directory():
function test_full (line 34) | def test_full():
FILE: tests/test_composes/transformed_target_regressor.py
function transformed_target_regressor (line 12) | def transformed_target_regressor():
function complex_transformed_target_regressor (line 24) | def complex_transformed_target_regressor():
FILE: tests/test_composes/util.py
function write_and_read (line 4) | def write_and_read(serialized_model, file_addr):
function get_path (line 10) | def get_path(model_name, index=None):
FILE: tests/test_cross_decomposition/cca.py
function cca (line 7) | def cca():
FILE: tests/test_cross_decomposition/pls_canonical.py
function pls_canonical (line 7) | def pls_canonical():
FILE: tests/test_cross_decomposition/pls_regression.py
function pls_regressor (line 7) | def pls_regressor():
FILE: tests/test_cross_decomposition/test_cross_decompositions.py
function reset_exported_models_directory (line 15) | def reset_exported_models_directory():
function test_full (line 27) | def test_full():
FILE: tests/test_decision_trees/decision_tree/decision_tree_classification.py
function decision_tree_classification (line 8) | def decision_tree_classification():
FILE: tests/test_decision_trees/decision_tree/decision_tree_regression.py
function decision_tree_regression (line 8) | def decision_tree_regression():
FILE: tests/test_decision_trees/extra_tree/extra_tree_classification.py
function extra_tree_classification (line 8) | def extra_tree_classification():
FILE: tests/test_decision_trees/extra_tree/extra_tree_regression.py
function extra_tree_regression (line 8) | def extra_tree_regression():
FILE: tests/test_decision_trees/test_decision_trees.py
function reset_exported_models_directory (line 15) | def reset_exported_models_directory():
function test_full (line 27) | def test_full():
FILE: tests/test_ensembles/adaboost/adaboost_classifier.py
function adaboost_classifier (line 7) | def adaboost_classifier():
FILE: tests/test_ensembles/adaboost/adaboost_regressor.py
function adaboost_regressor (line 7) | def adaboost_regressor():
FILE: tests/test_ensembles/bagging/bagging_classifier.py
function bagging_classifier (line 9) | def bagging_classifier():
FILE: tests/test_ensembles/bagging/bagging_regressor.py
function bagging_regressor (line 9) | def bagging_regressor():
FILE: tests/test_ensembles/extra_trees/extra_trees_classifier.py
function extra_trees_classifier (line 7) | def extra_trees_classifier():
FILE: tests/test_ensembles/extra_trees/extra_trees_regressor.py
function extra_trees_regressor (line 7) | def extra_trees_regressor():
FILE: tests/test_ensembles/gradient_booster/gradient_booster_classifier.py
function gradient_booster_classifier (line 7) | def gradient_booster_classifier():
FILE: tests/test_ensembles/gradient_booster/gradient_booster_regressor.py
function gradient_booster_regressor (line 7) | def gradient_booster_regressor():
FILE: tests/test_ensembles/hist_gradient_boosting/hist_gradient_boosting_classifier.py
function hist_gradient_boosting_classifier (line 7) | def hist_gradient_boosting_classifier():
FILE: tests/test_ensembles/hist_gradient_boosting/hist_gradient_boosting_regressor.py
function hist_gradient_boosting_regressor (line 7) | def hist_gradient_boosting_regressor():
FILE: tests/test_ensembles/isolation_forest.py
function isolation_forest (line 7) | def isolation_forest():
FILE: tests/test_ensembles/pipeline.py
function pipeline (line 9) | def pipeline():
FILE: tests/test_ensembles/random_forests/random_forest_classifier.py
function random_forest_classifier (line 7) | def random_forest_classifier():
FILE: tests/test_ensembles/random_forests/random_forest_regressor.py
function random_forest_regressor (line 7) | def random_forest_regressor():
FILE: tests/test_ensembles/random_trees_embedding.py
function random_trees_embedding (line 7) | def random_trees_embedding():
FILE: tests/test_ensembles/stacking/stacking_classifier.py
function stacking_classifier (line 11) | def stacking_classifier():
FILE: tests/test_ensembles/stacking/stacking_regressor.py
function stacking_regressor (line 10) | def stacking_regressor():
FILE: tests/test_ensembles/test_ensembles.py
function reset_exported_models_directory (line 52) | def reset_exported_models_directory():
function test_full (line 64) | def test_full():
FILE: tests/test_ensembles/voting/voting_classifier.py
function voting_classifier (line 10) | def voting_classifier():
FILE: tests/test_ensembles/voting/voting_regressor.py
function voting_regressor (line 10) | def voting_regressor():
FILE: tests/test_exceptions/custom_models.py
class CustomizedTweedieDistribution (line 6) | class CustomizedTweedieDistribution():
method __init__ (line 8) | def __init__(self, power=0):
method power (line 12) | def power(self):
method power (line 16) | def power(self, power):
method unit_variance (line 20) | def unit_variance(self, y_pred):
method unit_deviance (line 23) | def unit_deviance(self, y, y_pred, check_input=False):
FILE: tests/test_exceptions/export_exceptions.py
class InvalidModel (line 16) | class InvalidModel:
method __init__ (line 17) | def __init__(self):
method fit (line 20) | def fit(self, x, y):
method predict (line 23) | def predict(self, x):
function invalid_model (line 26) | def invalid_model(print_output = True):
function valid_model_invalid_structure_linear_model (line 40) | def valid_model_invalid_structure_linear_model(print_output = True):
function valid_model_irrelevant_chain (line 56) | def valid_model_irrelevant_chain(print_output = True):
function valid_model_invalid_structure_neural_network (line 69) | def valid_model_invalid_structure_neural_network(print_output = True):
FILE: tests/test_exceptions/import_exceptions.py
function invalid_json (line 8) | def invalid_json(print_output = True):
function invalid_url (line 20) | def invalid_url():
function valid_url_invalid_file (line 28) | def valid_url_invalid_file():
function valid_url_valid_file (line 36) | def valid_url_valid_file():
FILE: tests/test_exceptions/test_exceptions.py
function test_full (line 23) | def test_full():
FILE: tests/test_feature_extraction/count_vectorizer.py
function count_vectorizer (line 9) | def count_vectorizer():
FILE: tests/test_feature_extraction/dict_vectorizer.py
function dict_vectorizer (line 9) | def dict_vectorizer():
FILE: tests/test_feature_extraction/feature_hasher.py
function feature_hasher (line 9) | def feature_hasher():
FILE: tests/test_feature_extraction/hashing_vectorizer.py
function hashing_vectorizer (line 9) | def hashing_vectorizer():
FILE: tests/test_feature_extraction/patch_extractor.py
function patch_extractor (line 10) | def patch_extractor():
FILE: tests/test_feature_extraction/pipeline.py
function pipeline (line 11) | def pipeline():
FILE: tests/test_feature_extraction/test_feature_extractions.py
function reset_exported_models_directory (line 22) | def reset_exported_models_directory():
function test_full (line 33) | def test_full():
FILE: tests/test_feature_extraction/tfidf_transformer.py
function tfidf_transformer (line 11) | def tfidf_transformer():
FILE: tests/test_feature_extraction/tfidf_vectorizer.py
function tfidf_vectorizer (line 9) | def tfidf_vectorizer():
FILE: tests/test_feature_extraction/util.py
function write_and_read (line 4) | def write_and_read(serialized_model, file_addr):
function get_path (line 10) | def get_path(model_name):
FILE: tests/test_linear_models/bayesian/ard_regression.py
function ard_regression (line 8) | def ard_regression():
FILE: tests/test_linear_models/bayesian/bayesian_regression.py
function bayesian_regression (line 8) | def bayesian_regression():
FILE: tests/test_linear_models/elasticnet/elastic_net.py
function elastic_net (line 8) | def elastic_net():
FILE: tests/test_linear_models/elasticnet/elastic_net_cv.py
function elastic_net_cv (line 8) | def elastic_net_cv():
FILE: tests/test_linear_models/elasticnet/multi_task_elastic_net.py
function multi_task_elastic_net (line 8) | def multi_task_elastic_net():
FILE: tests/test_linear_models/elasticnet/multi_task_elastic_net_cv.py
function multi_task_elastic_net_cv (line 8) | def multi_task_elastic_net_cv():
FILE: tests/test_linear_models/glm/gamma_regression.py
function gamma_regression (line 8) | def gamma_regression():
FILE: tests/test_linear_models/glm/poisson_regression.py
function poisson_regression (line 8) | def poisson_regression():
FILE: tests/test_linear_models/glm/tweedie_regression.py
function tweedie_regression (line 8) | def tweedie_regression():
FILE: tests/test_linear_models/lasso_lars/lasso.py
function lasso (line 8) | def lasso():
FILE: tests/test_linear_models/lasso_lars/lasso_cv.py
function lasso_cv (line 8) | def lasso_cv():
FILE: tests/test_linear_models/lasso_lars/lasso_lars.py
function lasso_lars (line 8) | def lasso_lars():
FILE: tests/test_linear_models/lasso_lars/lasso_lars_cv.py
function lasso_lars_cv (line 8) | def lasso_lars_cv():
FILE: tests/test_linear_models/lasso_lars/lasso_lars_ic.py
function lasso_lars_ic (line 8) | def lasso_lars_ic():
FILE: tests/test_linear_models/lasso_lars/multi_task_lasso.py
function multi_task_lasso (line 8) | def multi_task_lasso():
FILE: tests/test_linear_models/lasso_lars/multi_task_lasso_cv.py
function multi_task_lasso_cv (line 8) | def multi_task_lasso_cv():
FILE: tests/test_linear_models/linear_regression/linear_regression.py
function linear_regression (line 8) | def linear_regression():
FILE: tests/test_linear_models/logistic/logistic_regression.py
function logistic_regression (line 8) | def logistic_regression():
FILE: tests/test_linear_models/logistic/logistic_regression_cv.py
function logistic_regression_cv (line 8) | def logistic_regression_cv():
FILE: tests/test_linear_models/omp/omp.py
function omp (line 8) | def omp():
FILE: tests/test_linear_models/omp/omp_cv.py
function omp_cv (line 8) | def omp_cv():
FILE: tests/test_linear_models/passive_aggressive/passive_aggressive_classifier.py
function passive_aggressive_classifier (line 8) | def passive_aggressive_classifier():
FILE: tests/test_linear_models/passive_aggressive/passive_aggressive_regressor.py
function passive_agressive_regressor (line 8) | def passive_agressive_regressor():
FILE: tests/test_linear_models/perceptron/perception.py
function perceptron (line 8) | def perceptron():
FILE: tests/test_linear_models/quantile/quantile.py
function quantile_regressor (line 8) | def quantile_regressor():
FILE: tests/test_linear_models/ridge/ridge_classifier.py
function ridge_classifier (line 8) | def ridge_classifier():
FILE: tests/test_linear_models/ridge/ridge_classifier_cv.py
function ridge_classifier_cv (line 8) | def ridge_classifier_cv():
FILE: tests/test_linear_models/ridge/ridge_regression.py
function ridge_regression (line 7) | def ridge_regression():
FILE: tests/test_linear_models/ridge/ridge_regression_cv.py
function ridge_regression_cv (line 8) | def ridge_regression_cv():
FILE: tests/test_linear_models/robustness/huber_regression.py
function huber_regression (line 8) | def huber_regression():
FILE: tests/test_linear_models/robustness/ransac_regression.py
function ransac_regression (line 8) | def ransac_regression():
FILE: tests/test_linear_models/robustness/theil_sen_regression.py
function theil_sen_regression (line 8) | def theil_sen_regression():
FILE: tests/test_linear_models/sgd/sgd_classifier.py
function sgd_classifier (line 7) | def sgd_classifier():
FILE: tests/test_linear_models/sgd/sgd_oneclass_svm.py
function sgd_oneclass_svm (line 8) | def sgd_oneclass_svm():
FILE: tests/test_linear_models/sgd/sgd_regression.py
function sgd_regression (line 8) | def sgd_regression():
FILE: tests/test_linear_models/test_linear_models.py
function reset_exported_models_directory (line 107) | def reset_exported_models_directory():
function test_full (line 119) | def test_full():
FILE: tests/test_misc_functionalities.py/test_batch.py
function test_batch_execution (line 11) | def test_batch_execution():
FILE: tests/test_ml_streaming/run_server.py
function main (line 7) | def main():
FILE: tests/test_ml_streaming/scenarios/scenario1.py
function scenario1 (line 8) | def scenario1(compression_method, communication_protocol):
FILE: tests/test_ml_streaming/scenarios/scenario2.py
function scenario2 (line 8) | def scenario2(compression_method, communication_protocol):
FILE: tests/test_ml_streaming/scenarios/scenario3.py
function scenario3 (line 7) | def scenario3(compression_method, communication_protocol):
FILE: tests/test_ml_streaming/scenarios/scenario4.py
function scenario4 (line 6) | def scenario4(compression_method, communication_protocol):
FILE: tests/test_ml_streaming/test_streaming.py
function prepare_bare_server (line 16) | def prepare_bare_server(request):
function prepare_ml_server (line 51) | def prepare_ml_server(request):
function prepare_access_control_server (line 89) | def prepare_access_control_server(request):
function test1 (line 113) | def test1(prepare_bare_server):
function test2 (line 118) | def test2(prepare_bare_server):
function test3 (line 123) | def test3(prepare_ml_server):
function test4 (line 128) | def test4(prepare_access_control_server):
function test_dockerfile (line 133) | def test_dockerfile():
FILE: tests/test_naive_bayes/bernoulli.py
function bernoulli_naive_bayes (line 8) | def bernoulli_naive_bayes():
FILE: tests/test_naive_bayes/categorical.py
function categorical_naive_bayes (line 8) | def categorical_naive_bayes():
FILE: tests/test_naive_bayes/complement.py
function complement_naive_bayes (line 8) | def complement_naive_bayes():
FILE: tests/test_naive_bayes/gaussian.py
function gaussian_naive_bayes (line 8) | def gaussian_naive_bayes():
FILE: tests/test_naive_bayes/multinomial.py
function multinomial_naive_bayes (line 8) | def multinomial_naive_bayes():
FILE: tests/test_naive_bayes/test_naive_bayes_models.py
function reset_exported_models_directory (line 19) | def reset_exported_models_directory():
function test_full (line 31) | def test_full():
FILE: tests/test_neighbors/kneighbors_classifier.py
function kneighbors_classifier (line 8) | def kneighbors_classifier():
FILE: tests/test_neighbors/kneighbors_regressor.py
function kneighbors_regressor (line 8) | def kneighbors_regressor():
FILE: tests/test_neighbors/local_outlier_factor.py
function local_outlier_factor (line 8) | def local_outlier_factor():
FILE: tests/test_neighbors/nearest_centroid.py
function nearest_centroid (line 8) | def nearest_centroid():
FILE: tests/test_neighbors/nearest_neighbor.py
function nearest_neighbor (line 8) | def nearest_neighbor():
FILE: tests/test_neighbors/radius_neighbors_classifier.py
function radius_neighbors_classifier (line 8) | def radius_neighbors_classifier():
FILE: tests/test_neighbors/radius_neighbors_regressor.py
function radius_neighbors_regressor (line 8) | def radius_neighbors_regressor():
FILE: tests/test_neighbors/test_neighbors.py
function reset_exported_models_directory (line 20) | def reset_exported_models_directory():
function test_full (line 32) | def test_full():
FILE: tests/test_neural_networks/bernoulli_rbm/bernoulli_rbm.py
function bernoulli_rbm (line 16) | def bernoulli_rbm():
FILE: tests/test_neural_networks/mlp/mlp_classification.py
function multi_layer_perceptron_classification (line 8) | def multi_layer_perceptron_classification():
FILE: tests/test_neural_networks/mlp/mlp_regression.py
function multi_layer_perceptron_regression (line 8) | def multi_layer_perceptron_regression():
FILE: tests/test_neural_networks/test_neural_networks.py
function reset_exported_models_directory (line 15) | def reset_exported_models_directory():
function test_full (line 27) | def test_full():
FILE: tests/test_preprocessings/binarizer.py
function binarizer (line 9) | def binarizer():
FILE: tests/test_preprocessings/function_transformer.py
function function_transformer (line 9) | def function_transformer():
FILE: tests/test_preprocessings/kbins_discretizer.py
function kbins_discretizer (line 9) | def kbins_discretizer():
FILE: tests/test_preprocessings/kernel_centerer.py
function kernel_centerer (line 10) | def kernel_centerer():
FILE: tests/test_preprocessings/label_binarizer.py
function label_binarizer (line 9) | def label_binarizer():
FILE: tests/test_preprocessings/label_encoder.py
function label_encoder (line 9) | def label_encoder():
FILE: tests/test_preprocessings/max_abs_scaler.py
function max_abs_scaler (line 9) | def max_abs_scaler():
FILE: tests/test_preprocessings/multilabel_binarizer.py
function multilabel_binarizer (line 9) | def multilabel_binarizer():
FILE: tests/test_preprocessings/normalizer.py
function normalizer (line 9) | def normalizer():
FILE: tests/test_preprocessings/one_hot_encoder.py
function one_hot_encoder (line 9) | def one_hot_encoder():
FILE: tests/test_preprocessings/ordinal_encoder.py
function ordinal_encoder (line 9) | def ordinal_encoder():
FILE: tests/test_preprocessings/polynomial_features.py
function polynomial_features (line 9) | def polynomial_features():
FILE: tests/test_preprocessings/power_transformer.py
function power_transformer (line 9) | def power_transformer():
FILE: tests/test_preprocessings/quantile_transformer.py
function quantile_transformer (line 9) | def quantile_transformer():
FILE: tests/test_preprocessings/robust_scaler.py
function robust_scaler (line 9) | def robust_scaler():
FILE: tests/test_preprocessings/spline_transformer.py
function spline_transformer (line 9) | def spline_transformer():
FILE: tests/test_preprocessings/standard_scaler.py
function standard_scaler (line 9) | def standard_scaler():
FILE: tests/test_preprocessings/target_encoder.py
function target_encoder (line 9) | def target_encoder():
FILE: tests/test_preprocessings/test_preprocessings.py
function reset_exported_models_directory (line 48) | def reset_exported_models_directory():
function test_full (line 60) | def test_full():
FILE: tests/test_preprocessings/util.py
function write_and_read (line 4) | def write_and_read(serialized_model, file_addr):
function get_path (line 10) | def get_path(model_name):
FILE: tests/test_svms/linear_svc.py
function linear_svc (line 8) | def linear_svc():
FILE: tests/test_svms/linear_svr.py
function linear_svr (line 8) | def linear_svr():
FILE: tests/test_svms/nu_svc.py
function nu_svc (line 8) | def nu_svc():
FILE: tests/test_svms/nu_svr.py
function nu_svr (line 8) | def nu_svr():
FILE: tests/test_svms/one_class_svm.py
function one_class_svm (line 8) | def one_class_svm():
FILE: tests/test_svms/svc.py
function svc (line 8) | def svc():
FILE: tests/test_svms/svr.py
function svr (line 8) | def svr():
FILE: tests/test_svms/test_svms.py
function reset_exported_models_directory (line 21) | def reset_exported_models_directory():
function test_full (line 33) | def test_full():
Condensed preview — 248 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (579K chars).
[
{
"path": ".coveragerc",
"chars": 148,
"preview": "[run]\nbranch = True\nomit =\n */pymilo/__main__.py\n[report]\n# Regexes for lines to exclude from consideration\nexclude_l"
},
{
"path": ".github/CODE_OF_CONDUCT.md",
"chars": 5472,
"preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participa"
},
{
"path": ".github/CONTRIBUTING.md",
"chars": 546,
"preview": "# Contribution\t\t\t\n\nChanges and improvements are more than welcome! ❤️ Feel free to fork and open a pull request.\t\t\n\n\nPle"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.yml",
"chars": 2830,
"preview": "name: Bug Report\ndescription: File a bug report\ntitle: \"[Bug]: \"\nbody:\n - type: markdown\n attributes:\n value: |"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 287,
"preview": "blank_issues_enabled: false\ncontact_links:\n - name: Discord\n url: https://discord.com/invite/mtuMS8AjDS\n about: A"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.yml",
"chars": 966,
"preview": "name: Feature Request\ndescription: Suggest a feature for this project\ntitle: \"[Feature]: \"\nbody:\n - type: textarea\n "
},
{
"path": ".github/PULL_REQUEST_TEMPLATE.md",
"chars": 111,
"preview": "#### Reference Issues/PRs\n\n#### What does this implement/fix? Explain your changes.\n\n#### Any other comments?\n\n"
},
{
"path": ".github/dependabot.yml",
"chars": 198,
"preview": "version: 2\nupdates:\n- package-ecosystem: pip\n directory: \"/\"\n schedule:\n interval: weekly\n time: \"01:30\"\n open-"
},
{
"path": ".github/workflows/publish_conda.yml",
"chars": 465,
"preview": "name: publish_conda\n\npermissions: read-all\n\non:\n push:\n # Sequence of patterns matched against refs/tags\n tags:\n "
},
{
"path": ".github/workflows/publish_pypi.yml",
"chars": 1003,
"preview": "# This workflow will upload a Python Package using Twine when a release is created\n# For more information see: https://h"
},
{
"path": ".github/workflows/test.yml",
"chars": 2546,
"preview": "# This workflow will install Python dependencies, run tests and lint with a variety of Python versions\n# For more inform"
},
{
"path": ".gitignore",
"chars": 1271,
"preview": "# Created by .ignore support plugin (hsz.mobi)\n### Python template\n# Byte-compiled / optimized / DLL files\n__pycache__/\n"
},
{
"path": ".pydocstyle",
"chars": 62,
"preview": "[pydocstyle]\nmatch_dir = ^(?!(tests|build)).*\nmatch = .*\\.py\n\n"
},
{
"path": "AUTHORS.md",
"chars": 515,
"preview": "# Core Developers\n----------\n- AmirHosein Rostami - Open Science Laboratory ([Github](https://github.com/AHReccese)) **"
},
{
"path": "CHANGELOG.md",
"chars": 22900,
"preview": "# Changelog\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changel"
},
{
"path": "CITATION.cff",
"chars": 2725,
"preview": "cff-version: \"1.2.0\"\nmessage: If you use this software, please cite our article in the\n Journal of Open Source Software"
},
{
"path": "LICENSE",
"chars": 1067,
"preview": "MIT License\n\nCopyright (c) 2022 OpenSciLab\n\nPermission is hereby granted, free of charge, to any person obtaining a copy"
},
{
"path": "README.md",
"chars": 17714,
"preview": "<div align=\"center\">\n <img src=\"https://github.com/openscilab/pymilo/raw/main/otherfiles/logo.png\" width=\"500\" height"
},
{
"path": "SECURITY.md",
"chars": 506,
"preview": "# Security policy\n\n## Supported versions\n\n| Version | Supported |\n| ------------- | ------------------ |\n"
},
{
"path": "SUPPORTED_MODELS.md",
"chars": 16579,
"preview": "# Supported Models\n\n**Last Update: 2025-12-30**\n\n\n<h2 id=\"scikit-learn\">Scikit-Learn</h2> \n<h3 id=\"scikit-learn-linear\">"
},
{
"path": "autopep8.bat",
"chars": 412,
"preview": "python -m autopep8 pymilo --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-length 120 --ve"
},
{
"path": "autopep8.sh",
"chars": 422,
"preview": "#!/bin/sh\npython -m autopep8 pymilo --recursive --aggressive --aggressive --in-place --pep8-passes 2000 --max-line-lengt"
},
{
"path": "codecov.yml",
"chars": 199,
"preview": "codecov:\n require_ci_to_pass: yes\n\ncoverage:\n precision: 2\n round: up\n range: \"70...100\"\n status:\n patch:\n "
},
{
"path": "dev-requirements.txt",
"chars": 242,
"preview": "numpy==2.2.4\nscikit-learn==1.6.1\nscipy>=0.19.1\nuvicorn==0.39.0\nfastapi==0.128.8\nrequests==2.32.5\nwebsockets==15.0.1\npyda"
},
{
"path": "otherfiles/RELEASE.md",
"chars": 1363,
"preview": "# PyMilo Release Instructions\n\n#### Last Update: 2024-04-24\n\n1. Create the `release` branch under `dev`\n2. Update all ve"
},
{
"path": "otherfiles/meta.yaml",
"chars": 1675,
"preview": "{% set name = \"pymilo\" %}\n{% set version = \"1.6\" %}\n\npackage:\n name: {{ name|lower }}\n version: {{ version }}\nsour"
},
{
"path": "otherfiles/requirements-splitter.py",
"chars": 260,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"Requirements splitter.\"\"\"\n\ntest_req = \"\"\n\nwith open('dev-requirements.txt', 'r') as f:\n fo"
},
{
"path": "otherfiles/version_check.py",
"chars": 2099,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"Version-check script.\"\"\"\nimport os\nimport sys\nimport codecs\nFailed = 0\nPYMILO_VERSION = \"1.6\""
},
{
"path": "paper/.gitignore",
"chars": 5,
"preview": "/refs"
},
{
"path": "paper/PyMilo.bib",
"chars": 398,
"preview": "@article{Rostami2025,\n doi = {10.21105/joss.08858},\n url = {https://doi.org/10.21105/joss.08858},\n year = {2025},\n p"
},
{
"path": "paper/paper.bib",
"chars": 6101,
"preview": "@article{Raschka2020,\n author = {Sebastian Raschka and Joshua Patterson and Corey Nolet},\n title = {Machine Lea"
},
{
"path": "paper/paper.md",
"chars": 9895,
"preview": "---\ntitle: 'PyMilo: A Python Library for ML I/O'\ntags:\n - Machine Learning\n - Model Deployment\n - Model Serialization"
},
{
"path": "pymilo/__init__.py",
"chars": 258,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo modules.\"\"\"\nfrom .pymilo_param import PYMILO_VERSION\nfrom .pymilo_obj import Export, I"
},
{
"path": "pymilo/__main__.py",
"chars": 3568,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo main.\"\"\"\nimport re\nimport argparse\nfrom art import tprint\nfrom .pymilo_param import (\n"
},
{
"path": "pymilo/chains/__init__.py",
"chars": 45,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo chains.\"\"\"\n"
},
{
"path": "pymilo/chains/chain.py",
"chars": 8282,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Chain Module.\"\"\"\n\nfrom traceback import format_exc\nfrom abc import ABC, abstractmethod"
},
{
"path": "pymilo/chains/clustering_chain.py",
"chars": 1190,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo chain for Clustering models.\"\"\"\n\nfrom ..chains.chain import AbstractChain\nfrom ..pymil"
},
{
"path": "pymilo/chains/compose_chain.py",
"chars": 2491,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo chain for compose models.\"\"\"\n\nfrom ..chains.chain import AbstractChain\nfrom ..transpor"
},
{
"path": "pymilo/chains/cross_decomposition_chain.py",
"chars": 590,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo chain for Cross Decomposition models.\"\"\"\n\nfrom ..chains.chain import AbstractChain\nfro"
},
{
"path": "pymilo/chains/decision_tree_chain.py",
"chars": 808,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo chain for Decision Trees models.\"\"\"\n\nfrom ..chains.chain import AbstractChain\nfrom ..p"
},
{
"path": "pymilo/chains/ensemble_chain.py",
"chars": 11444,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo chain for ensemble models.\"\"\"\n\nimport copy\nfrom ast import literal_eval\n\nfrom numpy im"
},
{
"path": "pymilo/chains/linear_model_chain.py",
"chars": 4180,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo chain for linear models.\"\"\"\n\nfrom .chain import AbstractChain\nfrom ..transporters.base"
},
{
"path": "pymilo/chains/naive_bayes_chain.py",
"chars": 558,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo chain for Naive Bayes models.\"\"\"\n\nfrom ..chains.chain import AbstractChain\nfrom ..pymi"
},
{
"path": "pymilo/chains/neighbours_chain.py",
"chars": 693,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo chain for Neighbors models.\"\"\"\n\nfrom ..chains.chain import AbstractChain\nfrom ..pymilo"
},
{
"path": "pymilo/chains/neural_network_chain.py",
"chars": 973,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo chain for Neural Network models.\"\"\"\n\nfrom ..chains.chain import AbstractChain\nfrom ..p"
},
{
"path": "pymilo/chains/svm_chain.py",
"chars": 660,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo chain for SVM models.\"\"\"\n\nfrom ..chains.chain import AbstractChain\nfrom ..pymilo_param"
},
{
"path": "pymilo/chains/util.py",
"chars": 4709,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"useful utilities for chains.\"\"\"\n\nfrom .linear_model_chain import linear_chain\nfrom .neural_ne"
},
{
"path": "pymilo/exceptions/__init__.py",
"chars": 223,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo exceptions.\"\"\"\nfrom .pymilo_exception import PymiloException\nfrom .serialize_exception"
},
{
"path": "pymilo/exceptions/deserialize_exception.py",
"chars": 2816,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Deserialization Exception.\"\"\"\nfrom enum import Enum\nfrom .pymilo_exception import Pymi"
},
{
"path": "pymilo/exceptions/pymilo_exception.py",
"chars": 3908,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Abstract Exception Class.\"\"\"\n\nimport pymilo\nimport sklearn\nimport platform\nfrom dateti"
},
{
"path": "pymilo/exceptions/serialize_exception.py",
"chars": 2156,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Serialization Exception.\"\"\"\n\nfrom enum import Enum\nfrom .pymilo_exception import Pymil"
},
{
"path": "pymilo/pymilo_func.py",
"chars": 2474,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"Functions.\"\"\"\nimport numpy as np\nimport sklearn\n\nfrom .chains.util import get_transporter\nfro"
},
{
"path": "pymilo/pymilo_obj.py",
"chars": 9562,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo modules.\"\"\"\nimport os\nimport re\nimport json\nfrom copy import deepcopy\nfrom warnings im"
},
{
"path": "pymilo/pymilo_param.py",
"chars": 12971,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"Parameters and constants.\"\"\"\nimport numpy as np\nimport sklearn.linear_model as linear_model\ni"
},
{
"path": "pymilo/streaming/__init__.py",
"chars": 215,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo ML Streaming.\"\"\"\nfrom .pymilo_client import PymiloClient\nfrom .pymilo_server import Py"
},
{
"path": "pymilo/streaming/communicator.py",
"chars": 38515,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Communication Mediums.\"\"\"\nfrom __future__ import annotations\n\nimport uuid\nimport json\n"
},
{
"path": "pymilo/streaming/compressor.py",
"chars": 3508,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"Implementations of Compressor interface.\"\"\"\nimport gzip\nimport zlib\nimport lzma\nimport bz2\nim"
},
{
"path": "pymilo/streaming/encryptor.py",
"chars": 542,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"Implementations of Encryptor interface.\"\"\"\nfrom .interfaces import Encryptor\n\n\nclass DummyEnc"
},
{
"path": "pymilo/streaming/interfaces.py",
"chars": 6020,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo ML Streaming Interfaces.\"\"\"\nfrom abc import ABC, abstractmethod\n\n\nclass Compressor(ABC"
},
{
"path": "pymilo/streaming/param.py",
"chars": 1723,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"Streaming Parameters and constants.\"\"\"\nPYMILO_CLIENT_INVALID_MODE = \"Invalid mode, the given "
},
{
"path": "pymilo/streaming/pymilo_client.py",
"chars": 8834,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMiloClient for RESTFull Protocol.\"\"\"\nfrom enum import Enum\nfrom .encryptor import DummyEncr"
},
{
"path": "pymilo/streaming/pymilo_server.py",
"chars": 14162,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMiloServer for RESTFull protocol.\"\"\"\nfrom ..pymilo_obj import Export, Import\nfrom .compress"
},
{
"path": "pymilo/streaming/util.py",
"chars": 3489,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"ML Streaming utility module.\"\"\"\nimport os\nimport re\nfrom ..pymilo_param import URL_REGEX\n\n\nde"
},
{
"path": "pymilo/transporters/__init__.py",
"chars": 51,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo transporters.\"\"\"\n"
},
{
"path": "pymilo/transporters/adamoptimizer_transporter.py",
"chars": 3050,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Adam optimizer object transporter.\"\"\"\nfrom .transporter import AbstractTransporter\nfro"
},
{
"path": "pymilo/transporters/baseloss_transporter.py",
"chars": 12752,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Base loss transporter.\"\"\"\n\n# Handle python 3.5 issues.\nfrom .transporter import Abstra"
},
{
"path": "pymilo/transporters/binmapper_transporter.py",
"chars": 3413,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo BinMapper transporter.\"\"\"\nfrom sklearn.ensemble._hist_gradient_boosting.binning import"
},
{
"path": "pymilo/transporters/bisecting_tree_transporter.py",
"chars": 5098,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo BisectingTree(sklearn.cluster._bisect_k_means) object transporter.\"\"\"\n\nfrom ..pymilo_p"
},
{
"path": "pymilo/transporters/bunch_transporter.py",
"chars": 2395,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Bunch transporter.\"\"\"\nfrom .transporter import AbstractTransporter\nfrom ..utils.util i"
},
{
"path": "pymilo/transporters/cfnode_transporter.py",
"chars": 9772,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo CFnode(from sklearn.cluster._birch) object transporter.\"\"\"\nfrom sklearn.cluster._birch"
},
{
"path": "pymilo/transporters/compose_transporter.py",
"chars": 7980,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Compose transporter.\"\"\"\n\nfrom ..utils.util import check_str_in_iterable\nfrom .transpor"
},
{
"path": "pymilo/transporters/feature_extraction_transporter.py",
"chars": 6010,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Feature Extraction transporter.\"\"\"\nfrom scipy.sparse import csr_matrix\n\nfrom ..pymilo_"
},
{
"path": "pymilo/transporters/function_transporter.py",
"chars": 3156,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Function transporter.\"\"\"\n\nfrom ..utils.util import import_function, check_str_in_itera"
},
{
"path": "pymilo/transporters/general_data_structure_transporter.py",
"chars": 21924,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo GeneralDataStructure transporter.\"\"\"\nimport numpy as np\nfrom ast import literal_eval\n\n"
},
{
"path": "pymilo/transporters/generator_transporter.py",
"chars": 2846,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Generator transporter.\"\"\"\nfrom numpy.random._generator import Generator\nfrom ..utils.u"
},
{
"path": "pymilo/transporters/lossfunction_transporter.py",
"chars": 11240,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Loss function transporter.\"\"\"\nfrom .transporter import AbstractTransporter\nfrom ..util"
},
{
"path": "pymilo/transporters/neighbors_tree_transporter.py",
"chars": 2620,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Tree(from sklearn.tree._tree) object transporter.\"\"\"\nfrom sklearn.neighbors._kd_tree i"
},
{
"path": "pymilo/transporters/preprocessing_transporter.py",
"chars": 8030,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Preprocessing transporter.\"\"\"\nfrom ..pymilo_param import SKLEARN_PREPROCESSING_TABLE\nf"
},
{
"path": "pymilo/transporters/randomstate_transporter.py",
"chars": 3073,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo RandomState(MT19937) object transporter.\"\"\"\nimport numpy as np\nfrom .transporter impor"
},
{
"path": "pymilo/transporters/sgdoptimizer_transporter.py",
"chars": 3053,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo SGDOptimizer object transporter.\"\"\"\nfrom .transporter import AbstractTransporter\nfrom "
},
{
"path": "pymilo/transporters/transporter.py",
"chars": 6633,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Transporter.\"\"\"\nfrom ..utils.util import get_sklearn_type\nfrom abc import ABC, abstrac"
},
{
"path": "pymilo/transporters/tree_transporter.py",
"chars": 4664,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo Tree(from sklearn.tree._tree) object transporter.\"\"\"\nimport numpy as np\nfrom sklearn.t"
},
{
"path": "pymilo/transporters/treepredictor_transporter.py",
"chars": 6741,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo TreePredictor transporter.\"\"\"\nfrom sklearn.ensemble._hist_gradient_boosting.predictor "
},
{
"path": "pymilo/utils/__init__.py",
"chars": 44,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"PyMilo utils.\"\"\"\n"
},
{
"path": "pymilo/utils/data_exporter.py",
"chars": 1673,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"data exporter modules.\"\"\"\nfrom sklearn import datasets\n\n\ndef _split_X_y(X, y, threshold=20):\n"
},
{
"path": "pymilo/utils/test_pymilo.py",
"chars": 6269,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"pymilo test modules.\"\"\"\nimport os\nimport copy\nfrom numpy import array_equal\n\nfrom ..pymilo_ob"
},
{
"path": "pymilo/utils/util.py",
"chars": 4552,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"utility module.\"\"\"\nimport requests\nimport importlib\nfrom inspect import signature\nfrom ..pymi"
},
{
"path": "requirements.txt",
"chars": 73,
"preview": "art>=1.8\nnumpy>=1.9.0\nrequests>=2.0.0\nscikit-learn>=0.22.2\nscipy>=0.19.1\n"
},
{
"path": "setup.py",
"chars": 2998,
"preview": "# -*- coding: utf-8 -*-\n\"\"\"Setup module.\"\"\"\ntry:\n from setuptools import setup, find_packages\nexcept ImportError:\n "
},
{
"path": "streaming-requirements.txt",
"chars": 64,
"preview": "uvicorn>=0.14.0\nfastapi>=0.68.0\npydantic>=1.5.0\nwebsockets>=9.0\n"
},
{
"path": "tests/test_clusterings/affinity_propagation.py",
"chars": 434,
"preview": "from sklearn.cluster import AffinityPropagation\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom pymilo"
},
{
"path": "tests/test_clusterings/birch.py",
"chars": 335,
"preview": "from sklearn.cluster import Birch\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom pymilo.utils.data_ex"
},
{
"path": "tests/test_clusterings/bisecting_kmeans.py",
"chars": 430,
"preview": "from sklearn.cluster import BisectingKMeans\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom pymilo.uti"
},
{
"path": "tests/test_clusterings/dbscan.py",
"chars": 358,
"preview": "from sklearn.cluster import DBSCAN\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom pymilo.utils.data_e"
},
{
"path": "tests/test_clusterings/gaussian_mixture/bayesian_gaussian_mixture.py",
"chars": 485,
"preview": "from sklearn.mixture import BayesianGaussianMixture\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom py"
},
{
"path": "tests/test_clusterings/gaussian_mixture/gaussian_mixture.py",
"chars": 426,
"preview": "from sklearn.mixture import GaussianMixture\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom pymilo.uti"
},
{
"path": "tests/test_clusterings/hdbscan.py",
"chars": 363,
"preview": "from sklearn.cluster import HDBSCAN\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom pymilo.utils.data_"
},
{
"path": "tests/test_clusterings/hierarchical_clustering/agglomerative_clustering.py",
"chars": 444,
"preview": "from sklearn.cluster import AgglomerativeClustering\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom py"
},
{
"path": "tests/test_clusterings/hierarchical_clustering/feature_agglomeration.py",
"chars": 438,
"preview": "from sklearn.cluster import FeatureAgglomeration\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom pymil"
},
{
"path": "tests/test_clusterings/kmeans.py",
"chars": 366,
"preview": "from sklearn.cluster import KMeans\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom pymilo.utils.data_e"
},
{
"path": "tests/test_clusterings/mean_shift.py",
"chars": 371,
"preview": "from sklearn.cluster import MeanShift\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom pymilo.utils.dat"
},
{
"path": "tests/test_clusterings/minibatch_kmeans.py",
"chars": 457,
"preview": "from sklearn.cluster import MiniBatchKMeans\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom pymilo.uti"
},
{
"path": "tests/test_clusterings/optics.py",
"chars": 338,
"preview": "from sklearn.cluster import OPTICS\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom pymilo.utils.data_e"
},
{
"path": "tests/test_clusterings/spectral_clustering/spectral_biclustering.py",
"chars": 454,
"preview": "from sklearn.cluster import SpectralBiclustering\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom pymil"
},
{
"path": "tests/test_clusterings/spectral_clustering/spectral_clustering.py",
"chars": 428,
"preview": "from sklearn.cluster import SpectralClustering\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom pymilo."
},
{
"path": "tests/test_clusterings/spectral_clustering/spectral_coclustering.py",
"chars": 454,
"preview": "from sklearn.cluster import SpectralCoclustering\n\nfrom pymilo.utils.test_pymilo import pymilo_clustering_test\nfrom pymil"
},
{
"path": "tests/test_clusterings/test_clusterings.py",
"chars": 2641,
"preview": "import os\nimport pytest\n\nfrom pymilo.pymilo_param import SKLEARN_CLUSTERING_TABLE, NOT_SUPPORTED\n\nfrom birch import birc"
},
{
"path": "tests/test_composes/column_transformer.py",
"chars": 3259,
"preview": "from numpy import array, array_equal\nfrom sklearn.compose import ColumnTransformer\nfrom sklearn.preprocessing import Nor"
},
{
"path": "tests/test_composes/test_compose_models.py",
"chars": 1059,
"preview": "import os\nimport pytest\n\nfrom column_transformer import (\n column_transformer,\n complex_column_transformer,\n ne"
},
{
"path": "tests/test_composes/transformed_target_regressor.py",
"chars": 1494,
"preview": "import numpy as np\nfrom sklearn.pipeline import Pipeline\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.l"
},
{
"path": "tests/test_composes/util.py",
"chars": 418,
"preview": "import os\nimport json\n\ndef write_and_read(serialized_model, file_addr):\n with open(file_addr, 'w') as fp:\n fp."
},
{
"path": "tests/test_cross_decomposition/cca.py",
"chars": 400,
"preview": "from sklearn.cross_decomposition import CCA\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.util"
},
{
"path": "tests/test_cross_decomposition/pls_canonical.py",
"chars": 457,
"preview": "from sklearn.cross_decomposition import PLSCanonical\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom py"
},
{
"path": "tests/test_cross_decomposition/pls_regression.py",
"chars": 460,
"preview": "from sklearn.cross_decomposition import PLSRegression\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom p"
},
{
"path": "tests/test_cross_decomposition/test_cross_decompositions.py",
"chars": 926,
"preview": "import os\nimport pytest\n\nfrom pls_regression import pls_regressor\nfrom pls_canonical import pls_canonical\nfrom cca impor"
},
{
"path": "tests/test_decision_trees/decision_tree/decision_tree_classification.py",
"chars": 645,
"preview": "from sklearn.tree import DecisionTreeClassifier\n\nfrom pymilo.utils.test_pymilo import pymilo_classification_test\nfrom py"
},
{
"path": "tests/test_decision_trees/decision_tree/decision_tree_regression.py",
"chars": 618,
"preview": "from sklearn.tree import DecisionTreeRegressor\n\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo."
},
{
"path": "tests/test_decision_trees/extra_tree/extra_tree_classification.py",
"chars": 621,
"preview": "from sklearn.tree import ExtraTreeClassifier\n\nfrom pymilo.utils.test_pymilo import pymilo_classification_test\nfrom pymil"
},
{
"path": "tests/test_decision_trees/extra_tree/extra_tree_regression.py",
"chars": 594,
"preview": "from sklearn.tree import ExtraTreeRegressor\n\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.uti"
},
{
"path": "tests/test_decision_trees/test_decision_trees.py",
"chars": 1158,
"preview": "import os\nimport pytest\n\nfrom decision_tree.decision_tree_regression import decision_tree_regression\nfrom decision_tree."
},
{
"path": "tests/test_ensembles/adaboost/adaboost_classifier.py",
"chars": 516,
"preview": "from sklearn.ensemble import AdaBoostClassifier\nfrom pymilo.utils.test_pymilo import pymilo_classification_test\nfrom pym"
},
{
"path": "tests/test_ensembles/adaboost/adaboost_regressor.py",
"chars": 494,
"preview": "from sklearn.ensemble import AdaBoostRegressor\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.u"
},
{
"path": "tests/test_ensembles/bagging/bagging_classifier.py",
"chars": 780,
"preview": "from sklearn.ensemble import BaggingClassifier\nfrom sklearn.svm import SVC\nfrom pymilo.utils.test_pymilo import pymilo_c"
},
{
"path": "tests/test_ensembles/bagging/bagging_regressor.py",
"chars": 755,
"preview": "from sklearn.ensemble import BaggingRegressor\nfrom sklearn.svm import SVR\nfrom pymilo.utils.test_pymilo import pymilo_re"
},
{
"path": "tests/test_ensembles/extra_trees/extra_trees_classifier.py",
"chars": 531,
"preview": "from sklearn.ensemble import ExtraTreesClassifier\nfrom pymilo.utils.test_pymilo import pymilo_classification_test\nfrom p"
},
{
"path": "tests/test_ensembles/extra_trees/extra_trees_regressor.py",
"chars": 509,
"preview": "from sklearn.ensemble import ExtraTreesRegressor\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo"
},
{
"path": "tests/test_ensembles/gradient_booster/gradient_booster_classifier.py",
"chars": 596,
"preview": "from sklearn.ensemble import GradientBoostingClassifier\nfrom pymilo.utils.test_pymilo import pymilo_classification_test\n"
},
{
"path": "tests/test_ensembles/gradient_booster/gradient_booster_regressor.py",
"chars": 541,
"preview": "from sklearn.ensemble import GradientBoostingRegressor\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom "
},
{
"path": "tests/test_ensembles/hist_gradient_boosting/hist_gradient_boosting_classifier.py",
"chars": 562,
"preview": "from sklearn.ensemble import HistGradientBoostingClassifier\nfrom pymilo.utils.test_pymilo import pymilo_classification_t"
},
{
"path": "tests/test_ensembles/hist_gradient_boosting/hist_gradient_boosting_regressor.py",
"chars": 540,
"preview": "from sklearn.ensemble import HistGradientBoostingRegressor\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nf"
},
{
"path": "tests/test_ensembles/isolation_forest.py",
"chars": 464,
"preview": "from sklearn.ensemble import IsolationForest\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.uti"
},
{
"path": "tests/test_ensembles/pipeline.py",
"chars": 561,
"preview": "from sklearn.svm import SVC\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.pipeline import Pipeline\nfrom "
},
{
"path": "tests/test_ensembles/random_forests/random_forest_classifier.py",
"chars": 538,
"preview": "from sklearn.ensemble import RandomForestClassifier\nfrom pymilo.utils.test_pymilo import pymilo_classification_test\nfrom"
},
{
"path": "tests/test_ensembles/random_forests/random_forest_regressor.py",
"chars": 533,
"preview": "from sklearn.ensemble import RandomForestRegressor\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymi"
},
{
"path": "tests/test_ensembles/random_trees_embedding.py",
"chars": 476,
"preview": "from sklearn.ensemble import RandomTreesEmbedding\nfrom pymilo.utils.test_pymilo import pymilo_test\nfrom pymilo.utils.dat"
},
{
"path": "tests/test_ensembles/stacking/stacking_classifier.py",
"chars": 901,
"preview": "from sklearn.ensemble import StackingClassifier\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.pipelin"
},
{
"path": "tests/test_ensembles/stacking/stacking_regressor.py",
"chars": 787,
"preview": "from sklearn.ensemble import StackingRegressor\nfrom sklearn.linear_model import RidgeCV\nfrom sklearn.svm import LinearSV"
},
{
"path": "tests/test_ensembles/test_ensembles.py",
"chars": 3367,
"preview": "import os\nimport pytest\n\nfrom adaboost.adaboost_regressor import adaboost_regressor\nfrom adaboost.adaboost_classifier im"
},
{
"path": "tests/test_ensembles/voting/voting_classifier.py",
"chars": 799,
"preview": "from sklearn.linear_model import LogisticRegression\nfrom sklearn.naive_bayes import GaussianNB\nfrom sklearn.ensemble imp"
},
{
"path": "tests/test_ensembles/voting/voting_regressor.py",
"chars": 758,
"preview": "from sklearn.linear_model import LinearRegression\nfrom sklearn.ensemble import RandomForestRegressor\nfrom sklearn.ensemb"
},
{
"path": "tests/test_exceptions/custom_models.py",
"chars": 620,
"preview": "from collections import namedtuple\n\nimport numpy as np\n\nDistributionBoundary = namedtuple(\"DistributionBoundary\", (\"valu"
},
{
"path": "tests/test_exceptions/export_exceptions.py",
"chars": 3301,
"preview": "# INVALID_MODEL = 1 -> tested.\n# VALID_MODEL_INVALID_INTERNAL_STRUCTURE = 2 -> tested.\nfrom pymilo.utils.data_exporter i"
},
{
"path": "tests/test_exceptions/import_exceptions.py",
"chars": 1137,
"preview": "# CORRUPTED_JSON_FILE = 1 -> tested.\n# INVALID_MODEL = 2 -> tested.\n# VALID_MODEL_INVALID_INTERNAL_STRUCTURE = 3 -> test"
},
{
"path": "tests/test_exceptions/invalid_jsons/corrupted.json",
"chars": 5470,
"preview": "{\n \"data\": {\n \"n_iter\": 300,\n \"tol\": 0.001,\n \"alpha_1\": 1e-06,\n \"alpha_2\": 1e-06,\n "
},
{
"path": "tests/test_exceptions/invalid_jsons/unknown-model.json",
"chars": 5470,
"preview": "{\n \"data\": {\n \"n_iter\": 300,\n \"tol\": 0.001,\n \"alpha_1\": 1e-06,\n \"alpha_2\": 1e-06,\n "
},
{
"path": "tests/test_exceptions/test_exceptions.py",
"chars": 1084,
"preview": "from export_exceptions import invalid_model\nfrom export_exceptions import valid_model_invalid_structure_linear_model\nfro"
},
{
"path": "tests/test_exceptions/valid_jsons/linear_regression.json",
"chars": 1634,
"preview": "{\n \"data\": {\n \"fit_intercept\": true,\n \"copy_X\": true,\n \"n_jobs\": null,\n \"positive\": false"
},
{
"path": "tests/test_feature_extraction/count_vectorizer.py",
"chars": 1046,
"preview": "from numpy import array_equal\nfrom util import get_path, write_and_read\nfrom pymilo.utils.test_pymilo import report_stat"
},
{
"path": "tests/test_feature_extraction/dict_vectorizer.py",
"chars": 918,
"preview": "from numpy import array_equal\nfrom sklearn.feature_extraction import DictVectorizer\nfrom pymilo.transporters.feature_ext"
},
{
"path": "tests/test_feature_extraction/feature_hasher.py",
"chars": 870,
"preview": "from numpy import array_equal\nfrom sklearn.feature_extraction import FeatureHasher\nfrom pymilo.transporters.feature_extr"
},
{
"path": "tests/test_feature_extraction/hashing_vectorizer.py",
"chars": 1034,
"preview": "from numpy import array_equal\nfrom util import get_path, write_and_read\nfrom pymilo.utils.test_pymilo import report_stat"
},
{
"path": "tests/test_feature_extraction/patch_extractor.py",
"chars": 938,
"preview": "from numpy import array_equal, random\nfrom sklearn.datasets import load_sample_images\nfrom sklearn.feature_extraction im"
},
{
"path": "tests/test_feature_extraction/pipeline.py",
"chars": 1130,
"preview": "from sklearn.feature_extraction.text import TfidfTransformer\nfrom sklearn.feature_extraction.text import CountVectorizer"
},
{
"path": "tests/test_feature_extraction/test_feature_extractions.py",
"chars": 1324,
"preview": "import os\nimport pytest\nfrom count_vectorizer import count_vectorizer\nfrom dict_vectorizer import dict_vectorizer\nfrom f"
},
{
"path": "tests/test_feature_extraction/tfidf_transformer.py",
"chars": 1286,
"preview": "from numpy import array_equal\nfrom util import get_path, write_and_read\nfrom pymilo.utils.test_pymilo import report_stat"
},
{
"path": "tests/test_feature_extraction/tfidf_vectorizer.py",
"chars": 1022,
"preview": "from numpy import array_equal\nfrom util import get_path, write_and_read\nfrom pymilo.utils.test_pymilo import report_stat"
},
{
"path": "tests/test_feature_extraction/util.py",
"chars": 359,
"preview": "import os\nimport json\n\ndef write_and_read(serialized_model, file_addr):\n with open(file_addr, 'w') as fp:\n fp."
},
{
"path": "tests/test_linear_models/bayesian/ard_regression.py",
"chars": 598,
"preview": "from sklearn.linear_model import ARDRegression\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.u"
},
{
"path": "tests/test_linear_models/bayesian/bayesian_regression.py",
"chars": 628,
"preview": "from sklearn.linear_model import BayesianRidge\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.u"
},
{
"path": "tests/test_linear_models/elasticnet/elastic_net.py",
"chars": 732,
"preview": "from sklearn.linear_model import ElasticNet\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.util"
},
{
"path": "tests/test_linear_models/elasticnet/elastic_net_cv.py",
"chars": 823,
"preview": "from sklearn.linear_model import ElasticNetCV\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.ut"
},
{
"path": "tests/test_linear_models/elasticnet/multi_task_elastic_net.py",
"chars": 887,
"preview": "from sklearn.linear_model import MultiTaskElasticNet\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom py"
},
{
"path": "tests/test_linear_models/elasticnet/multi_task_elastic_net_cv.py",
"chars": 968,
"preview": "from sklearn.linear_model import MultiTaskElasticNetCV\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom "
},
{
"path": "tests/test_linear_models/glm/gamma_regression.py",
"chars": 621,
"preview": "from sklearn.linear_model import GammaRegressor\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo."
},
{
"path": "tests/test_linear_models/glm/poisson_regression.py",
"chars": 641,
"preview": "from sklearn.linear_model import PoissonRegressor\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymil"
},
{
"path": "tests/test_linear_models/glm/tweedie_regression.py",
"chars": 753,
"preview": "from sklearn.linear_model import TweedieRegressor\nfrom pymilo.utils.data_exporter import prepare_simple_regression_datas"
},
{
"path": "tests/test_linear_models/lasso_lars/lasso.py",
"chars": 586,
"preview": "from sklearn.linear_model import Lasso\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.utils.dat"
},
{
"path": "tests/test_linear_models/lasso_lars/lasso_cv.py",
"chars": 750,
"preview": "from sklearn.linear_model import LassoCV\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.utils.d"
},
{
"path": "tests/test_linear_models/lasso_lars/lasso_lars.py",
"chars": 624,
"preview": "from sklearn.linear_model import LassoLars\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.utils"
},
{
"path": "tests/test_linear_models/lasso_lars/lasso_lars_cv.py",
"chars": 641,
"preview": "from sklearn.linear_model import LassoLarsCV\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.uti"
},
{
"path": "tests/test_linear_models/lasso_lars/lasso_lars_ic.py",
"chars": 663,
"preview": "from sklearn.linear_model import LassoLarsIC\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.uti"
},
{
"path": "tests/test_linear_models/lasso_lars/multi_task_lasso.py",
"chars": 802,
"preview": "from sklearn.linear_model import MultiTaskLasso\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo."
},
{
"path": "tests/test_linear_models/lasso_lars/multi_task_lasso_cv.py",
"chars": 885,
"preview": "from sklearn.linear_model import MultiTaskLassoCV\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymil"
},
{
"path": "tests/test_linear_models/linear_regression/linear_regression.py",
"chars": 592,
"preview": "from sklearn.linear_model import LinearRegression\nfrom pymilo.utils.data_exporter import prepare_simple_regression_datas"
},
{
"path": "tests/test_linear_models/logistic/logistic_regression.py",
"chars": 719,
"preview": "from sklearn.linear_model import LogisticRegression\nfrom pymilo.utils.test_pymilo import pymilo_classification_test\nfrom"
},
{
"path": "tests/test_linear_models/logistic/logistic_regression_cv.py",
"chars": 807,
"preview": "from sklearn.linear_model import LogisticRegressionCV\nfrom pymilo.utils.test_pymilo import pymilo_classification_test\nfr"
},
{
"path": "tests/test_linear_models/omp/omp.py",
"chars": 702,
"preview": "from sklearn.linear_model import OrthogonalMatchingPursuit\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nf"
},
{
"path": "tests/test_linear_models/omp/omp_cv.py",
"chars": 675,
"preview": "from sklearn.linear_model import OrthogonalMatchingPursuitCV\nfrom pymilo.utils.test_pymilo import pymilo_regression_test"
},
{
"path": "tests/test_linear_models/passive_aggressive/passive_aggressive_classifier.py",
"chars": 831,
"preview": "from sklearn.linear_model import PassiveAggressiveClassifier\nfrom pymilo.utils.test_pymilo import pymilo_classification_"
},
{
"path": "tests/test_linear_models/passive_aggressive/passive_aggressive_regressor.py",
"chars": 790,
"preview": "from sklearn.linear_model import PassiveAggressiveRegressor\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\n"
},
{
"path": "tests/test_linear_models/perceptron/perception.py",
"chars": 681,
"preview": "from sklearn.linear_model import Perceptron\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.util"
},
{
"path": "tests/test_linear_models/quantile/quantile.py",
"chars": 632,
"preview": "from sklearn.linear_model import QuantileRegressor\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymi"
},
{
"path": "tests/test_linear_models/ridge/ridge_classifier.py",
"chars": 639,
"preview": "from sklearn.linear_model import RidgeClassifier\nfrom pymilo.utils.test_pymilo import pymilo_classification_test\nfrom py"
},
{
"path": "tests/test_linear_models/ridge/ridge_classifier_cv.py",
"chars": 679,
"preview": "from sklearn.linear_model import RidgeClassifierCV\nfrom pymilo.utils.test_pymilo import pymilo_classification_test\nfrom "
},
{
"path": "tests/test_linear_models/ridge/ridge_regression.py",
"chars": 602,
"preview": "from sklearn.linear_model import Ridge\nfrom pymilo.utils.data_exporter import prepare_simple_regression_datasets\nfrom py"
},
{
"path": "tests/test_linear_models/ridge/ridge_regression_cv.py",
"chars": 651,
"preview": "from sklearn.linear_model import RidgeCV\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo.utils.d"
},
{
"path": "tests/test_linear_models/robustness/huber_regression.py",
"chars": 590,
"preview": "from sklearn.linear_model import HuberRegressor\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo."
},
{
"path": "tests/test_linear_models/robustness/ransac_regression.py",
"chars": 649,
"preview": "from sklearn.linear_model import RANSACRegressor\nfrom pymilo.utils.test_pymilo import pymilo_regression_test\nfrom pymilo"
},
{
"path": "tests/test_linear_models/robustness/theil_sen_regression.py",
"chars": 668,
"preview": "from sklearn.linear_model import TheilSenRegressor\nfrom pymilo.utils.data_exporter import prepare_simple_regression_data"
},
{
"path": "tests/test_linear_models/sgd/sgd_classifier.py",
"chars": 672,
"preview": "from sklearn.linear_model import SGDClassifier\nfrom pymilo.utils.data_exporter import prepare_simple_classification_data"
},
{
"path": "tests/test_linear_models/sgd/sgd_oneclass_svm.py",
"chars": 638,
"preview": "from sklearn.linear_model import SGDOneClassSVM\nfrom pymilo.utils.data_exporter import prepare_simple_regression_dataset"
},
{
"path": "tests/test_linear_models/sgd/sgd_regression.py",
"chars": 645,
"preview": "from sklearn.linear_model import SGDRegressor\nfrom pymilo.utils.data_exporter import prepare_simple_regression_datasets\n"
},
{
"path": "tests/test_linear_models/test_linear_models.py",
"chars": 5066,
"preview": "import os\nimport pytest\n\nfrom pymilo.pymilo_param import SKLEARN_LINEAR_MODEL_TABLE, NOT_SUPPORTED\n\nfrom linear_regressi"
},
{
"path": "tests/test_misc_functionalities.py/test_batch.py",
"chars": 1091,
"preview": "import os\nimport re\nimport random\nimport numpy as np\nfrom pymilo import Export, Import\nfrom sklearn.metrics import mean_"
},
{
"path": "tests/test_ml_streaming/docker_files/Dockerfile1",
"chars": 424,
"preview": "# Use an official Python runtime as a parent image\nFROM python:3.11-slim\n\n# Set the working directory in the container\nW"
},
{
"path": "tests/test_ml_streaming/docker_files/Dockerfile2",
"chars": 370,
"preview": "# Use an official Python runtime as a parent image\nFROM python:3.11-slim\n\n# Set the working directory in the container\nW"
},
{
"path": "tests/test_ml_streaming/run_server.py",
"chars": 2299,
"preview": "import argparse\nfrom sklearn.linear_model import LinearRegression\nfrom pymilo.streaming import PymiloServer, Compression"
},
{
"path": "tests/test_ml_streaming/scenarios/scenario1.py",
"chars": 1424,
"preview": "import numpy as np\nfrom pymilo.streaming import PymiloClient, Compression, CommunicationProtocol\nfrom sklearn.metrics im"
},
{
"path": "tests/test_ml_streaming/scenarios/scenario2.py",
"chars": 1611,
"preview": "import numpy as np\nfrom pymilo.streaming import PymiloClient, Compression, CommunicationProtocol\nfrom sklearn.metrics im"
},
{
"path": "tests/test_ml_streaming/scenarios/scenario3.py",
"chars": 1231,
"preview": "import numpy as np\nfrom sklearn.metrics import mean_squared_error\nfrom pymilo.streaming import PymiloClient, Compression"
}
]
// ... and 48 more files (download for full content)
About this extraction
This page contains the full source code of the openscilab/pymilo GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 248 files (527.4 KB), approximately 134.1k tokens, and a symbol index with 533 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.