data_folder = r"O:\MODULES_PA/PYTHON_API/MY_PREDICTIONS"
input_file = "AUTO_CLAIMS_NEW.csv"
output_file = "CLAIMS_PREDICTIONS.csv"
input_store = model.openNewStore("Kxen.FileStore", data_folder, "", "")
model.newDataSet("ApplyIn", input_file, input_store)
output_store = model.openNewStore("Kxen.FileStore", data_folder, "", "")
model.newDataSet("ApplyOut", output_file, output_store)
t = model.getTransformInProtocol("Default", 0)
t.getParameter("")
t.changeParameter("Parameters/ExtraMode", "Decision")
# t.changeParameter("Parameters/ExtraMode", "Individual Contributions")
# t.changeParameter("Parameters/ExtraMode", "Quantiles")
t.validateParameter()
model.sendMode(aalib.Kxen_apply, 0)
import pandas as pd
df = pd.read_csv(data_folder + "\\" + output_file, header=0)
df.head(7)
data_folder = r"O:\MODULES_PA/PYTHON_API/MY_PREDICTIONS"
input_file = "AUTO_CLAIMS_NEW.csv"
output_file = "CLAIMS_PREDICTIONS_ADV.csv"
input_store = model.openNewStore("Kxen.FileStore", data_folder, "", "")
model.newDataSet("ApplyIn", input_file, input_store)
output_store = model.openNewStore("Kxen.FileStore", data_folder, "", "")
model.newDataSet("ApplyOut", output_file, output_store)
t = model.getTransformInProtocol("Default", 0)
t.getParameter("")
t.changeParameter("Parameters/ExtraMode", "Advanced Apply Settings")
t.validateParameter()
target_col = "is_fraud"
d_path = "Protocols/Default/Transforms/Kxen.RobustRegression/Parameters/ApplySettings/Supervised/%s" % target_col
model.getParameter("")
settings = model.getParameter(d_path)
# Decision
flag = settings.getSubParameter("PredictedRankCategories")
flag.removeAll()
flag.insert("1")
# Probability of the Decision
flag = settings.getSubParameter("PredictedRankProbabilities")
flag.removeAll()
flag.insert("1")
rc_num = "3"
rc_stat = "Mean"
rc_param = settings.getSubParameter("ReasonCodes")
# Below
lSmartOutputParam = rc_param.insert("0")
lSmartOutputParam.setSubValue("ReasonCount", rc_num)
lSmartOutputParam.setSubValue("BaseLineMethod", rc_stat)
lSmartOutputParam.setSubValue("Direction", "Below")
# Above
lSmartOutputParam = rc_param.insert("1")
lSmartOutputParam.setSubValue("ReasonCount", rc_num)
lSmartOutputParam.setSubValue("BaseLineMethod", rc_stat)
lSmartOutputParam.setSubValue("Direction", "Above")
model.validateParameter()
model.sendMode(aalib.Kxen_apply, 0)
df = pd.read_csv(data_folder + "\\" + output_file, header=0)
df.head(10)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
36 | |
25 | |
17 | |
13 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 |