# Get Feature Importance

{% hint style="info" %}
The easiest way to get these ML features from our Features API to be used in your models is by using the Beam `analysis_id` in your Features API request.
{% endhint %}

## Get Feature Importance

> This endpoint provides the relevant ML features (based on feature importance testing) that are shown to impact \
> the demand for the Beam Analysis. These are the features you should take into your forecasting model to improve \
> your model accuracy.\
> \
> These values represent each group of features' statistical significance when it comes to impacting observable \
> incremental/decremental changes in demand.\
> \
> The easiest way to get these ML features from our Features API to be used in your models is by using the Beam \
> \`analysis\_id\` in your Features API request.

```json
{"openapi":"3.1.0","info":{"title":"PredictHQ Beam API","version":"1.0.0"},"tags":[{"name":"Analyses"}],"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/analyses/{analysis_id}/feature-importance":{"get":{"operationId":"get_analysis_feature_importance","summary":"Get Feature Importance","description":"This endpoint provides the relevant ML features (based on feature importance testing) that are shown to impact \nthe demand for the Beam Analysis. These are the features you should take into your forecasting model to improve \nyour model accuracy.\n\nThese values represent each group of features' statistical significance when it comes to impacting observable \nincremental/decremental changes in demand.\n\nThe easiest way to get these ML features from our Features API to be used in your models is by using the Beam \n`analysis_id` in your Features API request.","parameters":[{"name":"analysis_id","in":"path","description":"An existing Beam Analysis ID.","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 not found or no feature importance data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPError"}}}}},"tags":["Analyses"]}}}}
```

## Examples

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

```bash
curl -X GET "https://api.predicthq.com/v1/beam/analyses/$ANALYSIS_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/analyses/<analysis_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).

## Guides

Below are some guides relevant to this API:

* [Beam Guides](/getting-started/guides/beam-guides.md)


---

# 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/analyses/get-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.
