> For the complete documentation index, see [llms.txt](https://docs.zama.org/concrete-ml/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zama.org/concrete-ml/0.4/developer-guide/api/concrete.ml.sklearn.linear_model.md).

# concrete.ml.sklearn.linear\_model

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/0.4.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/0.4.x/src/concrete/ml/sklearn/linear_model.py#L19)

### class `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. This
* **`feature 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>

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

#### method `__init__`

```python
__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

***

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

#### method `fit`

```python
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 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.

**Returns:** Any

***

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

### class `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>

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

#### method `__init__`

```python
__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

***

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

### class `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>

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

#### method `__init__`

```python
__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

***

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

### class `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>

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

#### method `__init__`

```python
__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

***

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

### class `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>

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

#### method `__init__`

```python
__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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
