# Get Feature Importance for an Analysis Group

This endpoint provides Feature Importance results aggregated across the Analyses in an existing Analysis Group, and returns a list of feature groups with associated Features API features and group p-values.

## Get Feature Importance for an Analysis Group

> This endpoint provides Feature Importance results aggregated across the Analyses in an existing Analysis Group, and returns a list of feature groups with associated Features API features and group p-values.

```json
{"openapi":"3.1.0","info":{"title":"PredictHQ Beam API","version":"1.0.0"},"tags":[{"name":"Analysis Groups"}],"servers":[{"url":"https://api.predicthq.com"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"$API_KEY","description":"Enter your PredictHQ API key. The Bearer prefix is added automatically.\n\nWhen calling the API directly, send: `Authorization: Bearer <YOUR_API_KEY>` as documented at [https://docs.predicthq.com/api/overview/authenticating](https://docs.predicthq.com/api/overview/authenticating)\n"}},"schemas":{"FeatureImportanceResponse":{"type":"object","properties":{"feature_importance":{"description":"A list of feature groups ranked by their statistical significance to the analysis demand data.","type":"array","items":{"$ref":"#/components/schemas/FeatureGroup"},"title":"Feature Importance"}},"title":"FeatureImportanceResponse"},"FeatureGroup":{"type":"object","properties":{"feature_group":{"description":"The name of the group. This typically aligns to an event category.","type":"string","title":"Feature Group"},"features":{"description":"The names of the features in the feature group. These refer directly to features available in Features API.","type":"array","items":{"type":"string"},"title":"Features"},"p_value":{"description":"The p-value associated with this feature group for this analysis.\nIt indicates how important the features in the group are\nin terms of demand. The lower the p-value, the more important the feature group is.","type":"number","title":"P Value"},"important":{"description":"A true or false value indicating whether the feature group is considered important for this analysis.\nEquivalent to `p_value`\n< 0.1. We suggest using this value to determine whether or not to include this group of features in your modeling.","type":"boolean","title":"Important"}},"required":["feature_group","features","p_value","important"],"title":"FeatureGroup"},"HTTPError":{"type":"object","properties":{"error":{"description":"A human-readable error message.","type":"string","title":"Error"}},"required":["error"],"title":"HTTPError"}}},"paths":{"/v1/beam/analysis-groups/{group_id}/feature-importance":{"get":{"operationId":"get_analysis_group_feature_importance","summary":"Get Feature Importance for an Analysis Group","description":"This endpoint provides Feature Importance results aggregated across the Analyses in an existing Analysis Group, and returns a list of feature groups with associated Features API features and group p-values.","parameters":[{"name":"group_id","in":"path","description":"An Analysis Group ID. Analyses that belong to this group will be returned.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeatureImportanceResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPError"}}}},"403":{"description":"Bearer token scope insufficient","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPError"}}}},"404":{"description":"Analysis Group not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPError"}}}}},"tags":["Analysis Groups"]}}}}
```

## Examples

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

```bash
curl -X GET "https://api.predicthq.com/v1/beam/analysis-groups/$GROUP_ID/feature-importance" \
     -H "Accept: application/json" \
     -H "Authorization: Bearer $ACCESS_TOKEN"
```

{% endtab %}

{% tab title="python" %}

```python
import requests

response = requests.get(
    url="https://api.predicthq.com/v1/beam/analysis-groups/$GROUP_ID/feature-importance",
    headers={
      "Authorization": "Bearer $ACCESS_TOKEN",
      "Accept": "application/json"
    }
)

print(response.json())
```

{% endtab %}
{% endtabs %}

## OpenAPI Spec

The OpenAPI spec for Beam API can be [found here](https://api.predicthq.com/docs/?urls.primaryName=Beam+API).


---

# 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.predicthq.com/api/beam/analysis-groups/get-aggregated-feature-importance.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.
