Repository: adap/flower

Issue:
Improve docstring for `Strategy`



Discussion:

Resolving patch:
diff --git a/src/py/flwr/server/strategy/strategy.py b/src/py/flwr/server/strategy/strategy.py
--- a/src/py/flwr/server/strategy/strategy.py
+++ b/src/py/flwr/server/strategy/strategy.py
@@ -49,7 +49,21 @@ def on_configure_fit(
     def on_configure_evaluate(
         self, rnd: int, weights: Weights, client_manager: ClientManager
     ) -> List[Tuple[ClientProxy, EvaluateIns]]:
-        """Configure the next round of evaluation."""
+        """Configure the next round of evaluation.
+
+        Arguments:
+            rnd: Integer. The current round of federated learning.
+            weights: Weights. The current (global) model weights.
+            client_manager: ClientManager. The client manger which knows about all
+                currently connected clients.
+
+        Returns:
+            A list of tuples. Each tuple in the list identifies a `ClientProxy` and the
+            `EvaluateIns` for this particular `ClientProxy`. If a particular
+            `ClientProxy` is not included in this list, it means that this
+            `ClientProxy` will not participate in the next round of federated
+            evaluation.
+        """
 
     @abstractmethod
     def on_aggregate_fit(
@@ -58,7 +72,29 @@ def on_aggregate_fit(
         results: List[Tuple[ClientProxy, FitRes]],
         failures: List[BaseException],
     ) -> Optional[Weights]:
-        """Aggregate training results."""
+        """Aggregate training results.
+
+        Arguments:
+            rnd: int. The current round of federated learning.
+            results: List[Tuple[ClientProxy, FitRes]]. Successful updates from the
+                previously selected and configured clients. Each pair of
+                `(ClientProxy, FitRes` constitutes a successful update from one of the
+                previously selected clients. Not that not all previously selected
+                clients are necessarily included in this list: a client might drop out
+                and not submit a result. For each client that did not submit an update,
+                there should be an `Exception` in `failures`.
+            failures: List[BaseException]. Exceptions that occurred while the server
+                was waiting for client updates.
+
+        Returns:
+            Optional `flwr.common.Weights`. If weights are returned, then the server
+            will treat these as the new global model weights (i.e., it will replace the
+            previous weights with the ones returned from this method). If `None` is
+            returned (e.g., because there were only failures and no viable results)
+            then the server will no update the previous model weights, the updates
+            received in this round are discarded, and the global model weights remain
+            the same.
+        """
 
     @abstractmethod
     def on_aggregate_evaluate(
@@ -67,15 +103,51 @@ def on_aggregate_evaluate(
         results: List[Tuple[ClientProxy, EvaluateRes]],
         failures: List[BaseException],
     ) -> Optional[float]:
-        """Aggregate evaluation results."""
+        """Aggregate evaluation results.
+
+        Arguments:
+            rnd: int. The current round of federated learning.
+            results: List[Tuple[ClientProxy, FitRes]]. Successful updates from the
+                previously selected and configured clients. Each pair of
+                `(ClientProxy, FitRes` constitutes a successful update from one of the
+                previously selected clients. Not that not all previously selected
+                clients are necessarily included in this list: a client might drop out
+                and not submit a result. For each client that did not submit an update,
+                there should be an `Exception` in `failures`.
+            failures: List[BaseException]. Exceptions that occurred while the server
+                was waiting for client updates.
+
+        Returns:
+            Optional `float` representing the aggregated evaluation result. Aggregation
+            typically uses some variant of a weighted average.
+        """
 
     @abstractmethod
     def evaluate(self, weights: Weights) -> Optional[Tuple[float, float]]:
-        """Evaluate the current model weights."""
+        """Evaluate the current model weights.
+
+        This function can be used to perform centralized (i.e., server-side) evaluation
+        of model weights.
+
+        Arguments:
+            weights: Weights. The current (global) model weights.
+
+        Returns:
+            The evaluation result, usually a Tuple containing loss and accuracy.
+        """
 
     @abstractmethod
     def on_conclude_round(
         self, rnd: int, loss: Optional[float], acc: Optional[float]
     ) -> bool:
         """Conclude federated learning round and decide whether to continue or
-        not."""
+        not.
+
+        Arguments:
+            rnd: int. The current round of federated learning.
+            loss: Optional[float]. The loss of the global model weights.
+            acc: Optional[float]. The accuracy of the global model weights.
+
+        Returns:
+            A boolean indicating whether the server should continue or not.
+        """


Test patch: