DiscreetAI

JS Library

DiscreetAI’s custom JS library for setting up datasets on the client side for training.

API

bootstrapLibrary(repoID, X, y)

Bootstrap the library by storing the initial data and connecting to the server.

Arguments
  • repoID (string) – The repo ID associated with the dataset.

  • X (tf.Tensor2D) – The datapoints to train on.

  • y (tf.Tensor1D) – The labels for the datapoints.

addMoreData(repoID, X, y)

Add more data after bootstrapping.

Arguments
  • repoID (string) – The repo ID associated with the dataset.

  • X (tf.Tensor2D) – The datapoints to train on.

  • y (tf.Tensor1D) – The labels for the datapoints.

isBootstrapped()

Returns true if the library is bootstrapped, false otherwise.

Explora

Explora is a customized Jupyter Notebook used for starting decentralized training sessions.

explora

explora.make_data_config(data_type, class_labels, color_space=None, image_dims=None)

Helper function to generate the required data config for users running training sessions with the iOS library.

Parameters
  • data_type (str) – The type of data the model will train on. Currently, only image is supported for the iOS library

  • class_labels (list) – The list of possible labels in the dataset.

  • color_space (str, optional) – The type of image that is inputted into the model, if applicable. Must be specified if data_type is image. If specified, must be either GRAYSCALE or COLOR.

  • image_dims (tuple, optional) – The dimensions of image that is inputted into the model, if applicable. Must be specified if data_type is image. Must have a length of 2 (width x height).

Returns

Data config to be used when starting a new session.

Return type

DataConfig

async explora.start_new_session(repo_id, model, hyperparameters, percentage_averaged=0.75, max_rounds=5, library_type='PYTHON', checkpoint_frequency=1, data_config=None)

Validate arguments and then start a new session by sending a message to the server with the given configuration. Designed to be called in Explora.ipynb.

Parameters
  • repo_id (str) – The repo ID associated with the current dataset.

  • model (keras.engine.Model) – The initial Keras model to train with. The model must be compiled!

  • hyperparams (dict) – The hyperparameters to be used during training. Must include batch_size!

  • percentage_averaged (float, optional) – Percentage of nodes to be averaged before moving on to the next round. Defaults to 0.75.

  • max_rounds (int, optional) – Maximum number of rounds to train for. Defaults to 5.

  • library_type (str, optional) – The type of library to train with. Must be either PYTHON or JAVASCRIPT or IOS. Defaults to PYTHON.

  • checkpoint_frequency (int, optional) – Save the model in S3 every checkpoint_frequency rounds. Defaults to 1.

  • data_config (DataConfig, optional) – The configuration for the dataset, if applicable. If library_type is IOS, then this argument is required!

Examples

>>> start_new_session(
...     repo_id="c9bf9e57-1685-4c89-bafb-ff5af830be8a",
...     model=keras.models.load_model("model.h5"),
...     hyperparameters={"batch_size": 100},
...     percentage_averaged=0.75,
...     max_rounds=5,
...     library_type="PYTHON",
...     checkpoint_frequency=1,
... )
Starting session!
Waiting...
Session complete! Check dashboard for final model!