SDK
FlockSDK is a Python-based Software Development Kit (SDK) for developing machine-learning applications. It provides a framework to register and run your own training, evaluation, and aggregation methods over HTTP using Flask, providing you with an API that receives and sends data in JSON format.
The key methods provided in this SDK are:
register_train(func)
: Registers a function to train your machine learning model.register_evaluate(func)
: Registers a function to evaluate the model.register_aggregate(func)
: Registers a function to aggregate the model's parameters.run()
: Runs the Flask application.
Register Functions
Next, register your functions for training, evaluation, and aggregation.
These functions should take parameters and a dataset as input. The register_train
and register_aggregate
methods should return the model parameters and the register_evaluate
the method should return an accuracy value.
Here's an example:
HTTP API
The SDK provides an HTTP API with the following endpoints:
POST /train
: Trains the model. Expects a JSON body with "parameters" (base64-encoded) and "dataset". Returns base64-encoded "parameters".POST /evaluate
: Evaluates the model. Expects a JSON body with "parameters" (base64-encoded) and "dataset". Returns "accuracy".POST /aggregate
: Aggregates the model's parameters. Expects a JSON body with "parameters_list" (a list of base64-encoded parameters). Returns base64-encoded "parameters".
Further Information
For more detailed information about how to use this SDK, check the inline comments and documentation in the FlockSDK Python file.
Last updated