Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

feltlabs-0.5.2.tar.gz (34.4 kB view hashes)

Uploaded Source

Built Distribution

feltlabs-0.5.2-py3-none-any.whl (44.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page