Get Features
The Features API provides features for ML Models across all types of demand causal factors, including attended events and non-attended events.
Last updated
The Features API provides features for ML Models across all types of demand causal factors, including attended events and non-attended events.
Last updated
© 2024 PredictHQ Ltd
Header | Value |
---|---|
Parameter | Description |
---|---|
Field | Description |
---|---|
PHQ Attendance features provide daily-level aggregated stats based on the number of people who we predict will attend events on a given day. This takes into account complications like distributing attendance across multi-day events.
We recommend using impact pattern features instead of generic features if you are in one of the supported industries. See #attended-events-impact-patterns.
Attended Events Generic Features
Use the generic features in this table if you are not in one of the industries covered by the impact pattern features listed below.
Attended Events Impact Pattern Features
Demand impact patterns model the impact of leading days (days before the event), lagging days (days after an event), and the days the event occurs. In the Features API, Impact Patterns are provided as different features with a feature per industry. We have impact pattern features for the accommodation, hospitality (which covers food & beverage including restaurants), and retail industries.
The features above are generic features and the features in the table below are the impact pattern features per industry. For example, if you were in the accommodation industry and wanted a feature for the conferences category you'd use phq_attendance_conferences_accommodation
.
We recommend using impact pattern features instead of generic features if you are in one of the supported industries. See Impact Patterns for more details.
You can configure PHQ Attendance features using the options below.
Other than the date, the structure of each result here will depend on how you configured the feature in your request and the type of feature.
You can receive responses formatted as JSON (default) or CSV. Use the Accept
header when performing your request to define which format you would like to receive.
With the Accept
header set to application/json
you will receive the results as JSON like the example below:
Below are some guides relevant to this API:
Feature | Description |
---|---|
Feature | Description |
---|---|
Field | Description |
---|---|
Feature | Description |
---|---|
Feature | Description |
---|---|
Field | Description |
---|---|
Feature | Description |
---|---|
Field | Description |
---|---|
Feature | Category | Industry |
---|---|---|
Feature | Description | Industry |
---|---|---|
Field | Description |
---|---|
Field | Description |
---|---|
Field | Description |
---|---|
Field | Description |
---|---|
Field | Description |
---|---|
Field | Description |
---|---|
Field | Description |
---|---|
date | phq_attendance_concerts_stats_count | phq_attendance_concerts_stats_sum | phq_attendance_conferences_stats_min | phq_attendance_conferences_stats_max | phq_attendance_sports_stats_count | phq_attendance_sports_stats_sum | phq_attendance_sports_stats_min | phq_attendance_sports_stats_max | phq_attendance_sports_stats_avg | phq_attendance_sports_stats_median | phq_attendance_sports_stats_std_dev | phq_rank_public_holidays_rank_levels_1 | phq_rank_public_holidays_rank_levels_2 | phq_rank_public_holidays_rank_levels_3 | phq_rank_public_holidays_rank_levels_4 | phq_rank_public_holidays_rank_levels_5 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Accept
Receive results in JSON or CSV by specifying the appropriate Accept
header.
Supported values:
application/json
text/csv
offset
number
The number of results to skip. The default is 0
.
E.g. ?offset=20
limit
number
The maximum number of results to return per page.
The default limit is 100
and the maximum per page is 100
.
E.g. ?limit=10
active
object
The date range to calculate features for. This is named "active" because it includes events that are active within the date range. A multi-day event might start or end outside the specified date range - the days the event is active within the specified range will be included in the calculations.
Supports the following fields:
gt
- greater than
gte
- greater than or equal
lt
- less than
lte
- less than or equal
Note that all dates here are in local time (not UTC). Features API works on specific locations.
Please also note that the maximum supported date range is 90 days. If you require features over a wider date range please make multiple API requests.
E.g.
beam
object
An optional beam
analysis object which if provided will calculate the location
, interval
, week_start_day
, phq_*
features including stats
and phq_rank
from the Beam analysis and optionally the Beam analysis group.
Supports the following fields:
analysis_id
- Beam analysis id (Required if beam
block is present in the request body)
group_id
- Beam analysis group id (Optional)
If beam.analysis_id
is provided, the location
, interval
, week_start_day
, phq_*
features includingstats
and phq_rank
will be calculated from the Beam analysis.
E.g.
If both beam.analysis_id
and beam.group_id
are provided, all the above fields will be calculated from the Beam analysis but the phq_*
features will be calculated from the Beam analysis Group.
Note: This is useful for when you want to request features for a variety of locations while maintaining feature consistency by limiting the returned features to those of the group's feature importance results.
E.g.
hour_of_day_start
object
Time range (per day) to calculate features for.
Note: This field is currently only supported on phq_viewership_*
features.
If your location only operates within certain hours of the day you can use this filter to only include records that are happening within those hours.
Supports the following fields:
gt
- greater than
gte
- greater than or equal
lt
- less than
lte
- less than or equal
The values are hours between 0 and 23 (i.e. 24h format).
E.g. only include events happening between 1pm and 3pm each day.
location
object
Location to calculate features for. You can specify the location as a latitude/longitude (with radius), Place ID(s) or Saved Location ID(s).
We recommend using a lat/lon+radius or a saved location id (for a point and radius location) as they could define the location of your interest more accurately. To work out a suitable radius around your location we strongly recommend using our Suggested Radius API.
Note: When using Place IDs or Saved Location IDs a maximum of 3 IDs may be used.
Note: When using lat/lon+radius, the radius must be in the format <radius><radius_unit>
, where <radius>
is an integer or a float number up to 2 decimal places and <radius_unit>
is one of:
m
- meters
km
- kilometers
ft
- feet
mi
- miles
E.g. using Place IDs:
E.g. using Saved Location IDs:
E.g. using a latitude/longitude and radius (recommended):
interval
string
optional
Aggregation interval. Possible values:
day
(default) for daily aggregation
week
for weekly aggregation
week_start_day
string
optional
The weekday to be treated as the start of the week.
Possible values:
monday
(default)
tuesday
wednesday
thursday
friday
saturday
sunday
Only applicable when interval
is set to week
.
<feature_name>
object or boolean
The name of the feature you're requesting. You can request multiple features in a single request.
Features can be further configured here, or you can set the value as true
to perform the default calculations for that feature.
Please see the tables below for a list of all currently supported features and how they can be further configured.
E.g. requesting certain stats fields and filtering for records with a PHQ Rank over 50.
E.g. requesting the default calculations for a feature.
phq_attendance_academic_graduation
Academic - Graduation
phq_attendance_academic_social
Academic - Social
phq_attendance_community
Community
phq_attendance_concerts
Concerts
phq_attendance_conferences
Conferences
phq_attendance_expos
Expos
phq_attendance_festivals
Festivals
phq_attendance_performing_arts
Performing Arts
phq_attendance_sports
Sports
phq_attendance_school_holidays
School Holidays
phq_attendance_community_accommodation
Community accommodation impact
phq_attendance_concerts_accommodation
Concerts accommodation impact
phq_attendance_conferences_accommodation
Conferences accommodation impact
phq_attendance_expos_accommodation
Expos accommodation impact
phq_attendance_festivals_accommodation
Festivals accommodation impact
phq_attendance_performing_arts_accommodation
Performing Arts accommodation impact
phq_attendance_sports_accommodation
Sports accommodation impact
phq_attendance_community_hospitality
Community hospitality impact
phq_attendance_concerts_hospitality
Concerts hospitality impact
phq_attendance_conferences_hospitality
Conferences hospitality impact
phq_attendance_expos_hospitality
Expos hospitality impact
phq_attendance_festivals_hospitality
Festivals hospitality impact
phq_attendance_performing_arts_hospitality
Performing Arts hospitality impact
phq_attendance_sports_hospitality
Sports hospitality impact
phq_attendance_community_retail
Community Retail impact
phq_attendance_concerts_retail
Concerts Retail impact
phq_attendance_conferences_retail
Conferences Retail impact
phq_attendance_expos_retail
Expos Retail impact
phq_attendance_festivals_retail
Festivals Retail impact
phq_attendance_performing_arts_retail
Performing Arts Retail impact
phq_attendance_sports_retail
Sports Retail impact
stats
object
optional
You can optionally configure which fields are calculated for each of these features by providing the list of stats
fields you would like.
Default fields are count
and sum
.
Supported fields are:
count
sum
min
max
avg
median
std_dev
E.g.
phq_rank
object
optional
Filter for events with a PHQ Rank within a certain range.
Supports the following fields:
gt
- greater than
gte
- greater than or equal
lt
- less than
lte
- less than or equal
E.g.
local_rank
object
optional
Filter for events with a Local Rank within a certain range.
Supports the following fields:
gt
- greater than
gte
- greater than or equal
lt
- less than
lte
- less than or equal
E.g.
phq_rank_observances
Observances
phq_rank_public_holidays
Public Holidays
phq_rank_school_holidays
School Holidays
phq_rank_academic_session
Academic - Session
phq_rank_academic_exam
Academic - Exam
phq_rank_academic_holiday
Academic - Holiday
phq_rank_daylight_savings
Daylight savings
phq_rank_health_warnings
Health Warnings
phq_rank_politics
Politics
phq_spend_conferences
Conferences
phq_spend_expos
Expos
phq_spend_sports
Sports
phq_spend_community
Community
phq_spend_concerts
Concerts
phq_spend_festivals
Festivals
phq_spend_performing_arts
Performing Arts
phq_spend_conferences_accommodation
Conferences - Accommodation
phq_spend_expos_accommodation
Expos - Accommodation
phq_spend_sports_accommodation
Sports - Accommodation
phq_spend_community_accommodation
Community - Accommodation
phq_spend_concerts_accommodation
Concerts - Accommodation
phq_spend_festivals_accommodation
Festivals - Accommodation
phq_spend_performing_arts_accommodation
Performing Arts - Accommodation
phq_spend_conferences_hospitality
Conferences - Hospitality
phq_spend_expos_hospitality
Expos - Hospitality
phq_spend_sports_hospitality
Sports - Hospitality
phq_spend_community_hospitality
Community - Hospitality
phq_spend_concerts_hospitality
Concerts - Hospitality
phq_spend_festivals_hospitality
Festivals - Hospitality
phq_spend_performing_arts_hospitality
Performing Arts - Hospitality
phq_spend_conferences_transportation
Conferences - Transportation
phq_spend_expos_transportation
Expos - Transportation
phq_spend_sports_transportation
Sports - Transportation
phq_spend_community_transportation
Community - Transportation
phq_spend_concerts_transportation
Concerts - Transportation
phq_spend_festivals_transportation
Festivals - Transportation
phq_spend_performing_arts_transportation
Performing Arts - Transportation
stats
object
optional
You can optionally configure which fields are calculated for each of these features by providing the list of stats
fields you would like.
Default fields are count
and sum
.
Supported fields are:
count
sum
min
max
avg
median
std_dev
E.g.
phq_rank
object
optional
Filter for events with a PHQ Rank within a certain range.
Supports the following fields:
gt
- greater than
gte
- greater than or equal
lt
- less than
lte
- less than or equal
E.g.
local_rank
object
optional
Filter for events with a Local Rank within a certain range.
Supports the following fields:
gt
- greater than
gte
- greater than or equal
lt
- less than
lte
- less than or equal
E.g.
phq_viewership_sports
Sports - (All)
phq_viewership_sports_american_football
American Football - (All)
phq_viewership_sports_american_football_ncaa_men
American Footbal - NCAA Men's
phq_viewership_sports_american_football_nfl
American Football - NFL
phq_viewership_sports_auto_racing
Automotive Racing - All
phq_viewership_sports_auto_racing_indy_car
Automotive Racing - Indy Car
phq_viewership_sports_auto_racing_nascar
Automotive Racing - NASCAR
phq_viewership_sports_baseball
Baseball - (All)
phq_viewership_sports_baseball_mlb
Baseball - MLB
phq_viewership_sports_baseball_ncaa_men
Baseball - NCAA Men's
phq_viewership_sports_basketball
Basketball - (All)
phq_viewership_sports_basketball_nba
Basketball - NBA
phq_viewership_sports_basketball_ncaa_men
Basketball - NCAA Men's
phq_viewership_sports_basketball_ncaa_women
Basketball - NCAA Women's
phq_viewership_sports_boxing
Boxing - (All)
phq_viewership_sports_golf
Golf - (All)
phq_viewership_sports_golf_masters
Golf - Masters
phq_viewership_sports_golf_pga_championship
Golf - PGA Championships
phq_viewership_sports_golf_pga_tour
Golf - PGA Tours
phq_viewership_sports_golf_us_open
Golf - US Open
phq_viewership_sports_horse_racing
Horse Racing - (All)
phq_viewership_sports_horse_racing_belmont_stakes
Horse Racing - Belmont Stakes
phq_viewership_sports_horse_racing_kentucky_derby
Horse Racing - Kentucky Derby
phq_viewership_sports_horse_racing_preakness_stakes
Horse Racing - Preakness Stakes
phq_viewership_sports_ice_hockey
Ice Hockey - (All)
phq_viewership_sports_ice_hockey_nhl
Ice Hockey - NHL
phq_viewership_sports_mma
Mixed Martial Arts - (All)
phq_viewership_sports_mma_ufc
Mixed Martial Arts - UFC
phq_viewership_sports_soccer
Soccer - (All)
phq_viewership_sports_soccer_concacaf_champions_league
Soccer - CONCACAF Champions League
phq_viewership_sports_soccer_concacaf_gold_cup
Soccer - CONCACAF Gold Cup
phq_viewership_sports_soccer_copa_america_men
Soccer - COPA America Men's
phq_viewership_sports_soccer_fifa_world_cup_women
Soccer - FIFA World Cup Women's
phq_viewership_sports_soccer_fifa_world_cup_men
Soccer - FIFA World Cup Men's
phq_viewership_sports_soccer_mls
Soccer - MLS
phq_viewership_sports_soccer_uefa_champions_league_men
Soccer - UEFA Champions League Men's
phq_viewership_sports_softball
Softball - (All)
phq_viewership_sports_softball_ncaa_women
Softball - NCAA Women's
phq_viewership_sports_tennis
Tennis - (All)
phq_viewership_sports_tennis_us_open
Tennis - US Open
phq_viewership_sports_tennis_wimbledon
Tennis - Wimbledon
stats
object
optional
You can optionally configure which fields are calculated for each of these features by providing the list of stats
fields you would like.
Default fields are count
and sum
.
Supported fields are:
count
sum
min
max
avg
median
std_dev
E.g.
phq_rank
object
optional
Filter for events with a PHQ Rank within a certain range.
Supports the following fields:
gt
- greater than
gte
- greater than or equal
lt
- less than
lte
- less than or equal
E.g.
local_rank
object
optiona
Filter for events with a Local Rank within a certain range.
Supports the following fields:
gt
- greater than
gte
- greater than or equal
lt
- less than
lte
- less than or equal
E.g.
phq_impact_public_holidays_accommodation
Public holidays
Accomodation
phq_impact_observances_accommodation
Observances
Accomodation
phq_impact_public_holidays_retail
Public holidays
Retail
phq_impact_observances_retail
Observances
Retail
phq_impact_public_holidays_hospitality
Public holidays
Hospitality/Food & Beverage*
phq_impact_observances_hospitality
Observances
Hospitality/Food & Beverage
phq_impact_severe_weather_air_quality_retail
Severe Weather - Air Quality
Retail
phq_impact_severe_weather_blizzard_retail
Severe Weather - Blizzard
Retail
phq_impact_severe_weather_cold_wave_retail
Severe Weather - Cold Wave - (All)
Retail
phq_impact_severe_weather_cold_wave_snow_retail
Severe Weather - Cold Wave - Snow
Retail
phq_impact_severe_weather_cold_wave_storm_retail
Severe Weather - Cold Wave - Storm
Retail
phq_impact_severe_weather_dust_retail
Severe Weather - Dust - (All)
Retail
phq_impact_severe_weather_dust_storm_retail
Severe Weather - Dust - Storm
Retail
phq_impact_severe_weather_flood_retail
Severe Weather - Flood
Retail
phq_impact_severe_weather_heat_wave_retail
Severe Weather - Heat Wave
Retail
phq_impact_severe_weather_hurricane_retail
Severe Weather - Hurricane
Retail
phq_impact_severe_weather_thunderstorm_retail
Severe Weather - Thunderstorm
Retail
phq_impact_severe_weather_tornado_retail
Severe Weather - Tornado
Retail
phq_impact_severe_weather_tropical_storm_retail
Severe Weather - Tropical Storm
Retail
stats
object
optional
You can optionally configure which fields are calculated for each of these features by providing the list of stats
fields you would like.
Default fields are count
and sum
.
Supported fields are:
count
sum
min
max
avg
median
std_dev
E.g.
phq_rank
object
optional
Filter for events with a PHQ Rank within a certain range.
Supports the following fields:
gt
- greater than
gte
- greater than or equal
lt
- less than
lte
- less than or equal
E.g.
local_rank
object
optional
Filter for events with a Local Rank within a certain range.
Supports the following fields:
gt
- greater than
gte
- greater than or equal
lt
- less than
lte
- less than or equal
E.g.
results
array
List of results where each item is a Feature.
Please refer to the Feature Response Fields section below for the structure of each record. Note that pagination is not required in this API.
date
string
Date in local time.
E.g. 2023-10-01
<phq_attendance_*>
object
Daily-level feature result. The structure of the result here will depend on how you configured the feature in your request.
PHQ Attendance features are stats-based.
Default fields are count
and sum
.
E.g.
date
string
Date in local time.
E.g. 2023-10-01
<phq_rank_*>
object
Daily-level feature result. The structure of the result here is always the same as PHQ Rank features cannot currently be configured.
Will contain a rank_levels
field which indicates the sum of matching events active on the date at each PHQ Rank level.
PHQ Rank is on a scale of 0 to 100 and the levels are bucketed as:
1
- Minor (rank between 0 and 20).
2
- Moderate (rank between 21 and 40).
3
- Important (rank between 41 and 60).
4
- Significant (rank between 61 and 80).
5
- Major (rank between 81 and 100).
E.g.
date
string
Date in local time.
E.g. 2023-10-01
<phq_spend_*>
object
Daily-level feature result. The structure of the result here will depend on how you configured the feature in your request.
PHQ Spend features are stats-based.
Default fields are count
and sum
.
E.g.
date
string
Date in local time.
E.g. 2023-10-01
<phq_viewership_*>
object
Daily-level feature result. The structure of the result here will depend on how you configured the feature in your request.
PHQ Viewership features are stats-based.
Default fields are count
and sum
.
E.g.
date
string
Date in local time.
E.g. 2023-10-01
<phq_impact_*>
object
Daily-level feature result. The structure of the result here will depend on how you configured the feature in your request.
PHQ Impact features are stats-based.
Default fields are count
and sum
.
E.g.
2019-11-16
43
24546
11
1000
0
0
0
0
0.0
0.0
2019-11-17
25
13440
11
146
0
0
0
0
0.0
0.0
2019-11-18
6
2021
11
700
0
0
0
0
0.0
0.0
2019-11-19
10
6047
11
171000
0
0
0
0
0.0
0.0
2019-11-20
14
59704
11
171000
0
0
0
0
0.0
0.0
2019-11-21
21
60851
11
171000
0
0
0
0
0.0
0.0
2019-11-22
35
25760
11
171000
0
0
0
0
0.0
0.0
2019-11-23
29
25425
11
394
0
0
0
0
0.0
0.0
2019-11-24
18
23410
11
500
0
0
0
0
0.0
0.0
2019-11-25
6
5122
11
1000
1
18064
18064
18064
18064.0
18064.0
0.0
2019-11-26
8
6861
11
1000
0
0
0
0
0.0
0.0
2019-11-27
12
6225
11
500
1
18064
18064
18064
18064.0
18064.0
0.0