PrivacyFL icon indicating copy to clipboard operation
PrivacyFL copied to clipboard

Invalid parameter error for the loss parameter of SGDClassifier

Open pUrGe12 opened this issue 8 months ago • 0 comments

Ran into this issue while running run_similation.py

py run_simulation.py
STARTING SIMULATION 
 
 

/home/purge/.local/lib/python3.10/site-packages/sklearn/linear_model/_logistic.py:460: ConvergenceWarning: lbfgs failed to converge (status=1):
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.

Increase the number of iterations (max_iter) or scale the data as shown in:
    https://scikit-learn.org/stable/modules/preprocessing.html
Please also refer to the documentation for alternative solver options:
    https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
  n_iter_i = _check_optimize_result(
/home/purge/.local/lib/python3.10/site-packages/sklearn/linear_model/_logistic.py:460: ConvergenceWarning: lbfgs failed to converge (status=1):
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.

Increase the number of iterations (max_iter) or scale the data as shown in:
    https://scikit-learn.org/stable/modules/preprocessing.html
Please also refer to the documentation for alternative solver options:
    https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
  n_iter_i = _check_optimize_result(
/home/purge/.local/lib/python3.10/site-packages/sklearn/linear_model/_logistic.py:460: ConvergenceWarning: lbfgs failed to converge (status=1):
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.

Increase the number of iterations (max_iter) or scale the data as shown in:
    https://scikit-learn.org/stable/modules/preprocessing.html
Please also refer to the documentation for alternative solver options:
    https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
  n_iter_i = _check_optimize_result(
Diffie-helman key exchange simulated duration: 0:00:02.000103
Diffie-helman key exchange real run-time: 0:00:00.000103

Traceback (most recent call last):
  File "/home/purge/Desktop/PrivacyFL/src/run_simulation.py", line 17, in <module>
    initializer.run_simulation(config.ITERATIONS,
  File "/home/purge/Desktop/PrivacyFL/src/initializer.py", line 106, in run_simulation
    server_agent.request_values(num_iterations=num_iterations)
  File "/home/purge/Desktop/PrivacyFL/src/server_agent.py", line 61, in request_values
    messages = calling_pool.map(client_computation_caller, args)
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 367, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/home/purge/Desktop/PrivacyFL/src/server_agent.py", line 15, in client_computation_caller
    return_message = client_instance.produce_weights(message=message)
  File "/home/purge/Desktop/PrivacyFL/src/client_agent.py", line 145, in produce_weights
    weights, intercepts = self.compute_weights_noncumulative(iteration)
  File "/home/purge/Desktop/PrivacyFL/src/client_agent.py", line 209, in compute_weights_noncumulative
    lr.fit(X, y, coef_init=federated_weights, intercept_init=federated_intercepts)
  File "/home/purge/.local/lib/python3.10/site-packages/sklearn/base.py", line 1144, in wrapper
    estimator._validate_params()
  File "/home/purge/.local/lib/python3.10/site-packages/sklearn/base.py", line 637, in _validate_params
    validate_parameter_constraints(
  File "/home/purge/.local/lib/python3.10/site-packages/sklearn/utils/_param_validation.py", line 95, in validate_parameter_constraints
    raise InvalidParameterError(
sklearn.utils._param_validation.InvalidParameterError: The 'loss' parameter of SGDClassifier must be a str among {'perceptron', 'squared_error', 'modified_huber', 'hinge', 'log_loss', 'squared_hinge', 'epsilon_insensitive', 'huber', 'squared_epsilon_insensitive'}. Got 'log' instead.

Not sure where its getting a "log" from.

pUrGe12 avatar May 17 '25 10:05 pUrGe12