Skip to main content

TD Auto Build Segments in Audience Studio

Project description

ml-auto-build-segments

Introduction

This Python Library allows you to automatically add attributes to Parent Segment in Treasure Data and Auto-build Folders and Segments in Audience Studio.

Inputs

  • config/auto_build.yml : This is the .yaml config file that defines the params for the Python functions that add new tables to Parent Segment via API, and use the column_name where main_attr: yes param flags which attribute will be used for the segment creation rules. Example config/auto_build.yml file with notes on each param below:
#####################################################################
########################## GLOBAL PARAMS ############################
#####################################################################
sink_database: ml_db                        #database where all model output tables will be saved
unique_user_id: td_canonical_id             #the main join key that will be used to join behaviors tables to customers table      
api_endpoint: 'https://api.treasuredata.com'
ps_name: 'ENTER PS NAME'                 #name of Parent Segment where ML Folders & Audiences will be built
v5_flag: 1                                  #indicate if you want to build Segments in V5 or V4
folder_depth: 10                            #determines how deeply into nested folders in Audience Studio the code will scan to find the Segments you want 
ps_stats_table: 'ps_stats'                  #stores list of all PS, Folders, and Segments in given 

######### Params for new attributes to add to PS #####
src_table:                                  #params for ML Model output table to be added to PS and used for Audience Creation
  name: next_best_product_final
  join_key: td_canonical_id
  cols:                                     #list of columns from src_table to be added to PS as attributes
    - name: nbp_helmets
      type: number
      build_segments: yes                   #if = 'yes', this column is used as the attribute value for building auto segments               
    - name: next_best_product
      type: string
      build_segments: yes                   #if = 'yes', this column is used as the attribute value for building auto segments

########## Auto Build Segment Params ############
rerun_ps: yes                             #if = 'yes', ps will be re-run after the ML model table is added to PS
ml_folder: '[ML] Base Audiences'          #name of Base Folder where all ML Model Audiences will be created
sub_folder: 'Auto-Segmentation'           #name of Sub-Folder where specific Audiences to current WF ML Model will be added
attr_group: 'ML Models'                  #name of Attribute Group where attributes added to Parent Segment will be grouped in Audience Studio

Copyright © 2022 Treasure Data, Inc. (or its affiliates). All rights reserved

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

td_ml_auto_build_segments-0.1.2.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

td_ml_auto_build_segments-0.1.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file td_ml_auto_build_segments-0.1.2.tar.gz.

File metadata

File hashes

Hashes for td_ml_auto_build_segments-0.1.2.tar.gz
Algorithm Hash digest
SHA256 28ff8e72c74c5257bfb8c2fd29b171636c9c5d958a7d5fdcc094534f59654477
MD5 a33c0b4d4313b967c80ac804227f889b
BLAKE2b-256 fc3cbf81f97c1e083fccb439991f6f87e86a926be78724b0b3c0431d49046cb5

See more details on using hashes here.

File details

Details for the file td_ml_auto_build_segments-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for td_ml_auto_build_segments-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 77c26a585def0f6d19effa4a789e6a02729a1207d62782478834e2e49f674604
MD5 6368805a3d7bb3017b257626f473125e
BLAKE2b-256 9fb6dafa14ae117bc44b66aa400337fd0b3a75ef1c2b90360533549083f1f5b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page