> For the complete documentation index, see [llms.txt](https://docs.autogon.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.autogon.ai/autogon-engine-studio/machine-learning/shap-explain-ml_shap.md).

# Shap Explain (ML\_SHAP)

Shap (SHapley Additive exPlanations) is an Explainable AI (XAI) method that provides interpretable insights into the predictions made by a logistic regression model. It allows us to understand the contribution of each independent variable in determining the probability of a binary outcome (e.g., Yes/No, True/False).&#x20;

Shap values help to uncover the impact of individual features on the model's predictions, enhancing transparency and facilitating model evaluation and decision-making.

## Sample Request

Perform model analysis using SHAP (SHapley Additive exPlanations) on a specific model named "RandomForest."

```javascript
{
    "project_id": 13,
    "parent_id": 3,
    "block_id": 4,
    "function_code": "ML_SHAP",
    "args": {
        "model_name": "RandomForest"
    }
}
```

## Shap Explain

<mark style="color:green;">`POST`</mark> `https://autogon.ai/api/v1/engine/start`

#### Request Body

| Name                                             | Type   | Description                                           |
| ------------------------------------------------ | ------ | ----------------------------------------------------- |
| project\_id<mark style="color:red;">\*</mark>    | int    | ID of the current project                             |
| parent\_id<mark style="color:red;">\*</mark>     | int    | ID of the previous block                              |
| block\_id<mark style="color:red;">\*</mark>      | int    | ID of the current block                               |
| function\_code<mark style="color:red;">\*</mark> | String | Function code for the current block                   |
| model\_name<mark style="color:red;">\*</mark>    | String | Name of the pre-trained model to be used for analysis |

{% tabs %}
{% tab title="200: OK StateManagement object" %}

```javascript
{
    "status": "true",
    "message": {
        "id": 1,
        "project": 12,
        "block_id": 10,
        "parent_id": 11,
        "dataset_url": "",
        "x_value_url": "",
        "y_value_url": "",
        "x_train_url": "",
        "y_train_url": "",
        "x_test_url": "",
        "y_test_url": "",
        "output": "{'confusion_matrix': '', 'accuracy': 0.9}"
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Python" %}

```
// Some code
```

{% endtab %}

{% tab title="Node" %}

```javascript
const project_id = 1
const parent_id = 7
const block_id = 8
    
LogisticRegressionMetrics= await client.logistic_regression_metrics(project_id, parent_id, block_id, {
    model_name: "SimpleModel",

});
```

{% endtab %}
{% endtabs %}


---

# 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 dynamically by asking a question.

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

```
GET https://docs.autogon.ai/autogon-engine-studio/machine-learning/shap-explain-ml_shap.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.
