# concrete.ml.sklearn.xgb.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/xgb.py#L0)

## module `concrete.ml.sklearn.xgb`

Implements XGBoost models.

***

[![](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/xgb.py#L16)

### class `XGBClassifier`

Implements the XGBoost classifier.

See https://xgboost.readthedocs.io/en/stable/python/python\_api.html#module-xgboost.sklearn for more information about the parameters used.

[![](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/xgb.py#L28)

#### method `__init__`

```python
__init__(
    n_bits: int = 6,
    max_depth: Optional[int] = 3,
    learning_rate: Optional[float] = 0.1,
    n_estimators: Optional[int] = 20,
    objective: Optional[str] = 'binary:logistic',
    booster: Optional[str] = None,
    tree_method: Optional[str] = None,
    n_jobs: Optional[int] = None,
    gamma: Optional[float] = None,
    min_child_weight: Optional[float] = None,
    max_delta_step: Optional[float] = None,
    subsample: Optional[float] = None,
    colsample_bytree: Optional[float] = None,
    colsample_bylevel: Optional[float] = None,
    colsample_bynode: Optional[float] = None,
    reg_alpha: Optional[float] = None,
    reg_lambda: Optional[float] = None,
    scale_pos_weight: Optional[float] = None,
    base_score: Optional[float] = None,
    missing: float = nan,
    num_parallel_tree: Optional[int] = None,
    monotone_constraints: Optional[Dict[str, int], str] = None,
    interaction_constraints: Optional[str, List[Tuple[str]]] = None,
    importance_type: Optional[str] = None,
    gpu_id: Optional[int] = None,
    validate_parameters: Optional[bool] = None,
    predictor: Optional[str] = None,
    enable_categorical: bool = False,
    use_label_encoder: bool = False,
    random_state: Optional[int] = None,
    verbosity: Optional[int] = 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/xgb.py#L115)

#### 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/xgb.py#L167)

#### 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/xgb.py#L228)

### class `XGBRegressor`

Implements the XGBoost regressor.

See https://xgboost.readthedocs.io/en/stable/python/python\_api.html#module-xgboost.sklearn for more information about the parameters used.

[![](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/xgb.py#L240)

#### method `__init__`

```python
__init__(
    n_bits: int = 6,
    max_depth: Optional[int] = 3,
    learning_rate: Optional[float] = 0.1,
    n_estimators: Optional[int] = 20,
    objective: Optional[str] = 'reg:squarederror',
    booster: Optional[str] = None,
    tree_method: Optional[str] = None,
    n_jobs: Optional[int] = None,
    gamma: Optional[float] = None,
    min_child_weight: Optional[float] = None,
    max_delta_step: Optional[float] = None,
    subsample: Optional[float] = None,
    colsample_bytree: Optional[float] = None,
    colsample_bylevel: Optional[float] = None,
    colsample_bynode: Optional[float] = None,
    reg_alpha: Optional[float] = None,
    reg_lambda: Optional[float] = None,
    scale_pos_weight: Optional[float] = None,
    base_score: Optional[float] = None,
    missing: float = nan,
    num_parallel_tree: Optional[int] = None,
    monotone_constraints: Optional[Dict[str, int], str] = None,
    interaction_constraints: Optional[str, List[Tuple[str]]] = None,
    importance_type: Optional[str] = None,
    gpu_id: Optional[int] = None,
    validate_parameters: Optional[bool] = None,
    predictor: Optional[str] = None,
    enable_categorical: bool = False,
    use_label_encoder: bool = False,
    random_state: Optional[int] = None,
    verbosity: Optional[int] = 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/xgb.py#L342)

#### 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/xgb.py#L327)

#### method `fit`

```python
fit(X, y, *args, **kwargs) → 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/xgb.py#L390)

#### classmethod `load_dict`

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