Skip to content

Examples

David edited this page May 18, 2024 · 6 revisions

To run an experiment after install, make sure the JSONS are formatted and filled correctly and that jsonDir has correct path. The NN data should be saved in a csv, with name ending with _training / _prediction, in the inputDataDir.

Look for more example in example directory in repo.

Experiment Json

Python Flow

from apiServer import *
from experiment import *

# Create an instance of API server
api_server_instance = ApiServer()

# Display list of available JSONS
api_server_instance.showJsons()

# Choose the JSONS, may be changed until it is sent to the network
api_server_instance.selectJsons() # can also get a tuple

# Get the user selected JOSNS
arch_json , connmap_json, exp_flow_json = api_server_instance.getUserJsons()     

# Initialize the API server
api_server_instance.initialization(arch_json , connmap_json, exp_flow_json)

# Pass JSONS to network
api_server_instance.sendJsonsToDevices()

# Send a train signal to the network, sources start sending data to workers, who train their NN
api_server_instance.train()

# workers predict
api_server_instance.predict()

# Choose stats to show (Communication / accuracy / data)
api_server_instance.statistics()