bitfount-0.5.9
توضیحات
Machine Learning and Federated Learning Library.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | bitfount-0.5.9 |
| نام | bitfount |
| نسخه کتابخانه | 0.5.9 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Bitfount |
| ایمیل نویسنده | info@bitfount.com |
| آدرس صفحه اصلی | https://github.com/bitfount/bitfount |
| آدرس اینترنتی | https://pypi.org/project/bitfount/ |
| مجوز | Apache License 2.0 |
<div align="center">
<img src="https://bitfount-web-resources.s3.eu-west-2.amazonaws.com/bitfount_logo_horizontal.png" width="600px">
**Federated learning and data analytics that just works**
---
</br>
<!-- Github workflow badges are case sensitive - the name must match the name of the workflow exactly -->

[](https://pypi.org/project/bitfount/)
[](https://pepy.tech/project/bitfount)


[](https://codecov.io/gh/bitfount/bitfount)
[](https://github.com/psf/black)
[](https://github.com/PyCQA/bandit)
[](https://github.com/python/mypy)
[](https://github.com/PyCQA/flake8)
[](https://github.com/bitfount/bitfount/blob/develop/LICENSE)
<!--  -->
</div>
## Table of Contents
- [Using the Docker images](#using-the-docker-images)
- [Running the Python code](#running-the-python-code)
- [Installation](#installation)
- [Getting started (Tutorials)](#getting-started-tutorials)
- [Federated training scripts](#federated-training-scripts)
- [Basic Local Usage](#basic-local-usage)
- [License](#license)
## Using the Docker images
There are two docker images, one for running a Pod (`ghcr.io/bitfount/pod:stable`),
and another for running a modelling task (`ghcr.io/bitfount/modeller:stable`).
Both of the images require a `config.yaml` file to be provided to them,
by default they will try to load it from `/mount/config/config.yaml` inside the docker container.
You can provide this file easily by mounting/binding a volume to the container,
how you do this may vary depending on your platform/environment (Docker/docker-compose/ECS),
if you have any problems doing this then feel free to reach out to us.
Alternative you could copy a config file into a stopped container using [docker cp](https://docs.docker.com/engine/reference/commandline/cp/).
If you're using a CSV data source then you'll also need to mount your data to the container,
this will need to be mounted at the path specified in your config, for simplicity it's easiest
put your config and your CSV in the same directory and then mount it to the container.
Once your container is running you will need to check the logs and complete the login step,
allowing your container to authenticate with Bitfount.
The process is the same as when running locally (e.g. the tutorials),
except that we can't open the login page automatically for you.
## Running the Python code
### Installation
#### Where to get it
Binary installers for the latest released version are available at the [Python
Package Index (PyPI)](https://pypi.org/project/bitfount).
`pip install bitfount`
If you want to use differential privacy (DP), you will need to install the DP extras:
`pip install bitfount[dp]`
If you are planning on using the `bitfount` package with Jupyter Notebooks, we recommend you install the splinter package `bitfount[tutorials]` which will make sure you are running compatible jupyter dependencies.
`pip install "bitfount[tutorials]"`
#### Installation from sources
To install `bitfount` from source you need to create a python virtual environment.
In the `bitfount` directory (same one where you found this file after
cloning the git repo), execute:
`pip install -r requirements/requirements.in`
These requirements are set to permissive ranges but are not guaranteed to work for all releases, especially the latest versions. For a pinned version of these requirements which are guaranteed to work, run the following command instead:
`pip install -r requirements/requirements.txt`
To be able to use differential privacy (DP), you will need to additionally install the DP requirements:
`pip install -r requirements/differential_privacy/requirements-dp.txt`
For MacOS you also need to install `libomp`:
`brew install libomp`
### Getting started (Tutorials)
In order to run the tutorials, you also need to install the tutorial requirements:
`pip install -r requirements/requirements-tutorial.txt`
To get started using the Bitfount package in a federated setting,
we recommend that you start with our tutorials. Run `jupyter notebook`
and open up the first tutorial at: `tutorials/01_running_a_pod.ipynb`
### Federated training scripts
Some simple scripts have been provided to run a Pod or Modelling job from a config file.
> ⚠️ If you are running from a source install (such as from `git clone`) you will
> need to use <span style="white-space: nowrap">`python -m scripts.<script_name>`</span>
> rather than use `bitfount <script_name>` directly.
To run a pod:
`bitfount run_pod --path_to_config_yaml=<CONFIG_FILE>`
To run a modelling job:
`bitfount run_modeller --path_to_config_yaml=<CONFIG_FILE>`
### Basic Local Usage
As well as providing the ability to use data in remote pods, this package also enables local ML training. Some example code for this purpose is given below.
**1\. Import bitfount**
```python
import bitfount as bf
```
**2\. Create DataSource and load data**
```python
census_income = bf.CSVSource(
path="https://bitfount-hosted-downloads.s3.eu-west-2.amazonaws.com/bitfount-tutorials/census_income.csv",
ignore_cols=["fnlwgt"],
)
census_income.load_data()
```
**3\. Create Schema**
```python
schema = bf.BitfountSchema(
census_income,
table_name="census_income",
force_stypes={
"census_income": {
"categorical":[
"TARGET",
"workclass",
"marital-status",
"occupation",
"relationship",
"race",
"native-country",
"gender",
"education"
]
}
}
)
```
**4\. Transform Data**
```python
clean_data = bf.CleanDataTransformation()
processor = bf.TransformationProcessor([clean_data], schema.get_table_schema("census_income"))
census_income.data = processor.transform(census_income.data)
schema.add_datasource_tables(census_income, table_name="census_income")
```
**5\. Create DataStructure**
```python
census_income_data_structure=bf.DataStructure(
table="census_income",
target="TARGET",
)
```
**6\. Create and Train Model**
```python
nn = bf.PyTorchTabularClassifier(
datastructure=census_income_data_structure,
schema=schema,
epochs=2,
batch_size=256,
optimizer=bf.Optimizer("RAdam", {"lr": 0.001}),
)
nn.fit(census_income)
nn.serialize("demo_task_model.pt")
```
**7\. Evaluate**
```python
preds, target = nn.evaluate()
metrics = bf.MetricCollection.create_from_model(nn)
results = metrics.compute(target, preds)
print(results)
```
**8\. Assert results**
```python
import numpy as np
assert nn._validation_results[-1]["validation_loss"] is not np.nan
assert results["AUC"] > 0.7
```
## License
The license for this software is available in the `LICENSE` file.
This can be found in the Github Repository, as well as inside the Docker image.
نیازمندی
| مقدار | نام |
|---|---|
| >=1.4.0 | GPUtil |
| <9.4.0,>=8.3.2 | Pillow |
| ~=5.4 | PyYAML |
| >=3.8.0 | aiohttp |
| >=1.0.0 | albumentations |
| ~=4.0 | async-timeout |
| >=19.3.0 | attrs |
| >=3.3.0 | bleach |
| >=3.4.4 | cryptography |
| >=5.0.0 | decorator |
| >=2022.9.22 | desert |
| >=0.14.1 | docstring-parser |
| >=9.0 | environs |
| >=1.10.211231 | envyaml |
| >=0.1.0 | fire |
| >=2.1.0 | gmpy2 |
| >=1.48.0 | grpcio |
| >=0.23.0 | httpx |
| >=8.8.0 | ipython |
| >=5.0.1 | isort |
| >=3.0.0 | lightgbm |
| >=4.6.5 | lxml |
| >=1.5.1 | marshmallow-enum |
| >=5.10 | marshmallow-polyfield |
| >=0.1.15 | marshmallow-union |
| >=3.13.0 | marshmallow |
| >=0.4.5 | methodtools |
| >=1.0.0 | msgpack |
| <1.24,>=1.22 | numpy |
| >=22.0 | packaging |
| >=1.3.0 | pandas |
| >=0.7.3 | pandasql |
| <5,>=4 | protobuf |
| >=5.0.0 | psutil |
| ~=7.0.0 | pyarrow |
| >=1.0 | pydantic |
| >=2.4.0 | pyjwt |
| >=7.2.0 | pytest |
| <2,>=1.6.0 | pytorch-lightning |
| >=3.0.0 | pytorch-tabnet |
| >=2.26.0 | requests |
| >=0.18.0 | scikit-image |
| >=1.0 | scikit-learn |
| <4.3 | selenium |
| <2,>=1.4.0 | sqlalchemy |
| >=0.4.2 | sqlparse |
| >=0.0.18 | sqlvalidator |
| >=0.11.0 | statsmodels |
| >=2.2.0 | tensorboard |
| >=0.1.0 | torch-optimizer |
| <2,>=1.8.1 | torch |
| <=0.10.2,>=0.6.0 | torchmetrics |
| <0.15,>=0.9.1 | torchvision |
| >=5.1.4 | types-decorator |
| >=4.0.0 | typing-extensions |
| >=1.26.5 | urllib3 |
| <1.2,>=1 | opacus |
| !=1.6.4,!=1.6.5,<1.7,<2,>=1.6.0 | pytorch-lightning |
| >=0.2.3 | smartnoise-sql |
| <2,==1.8.1,>=1.8.1 | torch |
| >=0.2.1 | torchcsprng |
| <0.15,==0.9.1,>=0.9.1 | torchvision |
| ==3.8.4 | aiohttp |
| ==1.3.1 | aiosignal |
| ==1.10.2 | alembic |
| ==3.6.2 | anyio |
| ==1.4.4 | appdirs |
| ==0.1.3 | appnope |
| ==21.3.0 | argon2-cffi |
| ==21.2.0 | argon2-cffi-bindings |
| ==1.2.3 | arrow |
| ==2.2.1 | asttokens |
| ==1.10 | async-generator |
| ==4.0.2 | async-timeout |
| ==22.2.0 | attrs |
| ==0.2.0 | backcall |
| ==0.2.1 | backports-zoneinfo |
| ==4.12.0 | beautifulsoup4 |
| ==6.0.0 | bleach |
| ==1.26.96 | boto3 |
| ==1.29.96 | botocore |
| ==11.0.3 | bravado |
| ==5.17.1 | bravado-core |
| ==5.3.0 | cachetools |
| ==2022.12.7 | certifi |
| ==1.15.1 | cffi |
| ==5.1.0 | chardet |
| ==3.1.0 | charset-normalizer |
| ==0.4.0 | chromedriver-autoinstaller |
| ==8.1.3 | click |
| ==2.2.1 | cloudpickle |
| ==0.4.6 | colorama |
| ==0.1.3 | comm |
| ==1.0.7 | contourpy |
| ==7.2.2 | coverage[toml] |
| ==39.0.2 | cryptography |
| ==0.11.0 | cycler |
| ==0.17.6 | databricks-cli |
| ==1.6.6 | debugpy |
| ==5.1.1 | decorator |
| ==0.7.1 | defusedxml |
| ==0.3.6 | distlib |
| ==6.0.1 | docker |
| ==0.4.0 | docker-pycreds |
| ==0.4 | entrypoints |
| ==1.1.0 | et-xmlfile |
| ==1.1.1 | exceptiongroup |
| ==1.9.0 | execnet |
| ==1.2.0 | executing |
| ==2.16.3 | fastjsonschema |
| ==3.10.0 | filelock |
| ==2.2.3 | flask |
| ==4.39.2 | fonttools |
| ==1.5.1 | fqdn |
| ==1.3.3 | frozenlist |
| ==0.18.3 | future |
| ==4.0.10 | gitdb |
| ==3.1.31 | gitpython |
| ==2.0.2 | greenlet |
| ==20.1.0 | gunicorn |
| ==0.14.0 | h11 |
| ==0.16.3 | httpcore |
| ==0.23.3 | httpx |
| ==3.4 | idna |
| ==6.1.0 | importlib-metadata |
| ==5.12.0 | importlib-resources |
| ==2.0.0 | iniconfig |
| ==1.13.0 | intermine |
| ==6.22.0 | ipykernel |
| ==0.5.1 | ipynb |
| ==8.11.0 | ipython |
| ==0.2.0 | ipython-genutils |
| ==20.11.0 | isoduration |
| ==2.1.2 | itsdangerous |
| ==0.18.2 | jedi |
| ==3.1.2 | jinja2 |
| ==1.0.1 | jmespath |
| ==1.2.0 | joblib |
| ==2.3 | jsonpointer |
| ==1.1.0 | jsonref |
| ==4.17.3 | jsonschema[format,format-nongpl] |
| ==8.1.0 | jupyter-client |
| ==5.3.0 | jupyter-core |
| ==0.6.3 | jupyter-events |
| ==2.5.0 | jupyter-server |
| ==0.4.4 | jupyter-server-terminals |
| ==0.2.2 | jupyterlab-pygments |
| ==1.14.5 | jupytext |
| ==1.4.4 | kiwisolver |
| ==0.39.1 | llvmlite |
| ==1.2.4 | mako |
| ==3.4.1 | markdown |
| ==2.2.0 | markdown-it-py |
| ==2.1.2 | markupsafe |
| ==3.7.1 | matplotlib |
| ==0.1.6 | matplotlib-inline |
| ==0.3.5 | mdit-py-plugins |
| ==0.1.2 | mdurl |
| ==2.5.1 | mirakuru |
| ==2.0.5 | mistune |
| ==2.2.2 | mlflow |
| ==1.6 | monotonic |
| ==1.0.5 | msgpack |
| ==6.0.4 | multidict |
| ==0.5.3 | nbclassic |
| ==0.7.2 | nbclient |
| ==7.2.10 | nbconvert |
| ==5.8.0 | nbformat |
| ==1.1.1 | neptune-client |
| ==1.5.6 | nest-asyncio |
| ==6.5.3 | notebook |
| ==0.2.2 | notebook-shim |
| ==0.56.4 | numba |
| ==1.23.5 | numpy |
| ==3.2.2 | oauthlib |
| ==3.1.2 | openpyxl |
| ==1.2.0 | outcome |
| ==23.0 | packaging |
| ==1.5.3 | pandas |
| ==1.5.0 | pandocfilters |
| ==0.8.3 | parso |
| ==0.1.2 | pathtools |
| ==4.8.0 | pexpect |
| ==0.7.5 | pickleshare |
| ==9.3.0 | pillow |
| ==1.3.10 | pkgutil-resolve-name |
| ==3.1.1 | platformdirs |
| ==1.0.0 | pluggy |
| ==0.6.3 | port-for |
| ==0.16.0 | prometheus-client |
| ==3.0.38 | prompt-toolkit |
| ==4.22.1 | protobuf |
| ==5.9.4 | psutil |
| ==3.1.8 | psycopg[binary] |
| ==3.1.8 | psycopg-binary |
| ==2.9.5 | psycopg2-binary |
| ==0.7.0 | ptyprocess |
| ==0.2.2 | pure-eval |
| ==7.0.0 | pyarrow |
| ==2.21 | pycparser |
| ==2.3.1 | pydicom |
| ==2.14.0 | pygments |
| ==2.6.0 | pyjwt |
| ==23.0.0 | pyopenssl |
| ==3.0.9 | pyparsing |
| ==1.5.1 | pyproject-api |
| ==0.19.3 | pyrsistent |
| ==1.7.1 | pysocks |
| ==7.2.2 | pytest |
| ==1.0.4 | pytest-aiohttp |
| ==0.21.0 | pytest-asyncio |
| ==4.0.0 | pytest-cov |
| ==0.3.0 | pytest-custom-exit-code |
| ==1.2.0 | pytest-flask |
| ==0.21.3 | pytest-httpx |
| ==0.6.3 | pytest-lazy-fixture |
| ==3.10.0 | pytest-mock |
| ==4.1.1 | pytest-postgresql |
| ==3.12.0 | pytest-randomly |
| ==2.1.0 | pytest-timeout |
| ==3.2.1 | pytest-xdist[psutil] |
| ==2.8.2 | python-dateutil |
| ==1.0.0 | python-dotenv |
| ==2.0.7 | python-json-logger |
| ==2022.7.1 | pytz |
| ==5.4.1 | pyyaml |
| ==25.0.2 | pyzmq |
| ==1.2.4 | querystring-parser |
| ==2.28.2 | requests |
| ==1.3.1 | requests-oauthlib |
| ==0.10.1 | requests-toolbelt |
| ==0.23.1 | responses |
| ==0.1.4 | rfc3339-validator |
| ==1.5.0 | rfc3986[idna2008] |
| ==0.1.1 | rfc3986-validator |
| ==1.3.8 | rfc3987 |
| ==0.6.0 | s3transfer |
| ==1.2.2 | scikit-learn |
| ==1.9.1 | scipy |
| ==4.2.0 | selenium |
| ==1.8.0 | send2trash |
| ==1.17.0 | sentry-sdk |
| ==1.3.2 | setproctitle |
| ==0.41.0 | shap |
| ==3.18.4 | simplejson |
| ==1.16.0 | six |
| ==0.0.7 | slicer |
| ==5.0.0 | smmap |
| ==1.3.0 | sniffio |
| ==2.4.0 | sortedcontainers |
| ==2.4 | soupsieve |
| ==1.4.47 | sqlalchemy |
| ==0.4.3 | sqlparse |
| ==0.6.2 | stack-data |
| ==3.0.3 | swagger-spec-validator |
| ==0.9.0 | tabulate |
| ==0.17.1 | terminado |
| ==0.4.2 | testbook |
| ==3.1.0 | threadpoolctl |
| ==1.2.1 | tinycss2 |
| ==0.10.2 | toml |
| ==2.0.1 | tomli |
| ==6.2 | tornado |
| ==4.4.7 | tox |
| ==4.65.0 | tqdm |
| ==5.9.0 | traitlets |
| ==0.22.0 | trio |
| ==0.10.2 | trio-websocket |
| ==6.0.12.8 | types-pyyaml |
| ==4.5.0 | typing-extensions |
| ==1.2.0 | uri-template |
| ==1.26.15 | urllib3[secure,socks] |
| ==0.1.0 | urllib3-secure-extra |
| ==20.21.0 | virtualenv |
| ==0.14.0 | wandb |
| ==0.2.6 | wcwidth |
| ==1.12 | webcolors |
| ==0.5.1 | webencodings |
| ==1.5.1 | websocket-client |
| ==2.2.3 | werkzeug |
| ==1.2.0 | wsproto |
| ==1.8.2 | yarl |
| ==3.15.0 | zipp |
| ==3.6.2 | anyio |
| ==0.1.3 | appnope |
| ==21.3.0 | argon2-cffi |
| ==21.2.0 | argon2-cffi-bindings |
| ==1.2.3 | arrow |
| ==2.2.1 | asttokens |
| ==22.2.0 | attrs |
| ==0.2.0 | backcall |
| ==4.12.0 | beautifulsoup4 |
| ==6.0.0 | bleach |
| ==1.15.1 | cffi |
| ==0.1.3 | comm |
| ==1.0.7 | contourpy |
| ==0.11.0 | cycler |
| ==1.6.6 | debugpy |
| ==5.1.1 | decorator |
| ==0.7.1 | defusedxml |
| ==1.2.0 | executing |
| ==2.16.3 | fastjsonschema |
| ==4.39.2 | fonttools |
| ==1.5.1 | fqdn |
| ==3.4 | idna |
| ==6.1.0 | importlib-metadata |
| ==5.12.0 | importlib-resources |
| ==6.22.0 | ipykernel |
| ==8.11.0 | ipython |
| ==0.2.0 | ipython-genutils |
| ==8.0.5 | ipywidgets |
| ==20.11.0 | isoduration |
| ==0.18.2 | jedi |
| ==3.1.2 | jinja2 |
| ==2.3 | jsonpointer |
| ==4.17.3 | jsonschema[format-nongpl] |
| ==8.1.0 | jupyter-client |
| ==0.4.2 | jupyter-contrib-core |
| ==0.7.0 | jupyter-contrib-nbextensions |
| ==5.3.0 | jupyter-core |
| ==0.6.3 | jupyter-events |
| ==0.2.0 | jupyter-highlight-selected-word |
| ==0.6.1 | jupyter-nbextensions-configurator |
| ==2.5.0 | jupyter-server |
| ==0.4.4 | jupyter-server-terminals |
| ==0.2.2 | jupyterlab-pygments |
| ==3.0.6 | jupyterlab-widgets |
| ==1.14.5 | jupytext |
| ==1.4.4 | kiwisolver |
| ==4.9.2 | lxml |
| ==2.2.0 | markdown-it-py |
| ==2.1.2 | markupsafe |
| ==3.7.1 | matplotlib |
| ==0.1.6 | matplotlib-inline |
| ==0.3.5 | mdit-py-plugins |
| ==0.1.2 | mdurl |
| ==2.0.5 | mistune |
| ==0.5.3 | nbclassic |
| ==0.7.2 | nbclient |
| ==7.2.10 | nbconvert |
| ==5.8.0 | nbformat |
| ==1.5.6 | nest-asyncio |
| ==6.5.3 | notebook |
| ==0.2.2 | notebook-shim |
| ==1.23.5 | numpy |
| ==23.0 | packaging |
| ==1.5.0 | pandocfilters |
| ==0.8.3 | parso |
| ==4.8.0 | pexpect |
| ==0.7.5 | pickleshare |
| ==9.3.0 | pillow |
| ==1.3.10 | pkgutil-resolve-name |
| ==3.1.1 | platformdirs |
| ==0.16.0 | prometheus-client |
| ==3.0.38 | prompt-toolkit |
| ==5.9.4 | psutil |
| ==0.7.0 | ptyprocess |
| ==0.2.2 | pure-eval |
| ==2.21 | pycparser |
| ==2.14.0 | pygments |
| ==3.0.9 | pyparsing |
| ==0.19.3 | pyrsistent |
| ==2.8.2 | python-dateutil |
| ==2.0.7 | python-json-logger |
| ==5.4.1 | pyyaml |
| ==25.0.2 | pyzmq |
| ==0.1.4 | rfc3339-validator |
| ==0.1.1 | rfc3986-validator |
| ==1.8.0 | send2trash |
| ==1.16.0 | six |
| ==1.3.0 | sniffio |
| ==2.4 | soupsieve |
| ==0.6.2 | stack-data |
| ==0.17.1 | terminado |
| ==1.2.1 | tinycss2 |
| ==0.10.2 | toml |
| ==6.2 | tornado |
| ==4.65.0 | tqdm |
| ==5.9.0 | traitlets |
| ==1.2.0 | uri-template |
| ==0.2.6 | wcwidth |
| ==1.12 | webcolors |
| ==0.5.1 | webencodings |
| ==1.5.1 | websocket-client |
| ==4.0.6 | widgetsnbextension |
| ==3.15.0 | zipp |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8,<3.10,!=3.9.7 | Python |
نحوه نصب
نصب پکیج whl bitfount-0.5.9:
pip install bitfount-0.5.9.whl
نصب پکیج tar.gz bitfount-0.5.9:
pip install bitfount-0.5.9.tar.gz