Get Feature Importance

Get feature importance data for an analysis.

This endpoint provides feature importance test results for an existing analysis, and returns a list of feature groups with associated Features API features and group p-values.

These values represent each group of features' statistical significance when it comes to impacting observable incremental/decremental changes in demand.

Request

HTTP Request

GET https://api.predicthq.com/v1/beam/analyses//feature-importance

Path Parameters

Parameter
Description

analysis_id

An existing Beam Analysis ID.

Response

Response Fields

Field
Description

feature_importance array

List of Feature Importance groups. Please refer to the Feature Importance Response Fields section below for the structure of each record.

Feature Importance Response Fields

Field
Description

feature_group string

The name of the group. This typically refers to an event category. E.g. severe-weather, concerts

features array

The names of the features in the feature group. These refer directly to features available in Features API.

E.g.

{
  "features": ["phq_attendance_concerts"]
}

p_value float

The p-value associated with this feature group for this analysis. It indicates how important the features in the group are in terms of demand. The lower the p-value, the more important the feature group is. E.g. 0.312

important boolean

A true of false value indicating whether the feature group is considered important for this analysis. Equivalent to p_value < 0.1 We suggest using this value to determine whether or not to include this group of features in your modeling.

Example response

Below is an example response:

{
    "feature_importance": [
        {
            "feature_group": "expos",
            "features": [
                "phq_attendance_expos"
            ],
            "p_value": 0.0,
            "important": true
        },
        {
            "feature_group": "school-holidays",
            "features": [
                "phq_attendance_school_holidays"
            ],
            "p_value": 0.0,
            "important": true
        },
        {
            "feature_group": "concerts",
            "features": [
                "phq_attendance_concerts"
            ],
            "p_value": 0.0002,
            "important": true
        },
        {
            "feature_group": "sports",
            "features": [
                "phq_attendance_sports"
            ],
            "p_value": 0.0039,
            "important": true
        },
        {
            "feature_group": "severe-weather",
            "features": [
                "phq_impact_severe_weather_air_quality_retail",
                "phq_impact_severe_weather_blizzard_retail",
                "phq_impact_severe_weather_cold_wave_retail",
                "phq_impact_severe_weather_cold_wave_snow_retail",
                "phq_impact_severe_weather_cold_wave_storm_retail",
                "phq_impact_severe_weather_dust_retail",
                "phq_impact_severe_weather_dust_storm_retail",
                "phq_impact_severe_weather_flood_retail",
                "phq_impact_severe_weather_heat_wave_retail",
                "phq_impact_severe_weather_hurricane_retail",
                "phq_impact_severe_weather_thunderstorm_retail",
                "phq_impact_severe_weather_tornado_retail",
                "phq_impact_severe_weather_tropical_storm_retail"
            ],
            "p_value": 0.1523,
            "important": false
        }
    ]
}

Examples

curl -X GET "https://api.predicthq.com/v1/beam/analyses/$ANALYSIS_ID/feature-importance" \
     -H "Accept: application/json" \
     -H "Authorization: Bearer $ACCESS_TOKEN"

Guides

Below are some guides relevant to this API:

Last updated

© 2024 PredictHQ Ltd