concrete.ml.sklearn.linear_model
module concrete.ml.sklearn.linear_model
concrete.ml.sklearn.linear_model
Implement sklearn linear model.
class LinearRegression
LinearRegression
A linear regression model with FHE.
Arguments:
n_bits
(int): default is 2.use_sum_workaround
(bool): indicate if the sum workaround should be used or not. Thisfeature is experimental and should be used carefully. Important note
: it only works for a LinearRegression model with N features, N a power of 2, for now. More information available in the QuantizedReduceSum operator. Default to False.
For more details on LinearRegression please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html
method __init__
__init__
__init__(
n_bits=2,
use_sum_workaround=False,
fit_intercept=True,
normalize='deprecated',
copy_X=True,
n_jobs=None,
positive=False
)
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
Get the ONNX model.
.. # noqa: DAR201
Returns:
onnx.ModelProto
: the 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
method fit
fit
fit(X, y: ndarray, *args, **kwargs) → Any
Fit the FHE linear model.
Args:
X
: training data By default, you should be able to pass: * numpy arrays * torch tensors * pandas DataFrame or Seriesy
(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.
Returns: Any
class ElasticNet
ElasticNet
An ElasticNet regression model with FHE.
Arguments:
n_bits
(int): default is 2.
For more details on ElasticNet please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.ElasticNet.html
method __init__
__init__
__init__(
n_bits=2,
alpha=1.0,
l1_ratio=0.5,
fit_intercept=True,
normalize='deprecated',
copy_X=True,
positive=False
)
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
Get the ONNX model.
.. # noqa: DAR201
Returns:
onnx.ModelProto
: the 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
class Lasso
Lasso
A Lasso regression model with FHE.
Arguments:
n_bits
(int): default is 2.
For more details on Lasso please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lasso.html
method __init__
__init__
__init__(
n_bits=2,
alpha: float = 1.0,
fit_intercept=True,
normalize='deprecated',
copy_X=True,
positive=False
)
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
Get the ONNX model.
.. # noqa: DAR201
Returns:
onnx.ModelProto
: the 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
class Ridge
Ridge
A Ridge regression model with FHE.
Arguments:
n_bits
(int): default is 2.
For more details on Ridge please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Ridge.html
method __init__
__init__
__init__(
n_bits=2,
alpha: float = 1.0,
fit_intercept=True,
normalize='deprecated',
copy_X=True,
positive=False
)
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
Get the ONNX model.
.. # noqa: DAR201
Returns:
onnx.ModelProto
: the 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
class LogisticRegression
LogisticRegression
A logistic regression model with FHE.
Arguments:
n_bits
(int): default is 2.
For more details on LogisticRegression please refer to the scikit-learn documentation: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html
method __init__
__init__
__init__(
n_bits=2,
penalty='l2',
dual=False,
tol=0.0001,
C=1.0,
fit_intercept=True,
intercept_scaling=1,
class_weight=None,
random_state=None,
solver='lbfgs',
max_iter=100,
multi_class='auto',
verbose=0,
warm_start=False,
n_jobs=None,
l1_ratio=None
)
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
Get the ONNX model.
.. # noqa: DAR201
Returns:
onnx.ModelProto
: the 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
Last updated
Was this helpful?