Feature Tables
This page is under construction.
![../_images/UnderConstruction.jpg](../_images/UnderConstruction.jpg)
In addition to the ones in Identity Stitching, a Feature Table YAML contains the following keys:
features
tablevar
macro
feature
features
The key with which you assign the values for creating a feature table. A list of features can be defined, with each feature having multiple tablevar and/or macro.
tablevar
Here you define the source data, along with any conditions.
name
This is the name in which you’ll store the retrieved data.
table
The source table in DW from which data is to be fetched.
filter
In case you want to apply any conditions for fetching data (same as where clause in SQL).
value
The data that will be stored in the name
.
description
Optional, a textual description of what it does.
Note
You can have more than one tablevar
, for defining a feature.
Here are a few tablevar
examples:
name: is_mql_tablevar
table: salesForceLeadsTable
value: max(case when salesForceLeadsTable.mql__c == 'True' then 1 else 0 end)
name: blacklistFlag
table: blacklistDomains
filter: (context_sources_job_run_id = (select top 1 context_sources_job_run_id from blacklistDomains order by timestamp desc))
value: max(case when exclude_reason is not null then 1 else 0 end)
name: domainSummary_account_type
table: domainSummary
value: domainSummary.account_type
name: salesCallEventTime
table: salesforceTasks
value: min(activitydate)
filter: macro(call_conversion)
name: salesEvents
table: salesforceTasks
value: json_agg(activitydate, case when (type='Email' or tasksubtype = 'Email') then case when lower(subject) like '%[in]%' then 'sf_inbound_email' \
else 'sf_outbound_email' end when macro(call_conversion) then 'sf_call' else null end as event)
description: Salesforce touches are converted to one of following events - sf_inbound_email, sf_outbound_email, sf_call, null
name: page_events_var
table: websitePageVisits
filter: timestamp < sales_conversion_timestamp and timestamp > var('start_date')
value: json_agg(timestamp, case when split_part(trim(context_page_path, '/'), '/', 1) in var('valid_page_paths') then split_part(trim(context_page_path, '/'), '/', 1) \
else var('default_page_path') end as event)
name: webhookFormSubmit
table: webhookSource
filter: variable_1 is null and timestamp < sales_conversion_timestamp and timestamp > var('start_date')
value: min(timestamp)
macro
An optional section, in case you wish to perform a computation and store in a variable, to be referenced by a tablevar
.
name
The name in which you will store the calculated data.
value
Regular expression or SQL clause to calculate the value.
This section, if defined, proceedes tablevar
.
Here is an example:
name: call_conversion
value: type = 'Call' or tasksubtype='Call' or type like '%demo%') and \
(rlike(lower(subject), '.*\\bcall\\b.*') or rlike(lower(subject), '.*\\bdemo\\b.*'
feature
This is the computed feature.
name
Define a name for the feature.
value
The value that will be stored in the feature. It can be same as a tablevar
or any aggregation applied on it. You can refer multiple tablevar
or a macro
.
description
Optional, a textual description of what the feature does.
Here are a few examples:
name: is_mql
value: is_mql_tablevar
description: Whether a domain is mql or not
name: ignore_domain
value: max(case when blacklistFlag = 1 or domainSummary_account_type like '%free%' then 1 else 0 end)
description: Whether a domain should be ignored for the analysis
name: sales_conversion_timestamp
value: salesCallEventTime
name: page_events
value: page_events_var
name: formSubmit
value: min(webhookFormSubmit, websiteFormSubmit)
Other changes
As we are creating a Feature Table, set the value of resource_type to feature_table_model
.
resource_type: feature_table_model
Code Examples
See Feature table sample.
Feature Tables ML
Models from ML Notebooks
You can take ML Notebooks in Jupyter and add ML/AI capabilities to it.
Feature Tables External
Integration with DBT
WHT supports DBT models so that customers on that platform can quickly start using the tool. Though WHT also does transformation like DBT, it empowers users who are already more comfortable in that platform.