concrete.ml.sklearn.glm

arrow-up-right

module concrete.ml.sklearn.glm

Implement sklearn's Generalized Linear Models (GLM).


arrow-up-right

class PoissonRegressor

A Poisson regression model with FHE.

arrow-up-right

method __init__

__init__(
    n_bits: 'Union[int, dict]' = 2,
    alpha: 'float' = 1.0,
    fit_intercept: 'bool' = True,
    max_iter: 'int' = 100,
    tol: 'float' = 0.0001,
    warm_start: 'bool' = False,
    verbose: 'int' = 0
)

property fhe_circuit

Get the FHE circuit.

Returns:

  • Circuit: the FHE circuit


property input_quantizers

Get the input quantizers.

Returns:

  • List[QuantizedArray]: the input quantizers


property onnx_model


property output_quantizers

Get the input quantizers.

Returns:

  • List[QuantizedArray]: the input quantizers


property quantize_input

Get the input quantization function.

Returns:

  • Callable : function that quantizes the input


arrow-up-right

method fit

Fit the GLM regression quantized model.

Args:

  • X : The training data, which can be: * numpy arrays * torch tensors * pandas DataFrame or Series

  • y (numpy.ndarray): The target data.

  • *args: The arguments to pass to the sklearn linear model.

  • **kwargs: The keyword arguments to pass to the sklearn linear model.


arrow-up-right

method post_processing

Post-processing the predictions.

Args:

  • y_preds (numpy.ndarray): The predictions to post-process.

  • already_dequantized (bool): Wether the inputs were already dequantized or not. Default to False.

Returns:

  • numpy.ndarray: The post-processed predictions.


arrow-up-right

method predict

Predict on user data.

Predict on user data using either the quantized clear model, implemented with tensors, or, if execute_in_fhe is set, using the compiled FHE circuit.

Args:

  • X (numpy.ndarray): The input data.

  • execute_in_fhe (bool): Whether to execute the inference in FHE. Default to False.

Returns:

  • numpy.ndarray: The model's predictions.


arrow-up-right

class GammaRegressor

A Gamma regression model with FHE.

arrow-up-right

method __init__


property fhe_circuit

Get the FHE circuit.

Returns:

  • Circuit: the FHE circuit


property input_quantizers

Get the input quantizers.

Returns:

  • List[QuantizedArray]: the input quantizers


property onnx_model


property output_quantizers

Get the input quantizers.

Returns:

  • List[QuantizedArray]: the input quantizers


property quantize_input

Get the input quantization function.

Returns:

  • Callable : function that quantizes the input


arrow-up-right

method fit

Fit the GLM regression quantized model.

Args:

  • X : The training data, which can be: * numpy arrays * torch tensors * pandas DataFrame or Series

  • y (numpy.ndarray): The target data.

  • *args: The arguments to pass to the sklearn linear model.

  • **kwargs: The keyword arguments to pass to the sklearn linear model.


arrow-up-right

method post_processing

Post-processing the predictions.

Args:

  • y_preds (numpy.ndarray): The predictions to post-process.

  • already_dequantized (bool): Wether the inputs were already dequantized or not. Default to False.

Returns:

  • numpy.ndarray: The post-processed predictions.


arrow-up-right

method predict

Predict on user data.

Predict on user data using either the quantized clear model, implemented with tensors, or, if execute_in_fhe is set, using the compiled FHE circuit.

Args:

  • X (numpy.ndarray): The input data.

  • execute_in_fhe (bool): Whether to execute the inference in FHE. Default to False.

Returns:

  • numpy.ndarray: The model's predictions.


arrow-up-right

class TweedieRegressor

A Tweedie regression model with FHE.

arrow-up-right

method __init__


property fhe_circuit

Get the FHE circuit.

Returns:

  • Circuit: the FHE circuit


property input_quantizers

Get the input quantizers.

Returns:

  • List[QuantizedArray]: the input quantizers


property onnx_model


property output_quantizers

Get the input quantizers.

Returns:

  • List[QuantizedArray]: the input quantizers


property quantize_input

Get the input quantization function.

Returns:

  • Callable : function that quantizes the input


arrow-up-right

method fit

Fit the GLM regression quantized model.

Args:

  • X : The training data, which can be: * numpy arrays * torch tensors * pandas DataFrame or Series

  • y (numpy.ndarray): The target data.

  • *args: The arguments to pass to the sklearn linear model.

  • **kwargs: The keyword arguments to pass to the sklearn linear model.


arrow-up-right

method post_processing

Post-processing the predictions.

Args:

  • y_preds (numpy.ndarray): The predictions to post-process.

  • already_dequantized (bool): Wether the inputs were already dequantized or not. Default to False.

Returns:

  • numpy.ndarray: The post-processed predictions.


arrow-up-right

method predict

Predict on user data.

Predict on user data using either the quantized clear model, implemented with tensors, or, if execute_in_fhe is set, using the compiled FHE circuit.

Args:

  • X (numpy.ndarray): The input data.

  • execute_in_fhe (bool): Whether to execute the inference in FHE. Default to False.

Returns:

  • numpy.ndarray: The model's predictions.

Last updated

Was this helpful?