Closed suesufan closed 5 years ago
@suesufan It looks like you are trying to mix model deployment with calling the model itself. Model deployment as explained at https://github.com/tableau/TabPy/blob/master/docs/tabpy-tools.md happens outside of Tableau. After the model is deployed you can call it with just return tabpy.query(...)['response']
in your SCRIPT_...
calculated field.
Tableau not being able to connect to TabPy is most likely not a related issue. You can confirm connection happens with adding a simple script, something like
SCRIPT_INT('return 42'...)```
@suesufan It looks like you are trying to mix model deployment with calling the model itself. Model deployment as explained at https://github.com/tableau/TabPy/blob/master/docs/tabpy-tools.md happens outside of Tableau. After the model is deployed you can call it with just
return tabpy.query(...)['response']
in yourSCRIPT_...
calculated field.Tableau not being able to connect to TabPy is most likely not a related issue. You can confirm connection happens with adding a simple script, something like
SCRIPT_INT('return 42'...)```
Oh! That's right, thank you very much!
Hello,
I commented on this article you posted but realized this is a better place to post this issue I'm facing.
I'm attempting to reproduce yourbreast cancer example in Tableau. I used your Jupyter notebook to run the code and deploy it to the TabPy client. I then created the parameters and calculation you used in Tableau. Once I tried to use it, I got this error:
Tableau Error: The endpoint you're trying to query did not respond. Please make sure the endpoint exists and the correct set of arguments are provided.
I checked the Jupyter notebook again to ensure I didn't miss any error messages and each step ran properly (aside from warnings about deprecated things). In fact, I when running the code again I saw this error:
RuntimeError: An endpoint with that name ('DiagnosticsDemo') already exists. Use 'override = True' to force update an existing endpoint.
Do you have any recommendations on how to troubleshoot this or any suspicions as to why I wouldn't be able to to communicate with the endpoint? I am running TabPy successfully and verified I'm successfully connected.
Thanks, sue
To Reproduce My code looks like this SCRIPT_STR(" import tabpy_client connection = tabpy_client.Client('http://localhost:9004') def SuggestDiagnosis(Cl_thickness, Cell_size, Cell_shape, Marg_adhesion, Epith_c_size, Bare_nuclei, Bl_cromatin, Normal_nucleoli, Mitoses): X = np.column_stack([Cl_thickness, Cell_size, Cell_shape, Marg_adhesion, Epith_c_size, Bare_nuclei, Bl_cromatin, Normal_nucleoli, Mitoses]) X = scaler.transform(X) return encoder.inverse_transform(gbclf.predict(X)).tolist() connection.deploy('DiagnosticsDemo', SuggestDiagnosis, 'Returns diagnosis suggestion based on ensemble model trained using Wisconsin Breast Cancer dataset',override=True) return tabpy.query('DiagnosticsDemo',_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9)['response']", [Cell Thickness], [Cell Size], [Cell Shape], [Marginal Adhesion], [Epithelial Cell Size], [Bare Nuclei], [Bland Cromatin], [Normal Nucleoli], [Mitosis])
I looked at other solutions and looked at the website http://localhost:9004/endpoints and I get something like this: {"add": {"description": "", "type": "model", "version": 31, "dependencies": [], "target": null, "creation_time": 1562780063, "last_modified_time": 1562817545, "schema": null, "docstring": "-- no docstring found in query function --"}, "DiagnosticsDemo": {"description": "Returns diagnosis suggestion based on ensemble model trained using Wisconsin Breast Cancer dataset", "type": "model", "version": 3, "dependencies": [], "target": null, "creation_time": 1562814475, "last_modified_time": 1562817546, "schema": null, "docstring": "-- no docstring found in query function --"}}