prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  sklearn-logreg-mnist example is outdated
  ### Describe the bug
  
  The sklearn-logreg-mnist example is outdated and does not work with flower 1.0.0. I will make a pull request to fix this.
  
  ### Steps/Code to Reproduce
  
  sh ./run.sh
  
  ### Expected Results
  
  The example should run with no errors, both on the client and on the server.
  
  ### Actual Results
  
  Number of errors arise when the script runs.
  
  </issue>
  <code>
  [start of examples/sklearn-logreg-mnist/server.py]
  1 import flwr as fl
  2 import utils
  3 from sklearn.metrics import log_loss
  4 from sklearn.linear_model import LogisticRegression
  5 from typing import Dict
  6 
  7 
  8 def fit_round(server_round: int) -> Dict:
  9     """Send round number to client."""
  10     return {"server_round": server_round}
  11 
  12 
  13 def get_evaluate_fn(model: LogisticRegression):
  14     """Return an evaluation function for server-side evaluation."""
  15 
  16     # Load test data here to avoid the overhead of doing it in `evaluate` itself
  17     _, (X_test, y_test) = utils.load_mnist()
  18 
  19     # The `evaluate` function will be called after every round
  20     def evaluate(parameters: fl.common.Weights):
  21         # Update model with the latest parameters
  22         utils.set_model_params(model, parameters)
  23         loss = log_loss(y_test, model.predict_proba(X_test))
  24         accuracy = model.score(X_test, y_test)
  25         return loss, {"accuracy": accuracy}
  26 
  27     return evaluate
  28 
  29 
  30 # Start Flower server for five rounds of federated learning
  31 if __name__ == "__main__":
  32     model = LogisticRegression()
  33     utils.set_initial_params(model)
  34     strategy = fl.server.strategy.FedAvg(
  35         min_available_clients=2,
  36         evaluate_fn=get_evaluate_fn(model),
  37         on_fit_config_fn=fit_round,
  38     )
  39     fl.server.start_server(
  40         server_address="0.0.0.0:8080",
  41         strategy=strategy,
  42         config={"num_rounds": 5},
  43     )
  44
  [end of examples/sklearn-logreg-mnist/server.py]
  [start of examples/sklearn-logreg-mnist/client.py]
  1 import warnings
  2 import flwr as fl
  3 import numpy as np
  4 
  5 from sklearn.linear_model import LogisticRegression
  6 from sklearn.metrics import log_loss
  7 
  8 import utils
  9 
  10 if __name__ == "__main__":
  11     # Load MNIST dataset from https://www.openml.org/d/554
  12     (X_train, y_train), (X_test, y_test) = utils.load_mnist()
  13 
  14     # Split train set into 10 partitions and randomly use one for training.
  15     partition_id = np.random.choice(10)
  16     (X_train, y_train) = utils.partition(X_train, y_train, 10)[partition_id]
  17 
  18     # Create LogisticRegression Model
  19     model = LogisticRegression(
  20         penalty="l2",
  21         max_iter=1,  # local epoch
  22         warm_start=True,  # prevent refreshing weights when fitting
  23     )
  24 
  25     # Setting initial parameters, akin to model.compile for keras models
  26     utils.set_initial_params(model)
  27 
  28     # Define Flower client
  29     class MnistClient(fl.client.NumPyClient):
  30         def get_parameters(self):  # type: ignore
  31             return utils.get_model_parameters(model)
  32 
  33         def fit(self, parameters, config):  # type: ignore
  34             utils.set_model_params(model, parameters)
  35             # Ignore convergence failure due to low local epochs
  36             with warnings.catch_warnings():
  37                 warnings.simplefilter("ignore")
  38                 model.fit(X_train, y_train)
  39             print(f"Training finished for round {config['server_round']}")
  40             return utils.get_model_parameters(model), len(X_train), {}
  41 
  42         def evaluate(self, parameters, config):  # type: ignore
  43             utils.set_model_params(model, parameters)
  44             loss = log_loss(y_test, model.predict_proba(X_test))
  45             accuracy = model.score(X_test, y_test)
  46             return loss, len(X_test), {"accuracy": accuracy}
  47 
  48     # Start Flower client
  49     fl.client.start_numpy_client("0.0.0.0:8080", client=MnistClient())
  50
  [end of examples/sklearn-logreg-mnist/client.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/examples/sklearn-logreg-mnist/client.py b/examples/sklearn-logreg-mnist/client.py
  --- a/examples/sklearn-logreg-mnist/client.py
  +++ b/examples/sklearn-logreg-mnist/client.py
  @@ -27,7 +27,7 @@
   
       # Define Flower client
       class MnistClient(fl.client.NumPyClient):
  -        def get_parameters(self):  # type: ignore
  +        def get_parameters(self, config):  # type: ignore
               return utils.get_model_parameters(model)
   
           def fit(self, parameters, config):  # type: ignore
  @@ -46,4 +46,4 @@
               return loss, len(X_test), {"accuracy": accuracy}
   
       # Start Flower client
  -    fl.client.start_numpy_client("0.0.0.0:8080", client=MnistClient())
  +    fl.client.start_numpy_client(server_address="0.0.0.0:8080", client=MnistClient())
  diff --git a/examples/sklearn-logreg-mnist/server.py b/examples/sklearn-logreg-mnist/server.py
  --- a/examples/sklearn-logreg-mnist/server.py
  +++ b/examples/sklearn-logreg-mnist/server.py
  @@ -17,7 +17,7 @@
       _, (X_test, y_test) = utils.load_mnist()
   
       # The `evaluate` function will be called after every round
  -    def evaluate(parameters: fl.common.Weights):
  +    def evaluate(server_round, parameters: fl.common.NDArrays, config):
           # Update model with the latest parameters
           utils.set_model_params(model, parameters)
           loss = log_loss(y_test, model.predict_proba(X_test))
  @@ -39,5 +39,5 @@
       fl.server.start_server(
           server_address="0.0.0.0:8080",
           strategy=strategy,
  -        config={"num_rounds": 5},
  +        config=fl.server.ServerConfig(num_rounds=5),
       )
  
verification_info: {"golden_diff": "diff --git a/examples/sklearn-logreg-mnist/client.py b/examples/sklearn-logreg-mnist/client.py\n--- a/examples/sklearn-logreg-mnist/client.py\n+++ b/examples/sklearn-logreg-mnist/client.py\n@@ -27,7 +27,7 @@\n \n     # Define Flower client\n     class MnistClient(fl.client.NumPyClient):\n-        def get_parameters(self):  # type: ignore\n+        def get_parameters(self, config):  # type: ignore\n             return utils.get_model_parameters(model)\n \n         def fit(self, parameters, config):  # type: ignore\n@@ -46,4 +46,4 @@\n             return loss, len(X_test), {\"accuracy\": accuracy}\n \n     # Start Flower client\n-    fl.client.start_numpy_client(\"0.0.0.0:8080\", client=MnistClient())\n+    fl.client.start_numpy_client(server_address=\"0.0.0.0:8080\", client=MnistClient())\ndiff --git a/examples/sklearn-logreg-mnist/server.py b/examples/sklearn-logreg-mnist/server.py\n--- a/examples/sklearn-logreg-mnist/server.py\n+++ b/examples/sklearn-logreg-mnist/server.py\n@@ -17,7 +17,7 @@\n     _, (X_test, y_test) = utils.load_mnist()\n \n     # The `evaluate` function will be called after every round\n-    def evaluate(parameters: fl.common.Weights):\n+    def evaluate(server_round, parameters: fl.common.NDArrays, config):\n         # Update model with the latest parameters\n         utils.set_model_params(model, parameters)\n         loss = log_loss(y_test, model.predict_proba(X_test))\n@@ -39,5 +39,5 @@\n     fl.server.start_server(\n         server_address=\"0.0.0.0:8080\",\n         strategy=strategy,\n-        config={\"num_rounds\": 5},\n+        config=fl.server.ServerConfig(num_rounds=5),\n     )\n", "issue": "sklearn-logreg-mnist example is outdated\n### Describe the bug\n\nThe sklearn-logreg-mnist example is outdated and does not work with flower 1.0.0. I will make a pull request to fix this.\n\n### Steps/Code to Reproduce\n\nsh ./run.sh\n\n### Expected Results\n\nThe example should run with no errors, both on the client and on the server.\n\n### Actual Results\n\nNumber of errors arise when the script runs.\n", "before_files": [{"content": "import flwr as fl\nimport utils\nfrom sklearn.metrics import log_loss\nfrom sklearn.linear_model import LogisticRegression\nfrom typing import Dict\n\n\ndef fit_round(server_round: int) -> Dict:\n    \"\"\"Send round number to client.\"\"\"\n    return {\"server_round\": server_round}\n\n\ndef get_evaluate_fn(model: LogisticRegression):\n    \"\"\"Return an evaluation function for server-side evaluation.\"\"\"\n\n    # Load test data here to avoid the overhead of doing it in `evaluate` itself\n    _, (X_test, y_test) = utils.load_mnist()\n\n    # The `evaluate` function will be called after every round\n    def evaluate(parameters: fl.common.Weights):\n        # Update model with the latest parameters\n        utils.set_model_params(model, parameters)\n        loss = log_loss(y_test, model.predict_proba(X_test))\n        accuracy = model.score(X_test, y_test)\n        return loss, {\"accuracy\": accuracy}\n\n    return evaluate\n\n\n# Start Flower server for five rounds of federated learning\nif __name__ == \"__main__\":\n    model = LogisticRegression()\n    utils.set_initial_params(model)\n    strategy = fl.server.strategy.FedAvg(\n        min_available_clients=2,\n        evaluate_fn=get_evaluate_fn(model),\n        on_fit_config_fn=fit_round,\n    )\n    fl.server.start_server(\n        server_address=\"0.0.0.0:8080\",\n        strategy=strategy,\n        config={\"num_rounds\": 5},\n    )\n", "path": "examples/sklearn-logreg-mnist/server.py"}, {"content": "import warnings\nimport flwr as fl\nimport numpy as np\n\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.metrics import log_loss\n\nimport utils\n\nif __name__ == \"__main__\":\n    # Load MNIST dataset from https://www.openml.org/d/554\n    (X_train, y_train), (X_test, y_test) = utils.load_mnist()\n\n    # Split train set into 10 partitions and randomly use one for training.\n    partition_id = np.random.choice(10)\n    (X_train, y_train) = utils.partition(X_train, y_train, 10)[partition_id]\n\n    # Create LogisticRegression Model\n    model = LogisticRegression(\n        penalty=\"l2\",\n        max_iter=1,  # local epoch\n        warm_start=True,  # prevent refreshing weights when fitting\n    )\n\n    # Setting initial parameters, akin to model.compile for keras models\n    utils.set_initial_params(model)\n\n    # Define Flower client\n    class MnistClient(fl.client.NumPyClient):\n        def get_parameters(self):  # type: ignore\n            return utils.get_model_parameters(model)\n\n        def fit(self, parameters, config):  # type: ignore\n            utils.set_model_params(model, parameters)\n            # Ignore convergence failure due to low local epochs\n            with warnings.catch_warnings():\n                warnings.simplefilter(\"ignore\")\n                model.fit(X_train, y_train)\n            print(f\"Training finished for round {config['server_round']}\")\n            return utils.get_model_parameters(model), len(X_train), {}\n\n        def evaluate(self, parameters, config):  # type: ignore\n            utils.set_model_params(model, parameters)\n            loss = log_loss(y_test, model.predict_proba(X_test))\n            accuracy = model.score(X_test, y_test)\n            return loss, len(X_test), {\"accuracy\": accuracy}\n\n    # Start Flower client\n    fl.client.start_numpy_client(\"0.0.0.0:8080\", client=MnistClient())\n", "path": "examples/sklearn-logreg-mnist/client.py"}]}