logistic_regression.client module¶
Logistic regression client
- class logistic_regression.client.Client(pool, max_iter=25, server_name='server')[source]¶
Bases:
object
The client class, representing data owning clients in the learning process.
- __init__(pool, max_iter=25, server_name='server')[source]¶
Initializes the client.
- Parameters:
pool (
Pool
) – The communication pool.max_iter (
int
) – The max number of epochsserver_name (
str
) – The name of the server
- async compute_standard_error(data, target, model)[source]¶
Compute the standard error for a model.
- Parameters:
data (
ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – The data settarget (
ndarray
[tuple
[Any
,...
],dtype
[bool
]]) – The target datamodel (
ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – The parameters for which to compute the standard error.
- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]]- Returns:
The standard error
- async compute_statistics(data, target, model)[source]¶
Compute statistics for each coefficient: standard error, z-value and p-value.
- Parameters:
data (
ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – The data settarget (
ndarray
[tuple
[Any
,...
],dtype
[bool
]]) – The target datamodel (
ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – The model for which to compute the statistics
- Return type:
list
[dict
[str
,float
]]- Returns:
A list containing a dictionary for each covariate. The dictionary contains three values: ‘se’ containing the standard error, ‘z’ containing z-value (Wald statistic) ‘p’ containing the p-value.
- async run(data, target)[source]¶
Perform the learning process.
- Parameters:
data (
ndarray
[tuple
[Any
,...
],dtype
[float64
]]) – The training data for the clienttarget (
ndarray
[tuple
[Any
,...
],dtype
[bool
]]) – The target data for the client. Must be an array of boolean values.
- Return type:
ndarray
[tuple
[Any
,...
],dtype
[float64
]]- Returns:
The resulting model.