FELT python package intended for running federated learning on Ocean protocol.
Project description
This code is intended to work closely with Ocean protocol. Algorithms from this code should run on ocean provider. Training local models and aggregating them into global model.
Entry commands:
felt-train
felt-aggregate
felt-export
Common Usage
After installing this library you can load models trained using FELT as:
from feltlabs.model import load_model
# Load scikit-learn model
model = load_model("final-model.json")
# Data shape must be: (number_of_samples, number_of_features)
data = [
[1980, 2, 2, 2, 0, 0],
[1700, 3, 2, 3, 1, 1],
[2100, 3, 2, 3, 1, 0],
]
result = model.predict(data)
print(result)
# Use following line for analytics as mean, std...
# result = model.predict(None)
Command: felt-export
You can use felt-export
for converting trained models into pickle object:
Resulting file will then contain a pickled object of scikit-learn model.
felt-export --input "final-model-House Prices.json" --output "model.pkl"
Then you can use the created file as follows:
import pickle
with open('model.pkl', 'rb') as f:
model = pickle.load(object, f)
# See the above code example for data definition
model.predict(data)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file feltlabs-0.5.2.tar.gz
.
File metadata
- Download URL: feltlabs-0.5.2.tar.gz
- Upload date:
- Size: 34.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 389ba6715b093de961b3a8534d1c82e00f46997cdf4dcf79b104df3387c4c9a4 |
|
MD5 | 822946530fb435ba10e3884d452cadbe |
|
BLAKE2b-256 | bf52a7ef3770c341a4842b4f89c74c37342e45926cfc9f555b64f9a0e0c6fbbd |
File details
Details for the file feltlabs-0.5.2-py3-none-any.whl
.
File metadata
- Download URL: feltlabs-0.5.2-py3-none-any.whl
- Upload date:
- Size: 44.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fff2094863543f98ee5d7c6d48c6fb5667bb93200c448811ba66ecb829ea4d40 |
|
MD5 | 7739b5ab70abc31d2052924f3716fbe1 |
|
BLAKE2b-256 | 309d1c23ec63ef746673be8736e89b241f9a51fcea41582817943adf4d413ccd |