#!/usr/bin/env python #importing tabpy_client library and connect to the location (client) for subsequent operations import tabpy_client client=tabpy_client.Client('http://localhost:9004/') #training of the model and predicting the 1 or 2 based on the arguments given (_arg1 to _arg20) def germancreditcheck(_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9,_arg10,_arg11,_arg12,_arg13,_arg14,_arg15,_arg16,_arg17,_arg18,_arg19,_arg20): import numpy as np from sklearn.tree import DecisionTreeClassifier import pandas as pd data=pd.DataFrame.from_csv(r'C:\Users\ElianaLambrou\Documents\Projects\PythonInTableau\GermanCreditData.csv') X=data.drop('Class',axis=1) y=data['Class'] clf = DecisionTreeClassifier(random_state=2) clf.fit(X,y) X_pred=np.transpose(np.array([_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9,_arg10,_arg11,_arg12,_arg13,_arg14,_arg15,_arg16,_arg17,_arg18,_arg19,_arg20])) pred = clf.predict(X_pred) return pred.tolist() #deploying the function client_deploy('GermanCreditCheck', germancreditcheck, 'Classifies bad or good according to the model trained by relevant dataset', override=True)