Skip to main content

choose_order Python Code

Python

#Load library and data

import pandas as pd

from ChannelAttributionPro import *

import urllib.request

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

password="yourpassword"

#choose the best Markov model using AUC reading data from a data.frame

res=choose_order(Data, var_path="path", var_conv="total_conversions",
var_null="total_null", plot=0, cha_sep=">",password=password)
print(res['suggested_order'])

#choose the best Markov model using AUC reading data from a file

res=choose_order(Data="Data.csv", var_path="path", var_conv="total_conversions",
var_null="total_null", cha_sep=">", row_sep=";", plot=0, password=password)
print(res['suggested_order'])

#choose the best Markov model using Area under Precision-Recall Curve

res=choose_order(Data="Data.csv", var_path="path", var_conv="total_conversions",
var_null="total_null", cha_sep=">", row_sep=";", type='auc-prerec',
plot=0, password=password)
print(res['suggested_order'])