Skip to content

Commit

Permalink
Update README - remove printouts and round_id
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminastrand committed Nov 5, 2024
1 parent 40cb3d5 commit d3b6998
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions fedn/network/clients/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ Step-by-Step Instructions
.. code-block:: python
import argparse
import json
import uuid
from fedn.network.clients.client_api import ClientAPI, ConnectToApiResult
Expand All @@ -45,22 +43,14 @@ Step-by-Step Instructions
"lr": 1,
}
config = {
"round_id": 1,
}
metadata = {
"training_metadata": training_metadata,
"config": json.dumps(config),
}
metadata = {"training_metadata": training_metadata}
# Do your training here, out_model is your result...
out_model = in_model
return out_model, metadata
def on_validate(in_model):
# Calculate metrics here...
metrics = {
"test_accuracy": 0.9,
Expand All @@ -70,12 +60,17 @@ Step-by-Step Instructions
}
return metrics
def main(api_url: str, api_port: int, token: str = None):
print(f"API URL: {api_url}")
print(f"API Token: {token or "-"}")
print(f"API Port: {api_port or "-"}")
def on_predict(in_model):
# Do your prediction here...
prediction = {
"prediction": 1,
"confidence": 0.9,
}
return prediction
client_api = ClientAPI(train_callback=on_train, validate_callback=on_validate)
def main(api_url: str, api_port: int, token: str = None):
client_api = ClientAPI(train_callback=on_train, validate_callback=on_validate, predict_callback=on_predict)
url = get_api_url(api_url, api_port)
Expand Down

0 comments on commit d3b6998

Please sign in to comment.