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.1.tar.gz (5.0 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.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for td_ml_auto_build_segments-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f377b4a2b0292d0a4571177293e06f4509a46280e34108ff97e2592e72639b63
MD5 4b3b7c2e9f961f6f9f3d7845cdb14541
BLAKE2b-256 ce6858fb3c7ad95baa0675cc32e718b8a072689f82723362835f6659c687feb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for td_ml_auto_build_segments-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 79b55e8a313dc28c09ee6dbf56db92a8dbb64cebb52f1910438b1b032ee0c147
MD5 063c9ed7ae088f26c867bfdbb981c498
BLAKE2b-256 c3c61aa83760da2b29d2f402908c2774723b9717dc44cfcab1f4271b980d2dd9

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