# concrete.ml.sklearn.linear\_model.md

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L0)

## module `concrete.ml.sklearn.linear_model`

Implement sklearn linear model.

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L10)

### class `LinearRegression`

A linear regression model with FHE.

**Parameters:**

* `n_bits` (int, Dict\[str, int]): Number of bits to quantize the model. If an int is passed for n\_bits, the value will be used for quantizing inputs and weights. If a dict is passed, then it should contain "op\_inputs" and "op\_weights" as keys with corresponding number of quantization bits so that: - op\_inputs : number of bits to quantize the input values - op\_weights: number of bits to quantize the learned parameters Default to 8.

For more details on LinearRegression please refer to the scikit-learn documentation: <https://scikit-learn.org/stable/modules/generated/sklearn.linear\\_model.LinearRegression.html>

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L30)

#### method `__init__`

```python
__init__(
    n_bits=8,
    fit_intercept=True,
    normalize='deprecated',
    copy_X=True,
    n_jobs=None,
    positive=False
)
```

***

**property fhe\_circuit**

Get the FHE circuit.

The FHE circuit combines computational graph, mlir, client and server into a single object. More information available in Concrete documentation: <https://docs.zama.ai/concrete/developer/terminology\\_and\\_structure#terminology> Is None if the model is not fitted.

**Returns:**

* `Circuit`: The FHE circuit.

***

**property is\_compiled**

Indicate if the model is compiled.

**Returns:**

* `bool`: If the model is compiled.

***

**property is\_fitted**

Indicate if the model is fitted.

**Returns:**

* `bool`: If the model is fitted.

***

**property onnx\_model**

Get the ONNX model.

Is None if the model is not fitted.

**Returns:**

* `onnx.ModelProto`: The ONNX model.

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L48)

#### method `dump_dict`

```python
dump_dict() → Dict[str, Any]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L75)

#### classmethod `load_dict`

```python
load_dict(metadata: Dict)
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L103)

### class `ElasticNet`

An ElasticNet regression model with FHE.

**Parameters:**

* `n_bits` (int, Dict\[str, int]): Number of bits to quantize the model. If an int is passed for n\_bits, the value will be used for quantizing inputs and weights. If a dict is passed, then it should contain "op\_inputs" and "op\_weights" as keys with corresponding number of quantization bits so that: - op\_inputs : number of bits to quantize the input values - op\_weights: number of bits to quantize the learned parameters Default to 8.

For more details on ElasticNet please refer to the scikit-learn documentation: <https://scikit-learn.org/stable/modules/generated/sklearn.linear\\_model.ElasticNet.html>

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L123)

#### method `__init__`

```python
__init__(
    n_bits=8,
    alpha=1.0,
    l1_ratio=0.5,
    fit_intercept=True,
    normalize='deprecated',
    precompute=False,
    max_iter=1000,
    copy_X=True,
    tol=0.0001,
    warm_start=False,
    positive=False,
    random_state=None,
    selection='cyclic'
)
```

***

**property fhe\_circuit**

Get the FHE circuit.

The FHE circuit combines computational graph, mlir, client and server into a single object. More information available in Concrete documentation: <https://docs.zama.ai/concrete/developer/terminology\\_and\\_structure#terminology> Is None if the model is not fitted.

**Returns:**

* `Circuit`: The FHE circuit.

***

**property is\_compiled**

Indicate if the model is compiled.

**Returns:**

* `bool`: If the model is compiled.

***

**property is\_fitted**

Indicate if the model is fitted.

**Returns:**

* `bool`: If the model is fitted.

***

**property onnx\_model**

Get the ONNX model.

Is None if the model is not fitted.

**Returns:**

* `onnx.ModelProto`: The ONNX model.

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L155)

#### method `dump_dict`

```python
dump_dict() → Dict[str, Any]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L189)

#### classmethod `load_dict`

```python
load_dict(metadata: Dict)
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L225)

### class `Lasso`

A Lasso regression model with FHE.

**Parameters:**

* `n_bits` (int, Dict\[str, int]): Number of bits to quantize the model. If an int is passed for n\_bits, the value will be used for quantizing inputs and weights. If a dict is passed, then it should contain "op\_inputs" and "op\_weights" as keys with corresponding number of quantization bits so that: - op\_inputs : number of bits to quantize the input values - op\_weights: number of bits to quantize the learned parameters Default to 8.

For more details on Lasso please refer to the scikit-learn documentation: <https://scikit-learn.org/stable/modules/generated/sklearn.linear\\_model.Lasso.html>

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L245)

#### method `__init__`

```python
__init__(
    n_bits=8,
    alpha: float = 1.0,
    fit_intercept=True,
    normalize='deprecated',
    precompute=False,
    copy_X=True,
    max_iter=1000,
    tol=0.0001,
    warm_start=False,
    positive=False,
    random_state=None,
    selection='cyclic'
)
```

***

**property fhe\_circuit**

Get the FHE circuit.

The FHE circuit combines computational graph, mlir, client and server into a single object. More information available in Concrete documentation: <https://docs.zama.ai/concrete/developer/terminology\\_and\\_structure#terminology> Is None if the model is not fitted.

**Returns:**

* `Circuit`: The FHE circuit.

***

**property is\_compiled**

Indicate if the model is compiled.

**Returns:**

* `bool`: If the model is compiled.

***

**property is\_fitted**

Indicate if the model is fitted.

**Returns:**

* `bool`: If the model is fitted.

***

**property onnx\_model**

Get the ONNX model.

Is None if the model is not fitted.

**Returns:**

* `onnx.ModelProto`: The ONNX model.

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L275)

#### method `dump_dict`

```python
dump_dict() → Dict[str, Any]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L308)

#### classmethod `load_dict`

```python
load_dict(metadata: Dict)
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L343)

### class `Ridge`

A Ridge regression model with FHE.

**Parameters:**

* `n_bits` (int, Dict\[str, int]): Number of bits to quantize the model. If an int is passed for n\_bits, the value will be used for quantizing inputs and weights. If a dict is passed, then it should contain "op\_inputs" and "op\_weights" as keys with corresponding number of quantization bits so that: - op\_inputs : number of bits to quantize the input values - op\_weights: number of bits to quantize the learned parameters Default to 8.

For more details on Ridge please refer to the scikit-learn documentation: <https://scikit-learn.org/stable/modules/generated/sklearn.linear\\_model.Ridge.html>

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L363)

#### method `__init__`

```python
__init__(
    n_bits=8,
    alpha: float = 1.0,
    fit_intercept=True,
    normalize='deprecated',
    copy_X=True,
    max_iter=None,
    tol=0.001,
    solver='auto',
    positive=False,
    random_state=None
)
```

***

**property fhe\_circuit**

Get the FHE circuit.

The FHE circuit combines computational graph, mlir, client and server into a single object. More information available in Concrete documentation: <https://docs.zama.ai/concrete/developer/terminology\\_and\\_structure#terminology> Is None if the model is not fitted.

**Returns:**

* `Circuit`: The FHE circuit.

***

**property is\_compiled**

Indicate if the model is compiled.

**Returns:**

* `bool`: If the model is compiled.

***

**property is\_fitted**

Indicate if the model is fitted.

**Returns:**

* `bool`: If the model is fitted.

***

**property onnx\_model**

Get the ONNX model.

Is None if the model is not fitted.

**Returns:**

* `onnx.ModelProto`: The ONNX model.

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L389)

#### method `dump_dict`

```python
dump_dict() → Dict[str, Any]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L420)

#### classmethod `load_dict`

```python
load_dict(metadata: Dict)
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L452)

### class `LogisticRegression`

A logistic regression model with FHE.

**Parameters:**

* `n_bits` (int, Dict\[str, int]): Number of bits to quantize the model. If an int is passed for n\_bits, the value will be used for quantizing inputs and weights. If a dict is passed, then it should contain "op\_inputs" and "op\_weights" as keys with corresponding number of quantization bits so that: - op\_inputs : number of bits to quantize the input values - op\_weights: number of bits to quantize the learned parameters Default to 8.

For more details on LogisticRegression please refer to the scikit-learn documentation: <https://scikit-learn.org/stable/modules/generated/sklearn.linear\\_model.LogisticRegression.html>

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L472)

#### method `__init__`

```python
__init__(
    n_bits=8,
    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.

The FHE circuit combines computational graph, mlir, client and server into a single object. More information available in Concrete documentation: <https://docs.zama.ai/concrete/developer/terminology\\_and\\_structure#terminology> Is None if the model is not fitted.

**Returns:**

* `Circuit`: The FHE circuit.

***

**property is\_compiled**

Indicate if the model is compiled.

**Returns:**

* `bool`: If the model is compiled.

***

**property is\_fitted**

Indicate if the model is fitted.

**Returns:**

* `bool`: If the model is fitted.

***

**property onnx\_model**

Get the ONNX model.

Is None if the model is not fitted.

**Returns:**

* `onnx.ModelProto`: The ONNX model.

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L510)

#### method `dump_dict`

```python
dump_dict() → Dict[str, Any]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/sklearn/linear_model.py#L551)

#### classmethod `load_dict`

```python
load_dict(metadata: Dict)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zama.org/concrete-ml/1.1/developer-guide/api/concrete.ml.sklearn.linear_model.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
