sklearn skops tabular-classification region:us
---
library_name: sklearn
tags:
- sklearn
- skops
- tabular-classification
model_format: pickle
model_file: stroke_model.pkl
widget:
- structuredData:
    Residence_type_Rural:
    - true
    - true
    - false
    Residence_type_Urban:
    - false
    - false
    - true
    age:
    - 0.15771484375
    - 0.7802734375
    - 0.31640625
    avg_glucose_level:
    - 0.24563752192779986
    - 0.3366263502908319
    - 0.04413258240236362
    avg_glucose_level/bmi:
    - 0.35152096177583636
    - 0.18922222093200816
    - 0.12391183202584002
    bmi:
    - 0.10487444608567206
    - 0.35007385524372225
    - 0.1920236336779911
    ever_married_No:
    - true
    - false
    - true
    ever_married_Yes:
    - false
    - true
    - false
    gender_Female:
    - false
    - true
    - false
    gender_Male:
    - true
    - false
    - true
    gender_Other:
    - false
    - false
    - false
    heart_disease_No:
    - true
    - true
    - true
    heart_disease_Yes:
    - false
    - false
    - false
    hypertension_No:
    - true
    - true
    - true
    hypertension_Yes:
    - false
    - false
    - false
    smoking_status_Unknown:
    - false
    - false
    - false
    smoking_status_formerly smoked:
    - false
    - false
    - false
    smoking_status_never smoked:
    - true
    - false
    - false
    smoking_status_smokes:
    - false
    - true
    - true
    work_type_Govt_job:
    - false
    - false
    - false
    work_type_Never_worked:
    - false
    - false
    - false
    work_type_Private:
    - false
    - false
    - true
    work_type_Self-employed:
    - false
    - true
    - false
    work_type_children:
    - true
    - false
    - false
---

# Model description

The model is intended to be used to predict if a person is likely to get a stroke or not

## Intended uses & limitations

[More Information Needed]

## Training Procedure

[More Information Needed]

### Hyperparameters

<details>
<summary> Click to expand </summary>

| Hyperparameter          | Value               |
|-------------------------|---------------------|
| objective               | binary:logistic     |
| base_score              |                     |
| booster                 |                     |
| callbacks               |                     |
| colsample_bylevel       | 0.9076228511174643  |
| colsample_bynode        |                     |
| colsample_bytree        | 0.8045246933821307  |
| device                  |                     |
| early_stopping_rounds   |                     |
| enable_categorical      | False               |
| eval_metric             |                     |
| feature_types           |                     |
| gamma                   |                     |
| grow_policy             |                     |
| importance_type         |                     |
| interaction_constraints |                     |
| learning_rate           | 0.0711965541329635  |
| max_bin                 |                     |
| max_cat_threshold       |                     |
| max_cat_to_onehot       |                     |
| max_delta_step          |                     |
| max_depth               |                     |
| max_leaves              | 4                   |
| min_child_weight        | 0.27994747825685384 |
| missing                 | nan                 |
| monotone_constraints    |                     |
| multi_strategy          |                     |
| n_estimators            | 35                  |
| n_jobs                  |                     |
| num_parallel_tree       |                     |
| random_state            |                     |
| reg_alpha               | 0.0009765625        |
| reg_lambda              | 2.991485993669717   |
| sampling_method         |                     |
| scale_pos_weight        |                     |
| subsample               | 0.8073913094722203  |
| tree_method             |                     |
| validate_parameters     |                     |
| verbosity               |                     |

</details>

### Model Plot

<style>#sk-container-id-23 {color: black;}#sk-container-id-23 pre{padding: 0;}#sk-container-id-23 div.sk-toggleable {background-color: white;}#sk-container-id-23 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-23 label.sk-toggleable__label-arrow:before {content: "▸";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-23 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-23 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-23 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-23 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-23 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-23 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: "▾";}#sk-container-id-23 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-23 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-23 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-23 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-23 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-23 div.sk-parallel-item::after {content: "";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-23 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-23 div.sk-serial::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-23 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-23 div.sk-item {position: relative;z-index: 1;}#sk-container-id-23 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-23 div.sk-item::before, #sk-container-id-23 div.sk-parallel-item::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-23 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-23 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-23 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-23 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-23 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-23 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-23 div.sk-label-container {text-align: center;}#sk-container-id-23 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-23 div.sk-text-repr-fallback {display: none;}</style><div id="sk-container-id-23" class="sk-top-container" style="overflow: auto;"><div class="sk-text-repr-fallback"><pre>XGBClassifier(base_score=None, booster=None, callbacks=None,colsample_bylevel=0.9076228511174643, colsample_bynode=None,colsample_bytree=0.8045246933821307, device=None,early_stopping_rounds=None, enable_categorical=False,eval_metric=None, feature_types=None, gamma=None,grow_policy=None, importance_type=None,interaction_constraints=None, learning_rate=0.0711965541329635,max_bin=None, max_cat_threshold=None, max_cat_to_onehot=None,max_delta_step=None, max_depth=None, max_leaves=4,min_child_weight=0.27994747825685384, missing=nan,monotone_constraints=None, multi_strategy=None, n_estimators=35,n_jobs=None, num_parallel_tree=None, random_state=None, ...)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class="sk-container" hidden><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="sk-estimator-id-23" type="checkbox" checked><label for="sk-estimator-id-23" class="sk-toggleable__label sk-toggleable__label-arrow">XGBClassifier</label><div class="sk-toggleable__content"><pre>XGBClassifier(base_score=None, booster=None, callbacks=None,colsample_bylevel=0.9076228511174643, colsample_bynode=None,colsample_bytree=0.8045246933821307, device=None,early_stopping_rounds=None, enable_categorical=False,eval_metric=None, feature_types=None, gamma=None,grow_policy=None, importance_type=None,interaction_constraints=None, learning_rate=0.0711965541329635,max_bin=None, max_cat_threshold=None, max_cat_to_onehot=None,max_delta_step=None, max_depth=None, max_leaves=4,min_child_weight=0.27994747825685384, missing=nan,monotone_constraints=None, multi_strategy=None, n_estimators=35,n_jobs=None, num_parallel_tree=None, random_state=None, ...)</pre></div></div></div></div></div>

## Evaluation Results

| Metric   |   Value |
|----------|---------|
| accuracy |    0.78 |

### Confusion Matrix

![Confusion Matrix](confusion_matrix.png)

# How to Get Started with the Model

[More Information Needed]

# Model Card Authors

Alexander Lindström

# Model Card Contact

You can contact the model card authors through following channels:
[More Information Needed]

# Citation

Below you can find information related to citation.

**BibTeX:**
```
[More Information Needed]
```

# precision    recall  f1-score   support

     class 0       0.98      0.78      0.87       960
     class 1       0.18      0.76      0.29        62

    accuracy                           0.78      1022
   macro avg       0.58      0.77      0.58      1022
weighted avg       0.93      0.78      0.83      1022

| Metric   |   Value |
|----------|---------|
| accuracy |    0.78 |
