Skip to main content
Version: 3.13

next_best_action

Python

### Import libraries

from ChannelAttributionPro import *

### Set your token

token="yourtoken"

### Load data

Data = pd.read_csv("https://app.channelattribution.io/data/Data.csv",sep=";")

### Train the model

Params=next_best_action_train(Data, var_path="path", var_conv="total_conversions", var_null="total_null", row_sep=";", cha_sep=">")

print(Params)

#Params is a data.frame containing all the conversion rates estimated using a combination of Markov models.
#Params can be stored and used to predict next best action given a path

### Predict next best action for a given path

new_path="beta > alpha"
res=next_best_action(new_path,sep=">",Params=Params)

print(res)

#res contains the suggested next action, its conversion rate and the conversion rates for all the available actions