{"paragraphs":[{"text":"%md\n\n## Oracle Machine Learning for Python - Embedded Python Execution using third-party packages\n\n***Oracle Machine Learning for Python*** (OML4Py) Embedded Python Execution enables data scientists and other Python users to run user-defined Python functions in Python engines spawned and managed by the database environment. User-defined functions can be run in a single Python engine, or in a data-parallel or task-parallel manner using multiple Python engines, for example, to enable scoring third-party Python models at scale. Results from these user-defined Python functions can contain both structured and image results and be accessed via Python, REST and SQL APIs.\n\nNote, user-package installation is not currently enabled for Oracle Autonomous Database. For on-premises databases where user-installed package installation is enabled, the packages must be installed on the database server and client machines.\n\nIn this notebook, we will:\n- Create a script that builds a third-party linear model using Scikit-Learn in Python\n- Store the third-party model object in the OML4Py Datastore\n- Store the Python function for scoring in the OML Script Repository\n- Score via OML4Py Python interface, REST, and SQL interfaces\n\nCopyright (c) 2021 Oracle Corporation \n###### [The Universal Permissive License (UPL), Version 1.0](https://oss.oracle.com/licenses/upl/)","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:07+0000","config":{"colWidth":12,"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}},"enabled":true,"editorMode":"ace/mode/markdown","fontSize":9,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

Oracle Machine Learning for Python - Embedded Python Execution using third-party packages

\n

Oracle Machine Learning for Python (OML4Py) Embedded Python Execution enables data scientists and other Python users to run user-defined Python functions in Python engines spawned and managed by the database environment. User-defined functions can be run in a single Python engine, or in a data-parallel or task-parallel manner using multiple Python engines, for example, to enable scoring third-party Python models at scale. Results from these user-defined Python functions can contain both structured and image results and be accessed via Python, REST and SQL APIs.

\n

Note, user-package installation is not currently enabled for Oracle Autonomous Database. For on-premises databases where user-installed package installation is enabled, the packages must be installed on the database server and client machines.

\n

In this notebook, we will:

\n\n

Copyright (c) 2021 Oracle Corporation

\n
The Universal Permissive License (UPL), Version 1.0
\n"}]},"interrupted":false,"jobName":"paragraph_1622762678316_560222515","id":"20210603-232438_531200207","dateCreated":"2021-01-12T23:17:23+0000","dateStarted":"2021-10-07T00:16:08+0000","dateFinished":"2021-10-07T00:16:08+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"focus":true,"$$hashKey":"object:40"},{"title":"","text":"%md\n\n## Build a local third-party scikit-learn model\n\nA best practice with Embedded Python Execution is to validate your standalone Python code and user-defined function prior to invoking the embedded Python APIs. The next few paragraphs create a local third-party Python model `mod`, score the data, and generate a scatterplot of the data along with a plot of the regression line.\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:20:20+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","title":false,"editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

Build a local third-party scikit-learn model

\n

A best practice with Embedded Python Execution is to validate your standalone Python code and user-defined function prior to invoking the embedded Python APIs. The next few paragraphs create a local third-party Python model mod, score the data, and generate a scatterplot of the data along with a plot of the regression line.

\n"}]},"interrupted":false,"jobName":"paragraph_1633109846409_660749433","id":"20211001-173726_1487234032","dateCreated":"2021-10-01T17:37:26+0000","dateStarted":"2021-10-07T00:16:08+0000","dateFinished":"2021-10-07T00:16:08+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:41"},{"title":"Load a Pandas Dataframe to a persistent database table IRIS","text":"%md\n\nUsing the OML4Py Python notebook interpreter, we load the scikit-learn `iris` data set and combine target and predictor values into a single Pandas DataFrame. Then we use the `oml.create` function to create a persistent database table `IRIS` from the DataFrame.","user":"OMLUSER02","dateUpdated":"2021-10-07T00:24:41+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true,"title":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

Using the OML4Py Python notebook interpreter, we load the scikit-learn iris data set and combine target and predictor values into a single Pandas DataFrame. Then we use the oml.create function to create a persistent database table IRIS from the DataFrame.

\n"}]},"interrupted":false,"jobName":"paragraph_1633120089804_688759883","id":"20211001-202809_3843688","dateCreated":"2021-10-01T20:28:09+0000","dateStarted":"2021-10-07T00:16:09+0000","dateFinished":"2021-10-07T00:16:09+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:42"},{"text":"%python\nimport oml\n\nfrom sklearn.datasets import load_iris\nfrom sklearn import linear_model\nimport pandas as pd\n\niris = load_iris()\nx = pd.DataFrame(iris.data, \n columns = [\"SEPAL_LENGTH\", \"SEPAL_WIDTH\", \"PETAL_LENGTH\", \"PETAL_WIDTH\"])\ny = pd.DataFrame(list(map(lambda x: {0:'setosa', 1: 'versicolor', 2:'virginica'}[x], iris.target)), \n columns = ['SPECIES'])\niris_df = pd.concat([x,y], axis=1)\n\ntry:\n oml.drop(table=\"IRIS\")\nexcept:\n pass\n \nIRIS = oml.create(iris_df, table=\"IRIS\")\n\nz.show(IRIS)\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:09+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{"0":{"graph":{"mode":"table","height":300,"optionOpen":false,"setting":{"table":{"tableGridState":{},"tableColumnTypeState":{"names":{"SEPAL_LENGTH":"string","SEPAL_WIDTH":"string","PETAL_LENGTH":"string","PETAL_WIDTH":"string","SPECIES":"string"},"updated":false},"tableOptionSpecHash":"[{\"name\":\"useFilter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable filter for columns\"},{\"name\":\"showPagination\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable pagination for better navigation\"},{\"name\":\"showAggregationFooter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable a footer for displaying aggregated values\"}]","tableOptionValue":{"useFilter":false,"showPagination":false,"showAggregationFooter":false},"updated":false,"initialized":false}},"commonSetting":{}}}},"editorSetting":{"language":"text","editOnDblClick":false},"editorMode":"ace/mode/undefined","editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TABLE","data":"SEPAL_LENGTH\tSEPAL_WIDTH\tPETAL_LENGTH\tPETAL_WIDTH\tSPECIES\n4.6\t3.6\t1.0\t0.2\tsetosa\n5.1\t2.5\t3.0\t1.1\tversicolor\n6.0\t2.2\t4.0\t1.0\tversicolor\n5.8\t2.6\t4.0\t1.2\tversicolor\n5.5\t2.3\t4.0\t1.3\tversicolor\n5.5\t2.5\t4.0\t1.3\tversicolor\n6.1\t2.8\t4.0\t1.3\tversicolor\n5.7\t2.5\t5.0\t2.0\tvirginica\n6.0\t2.2\t5.0\t1.5\tvirginica\n6.3\t2.5\t5.0\t1.9\tvirginica\n6.7\t3.0\t5.0\t1.7\tversicolor\n7.2\t3.2\t6.0\t1.8\tvirginica\n6.3\t3.3\t6.0\t2.5\tvirginica\n4.3\t3.0\t1.1\t0.1\tsetosa\n5.8\t4.0\t1.2\t0.2\tsetosa\n5.0\t3.2\t1.2\t0.2\tsetosa\n4.4\t3.0\t1.3\t0.2\tsetosa\n4.4\t3.2\t1.3\t0.2\tsetosa\n4.7\t3.2\t1.3\t0.2\tsetosa\n5.5\t3.5\t1.3\t0.2\tsetosa\n4.5\t2.3\t1.3\t0.3\tsetosa\n5.0\t3.5\t1.3\t0.3\tsetosa\n5.4\t3.9\t1.3\t0.4\tsetosa\n4.8\t3.0\t1.4\t0.1\tsetosa\n4.9\t3.6\t1.4\t0.1\tsetosa\n4.9\t3.0\t1.4\t0.2\tsetosa\n4.4\t2.9\t1.4\t0.2\tsetosa\n4.6\t3.2\t1.4\t0.2\tsetosa\n5.0\t3.3\t1.4\t0.2\tsetosa\n5.2\t3.4\t1.4\t0.2\tsetosa\n5.1\t3.5\t1.4\t0.2\tsetosa\n5.0\t3.6\t1.4\t0.2\tsetosa\n5.5\t4.2\t1.4\t0.2\tsetosa\n4.8\t3.0\t1.4\t0.3\tsetosa\n4.6\t3.4\t1.4\t0.3\tsetosa\n5.1\t3.5\t1.4\t0.3\tsetosa\n4.9\t3.1\t1.5\t0.1\tsetosa\n5.2\t4.1\t1.5\t0.1\tsetosa\n4.6\t3.1\t1.5\t0.2\tsetosa\n4.9\t3.1\t1.5\t0.2\tsetosa\n5.0\t3.4\t1.5\t0.2\tsetosa\n5.1\t3.4\t1.5\t0.2\tsetosa\n5.2\t3.5\t1.5\t0.2\tsetosa\n5.3\t3.7\t1.5\t0.2\tsetosa\n5.4\t3.7\t1.5\t0.2\tsetosa\n5.1\t3.8\t1.5\t0.3\tsetosa\n5.4\t3.4\t1.5\t0.4\tsetosa\n5.1\t3.7\t1.5\t0.4\tsetosa\n5.7\t4.4\t1.5\t0.4\tsetosa\n5.0\t3.0\t1.6\t0.2\tsetosa\n4.8\t3.1\t1.6\t0.2\tsetosa\n4.7\t3.2\t1.6\t0.2\tsetosa\n4.8\t3.4\t1.6\t0.2\tsetosa\n5.1\t3.8\t1.6\t0.2\tsetosa\n5.0\t3.4\t1.6\t0.4\tsetosa\n5.0\t3.5\t1.6\t0.6\tsetosa\n5.4\t3.4\t1.7\t0.2\tsetosa\n5.7\t3.8\t1.7\t0.3\tsetosa\n5.4\t3.9\t1.7\t0.4\tsetosa\n5.1\t3.3\t1.7\t0.5\tsetosa\n4.8\t3.4\t1.9\t0.2\tsetosa\n5.1\t3.8\t1.9\t0.4\tsetosa\n5.0\t2.3\t3.3\t1.0\tversicolor\n4.9\t2.4\t3.3\t1.0\tversicolor\n5.0\t2.0\t3.5\t1.0\tversicolor\n5.7\t2.6\t3.5\t1.0\tversicolor\n5.6\t2.9\t3.6\t1.3\tversicolor\n5.5\t2.4\t3.7\t1.0\tversicolor\n5.5\t2.4\t3.8\t1.1\tversicolor\n5.6\t2.5\t3.9\t1.1\tversicolor\n5.8\t2.7\t3.9\t1.2\tversicolor\n5.2\t2.7\t3.9\t1.4\tversicolor\n5.8\t2.7\t4.1\t1.0\tversicolor\n5.6\t3.0\t4.1\t1.3\tversicolor\n5.7\t2.8\t4.1\t1.3\tversicolor\n5.7\t3.0\t4.2\t1.2\tversicolor\n5.6\t2.7\t4.2\t1.3\tversicolor\n5.7\t2.9\t4.2\t1.3\tversicolor\n5.9\t3.0\t4.2\t1.5\tversicolor\n6.2\t2.9\t4.3\t1.3\tversicolor\n6.4\t2.9\t4.3\t1.3\tversicolor\n5.5\t2.6\t4.4\t1.2\tversicolor\n6.3\t2.3\t4.4\t1.3\tversicolor\n6.6\t3.0\t4.4\t1.4\tversicolor\n6.7\t3.1\t4.4\t1.4\tversicolor\n4.9\t2.5\t4.5\t1.7\tvirginica\n5.7\t2.8\t4.5\t1.3\tversicolor\n5.4\t3.0\t4.5\t1.5\tversicolor\n5.6\t3.0\t4.5\t1.5\tversicolor\n6.2\t2.2\t4.5\t1.5\tversicolor\n6.0\t2.9\t4.5\t1.5\tversicolor\n6.4\t3.2\t4.5\t1.5\tversicolor\n6.0\t3.4\t4.5\t1.6\tversicolor\n6.6\t2.9\t4.6\t1.3\tversicolor\n6.1\t3.0\t4.6\t1.4\tversicolor\n6.5\t2.8\t4.6\t1.5\tversicolor\n6.1\t2.8\t4.7\t1.2\tversicolor\n6.1\t2.9\t4.7\t1.4\tversicolor\n7.0\t3.2\t4.7\t1.4\tversicolor\n6.7\t3.1\t4.7\t1.5\tversicolor\n6.3\t3.3\t4.7\t1.6\tversicolor\n6.0\t3.0\t4.8\t1.8\tvirginica\n6.2\t2.8\t4.8\t1.8\tvirginica\n6.8\t2.8\t4.8\t1.4\tversicolor\n5.9\t3.2\t4.8\t1.8\tversicolor\n5.6\t2.8\t4.9\t2.0\tvirginica\n6.1\t3.0\t4.9\t1.8\tvirginica\n6.3\t2.7\t4.9\t1.8\tvirginica\n6.3\t2.5\t4.9\t1.5\tversicolor\n6.9\t3.1\t4.9\t1.5\tversicolor\n6.5\t3.2\t5.1\t2.0\tvirginica\n6.3\t2.8\t5.1\t1.5\tvirginica\n5.9\t3.0\t5.1\t1.8\tvirginica\n5.8\t2.7\t5.1\t1.9\tvirginica\n5.8\t2.7\t5.1\t1.9\tvirginica\n6.9\t3.1\t5.1\t2.3\tvirginica\n5.8\t2.8\t5.1\t2.4\tvirginica\n6.0\t2.7\t5.1\t1.6\tversicolor\n6.5\t3.0\t5.2\t2.0\tvirginica\n6.7\t3.0\t5.2\t2.3\tvirginica\n6.4\t2.7\t5.3\t1.9\tvirginica\n6.4\t3.2\t5.3\t2.3\tvirginica\n6.9\t3.1\t5.4\t2.1\tvirginica\n6.2\t3.4\t5.4\t2.3\tvirginica\n6.5\t3.0\t5.5\t1.8\tvirginica\n6.4\t3.1\t5.5\t1.8\tvirginica\n6.8\t3.0\t5.5\t2.1\tvirginica\n6.1\t2.6\t5.6\t1.4\tvirginica\n6.3\t2.9\t5.6\t1.8\tvirginica\n6.4\t2.8\t5.6\t2.1\tvirginica\n6.4\t2.8\t5.6\t2.2\tvirginica\n6.7\t3.1\t5.6\t2.4\tvirginica\n6.3\t3.4\t5.6\t2.4\tvirginica\n6.7\t3.3\t5.7\t2.1\tvirginica\n6.9\t3.2\t5.7\t2.3\tvirginica\n6.7\t3.3\t5.7\t2.5\tvirginica\n7.2\t3.0\t5.8\t1.6\tvirginica\n6.7\t2.5\t5.8\t1.8\tvirginica\n6.5\t3.0\t5.8\t2.2\tvirginica\n7.1\t3.0\t5.9\t2.1\tvirginica\n6.8\t3.2\t5.9\t2.3\tvirginica\n7.4\t2.8\t6.1\t1.9\tvirginica\n7.7\t3.0\t6.1\t2.3\tvirginica\n7.2\t3.6\t6.1\t2.5\tvirginica\n7.3\t2.9\t6.3\t1.8\tvirginica\n7.9\t3.8\t6.4\t2.0\tvirginica\n7.6\t3.0\t6.6\t2.1\tvirginica\n7.7\t2.8\t6.7\t2.0\tvirginica\n7.7\t3.8\t6.7\t2.2\tvirginica\n7.7\t2.6\t6.9\t2.3\tvirginica\n"}]},"interrupted":false,"jobName":"paragraph_1633120238733_1133891700","id":"20211001-203038_214380563","dateCreated":"2021-10-01T20:30:38+0000","dateStarted":"2021-10-07T00:16:10+0000","dateFinished":"2021-10-07T00:16:10+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:43"},{"title":"Build the scikit-learn model","text":"%python\n\nfrom sklearn import linear_model\n\nlm = linear_model.LinearRegression()\nX = iris_df[[\"PETAL_WIDTH\"]]\ny = iris_df[[\"PETAL_LENGTH\"]]\nmod = lm.fit(X, y)\n\nprint(\"Model:\",mod)\nprint(\"Type:\",type(mod))\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:10+0000","config":{"colWidth":6,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","title":true,"editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TEXT","data":"Model: LinearRegression()\nType: \n"}]},"interrupted":false,"jobName":"paragraph_1622762678316_1728150746","id":"20210603-232438_371343088","dateCreated":"2021-03-22T19:00:20+0000","dateStarted":"2021-10-07T00:16:10+0000","dateFinished":"2021-10-07T00:16:11+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:44"},{"title":"Score the data","text":"%python\n\npred = mod.predict(iris_df[[\"PETAL_WIDTH\"]])\npred[0:8]\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:11+0000","config":{"colWidth":6,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","title":true,"editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TEXT","data":"array([[1.52954613],\n [1.52954613],\n [1.52954613],\n [1.52954613],\n [1.52954613],\n [1.97553423],\n [1.75254018],\n [1.52954613]])\n"}]},"interrupted":false,"jobName":"paragraph_1633110643317_-1710941325","id":"20211001-175043_2147438831","dateCreated":"2021-10-01T17:50:43+0000","dateStarted":"2021-10-07T00:16:11+0000","dateFinished":"2021-10-07T00:16:11+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:45"},{"title":" Generate a scatterplot of the data along with a plot of the regression line","text":"%python\n\nimport matplotlib.pyplot as plt\n\nplt.scatter(iris_df.loc[:,\"PETAL_WIDTH\"], iris_df.loc[:,\"PETAL_LENGTH\"])\nplt.plot(iris_df[[\"PETAL_WIDTH\"]], pred, color='blue', linewidth=3)\nplt.grid(True)\nplt.title('Prediction of Petal Length')\n\nplt.xlabel('Petal Width')\nplt.ylabel('Petal Length')\n\nplt.show()\n\n ","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:11+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","title":true,"editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"
\n"}]},"interrupted":false,"jobName":"paragraph_1633110553479_-2104631258","id":"20211001-174913_826607259","dateCreated":"2021-10-01T17:49:13+0000","dateStarted":"2021-10-07T00:16:12+0000","dateFinished":"2021-10-07T00:16:13+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:46"},{"title":"Define your function","text":"%md\n\nTo illustrate embedded Python execution, first define a function, `build_mod`, then run the function to ensure it returns the result we expect - both an image and a model.\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:24:47+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","title":true,"editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

To illustrate embedded Python execution, first define a function, build_mod, then run the function to ensure it returns the result we expect - both an image and a model.

\n"}]},"interrupted":false,"jobName":"paragraph_1633206087089_-822432833","id":"20211002-202127_719504442","dateCreated":"2021-10-02T20:21:27+0000","dateStarted":"2021-10-07T00:16:13+0000","dateFinished":"2021-10-07T00:16:13+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:47"},{"text":"%python\n\ndef build_mod(dat):\n import oml\n from sklearn import linear_model\n import matplotlib.pyplot as plt\n\n lm = linear_model.LinearRegression()\n X = dat[[\"PETAL_WIDTH\"]]\n y = dat[[\"PETAL_LENGTH\"]]\n mod = lm.fit(X, y)\n \n pred = mod.predict(dat[[\"PETAL_WIDTH\"]])\n plt.scatter(dat.loc[:,\"PETAL_WIDTH\"], dat.loc[:,\"PETAL_LENGTH\"])\n plt.plot(dat[[\"PETAL_WIDTH\"]], pred, color='blue', linewidth=3)\n plt.xticks(()) # Disable ticks\n plt.yticks(())\n plt.show()\n return mod","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:13+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[]},"interrupted":false,"jobName":"paragraph_1633206042117_818199243","id":"20211002-202042_606420686","dateCreated":"2021-10-02T20:20:42+0000","dateStarted":"2021-10-07T00:16:14+0000","dateFinished":"2021-10-07T00:16:14+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:48"},{"text":"%python\n\nbuild_mod(iris_df)","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:14+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"
\nLinearRegression()\n"}]},"interrupted":false,"jobName":"paragraph_1633206052145_155680558","id":"20211002-202052_536075810","dateCreated":"2021-10-02T20:20:52+0000","dateStarted":"2021-10-07T00:16:14+0000","dateFinished":"2021-10-07T00:16:15+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:49"},{"title":"Run using table-apply","text":"%md\n\nNext, we invoke this function using the Embedded Python Execution function `table_apply`. In this example, the `table_apply` function takes the database table `IRIS` as input and loads the corresponding data in the database table to the user-defined function as a pandas DataFrame in the first argument. The user-defined function can be passed as a Python function object or the function definition as a string. We see that the model is returned in the variable `mod2` and the image is displayed according to the parameter `graphics=True`.\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:24:51+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","title":true,"editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

Next, we invoke this function using the Embedded Python Execution function table_apply. In this example, the table_apply function takes the database table IRIS as input and loads the corresponding data in the database table to the user-defined function as a pandas DataFrame in the first argument. The user-defined function can be passed as a Python function object or the function definition as a string. We see that the model is returned in the variable mod2 and the image is displayed according to the parameter graphics=True.

\n"}]},"interrupted":false,"jobName":"paragraph_1633206370296_2115203063","id":"20211002-202610_215424796","dateCreated":"2021-10-02T20:26:10+0000","dateStarted":"2021-10-07T00:16:15+0000","dateFinished":"2021-10-07T00:16:15+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:50"},{"text":"%python\n\nmod2 = oml.table_apply(data=IRIS, func = build_mod, graphics=True)\nmod2\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:16+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"text","editOnDblClick":false},"editorMode":"ace/mode/undefined","editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"
\nLinearRegression()\n"}]},"interrupted":false,"jobName":"paragraph_1633206468019_535719583","id":"20211002-202748_245316590","dateCreated":"2021-10-02T20:27:48+0000","dateStarted":"2021-10-07T00:16:16+0000","dateFinished":"2021-10-07T00:16:17+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:51"},{"text":"%md\n\n## Scoring using the Python interface for Embedded Python execution\n\nNow let's score the data using Embedded Python Execution and spawned by Python engines under control of the Database environment. \n\nThe previously created model `mod` is saved to datastore `ds_mod`, then loaded in the scoring function `score_mod`. The `score_mod` function is saved in a user-defined function residing in the OML4Py script repository and run from the Python, REST, and SQL interfaces. \n\nA note on return values from Embedded Python Execution:\n\n- The Python interface can return structured data as well as images\n- The REST interface returns a JSON representation of the user-defined function's return value as structured data or images\n- The SQL interface supports structured data, images, and XML output\n\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:20:29+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

Scoring using the Python interface for Embedded Python execution

\n

Now let's score the data using Embedded Python Execution and spawned by Python engines under control of the Database environment.

\n

The previously created model mod is saved to datastore ds_mod, then loaded in the scoring function score_mod. The score_mod function is saved in a user-defined function residing in the OML4Py script repository and run from the Python, REST, and SQL interfaces.

\n

A note on return values from Embedded Python Execution:

\n
    \n
  • The Python interface can return structured data as well as images
  • \n
  • The REST interface returns a JSON representation of the user-defined function's return value as structured data or images
  • \n
  • The SQL interface supports structured data, images, and XML output
  • \n
\n"}]},"interrupted":false,"jobName":"paragraph_1633112200117_-236942925","id":"20211001-181640_805129186","dateCreated":"2021-10-01T18:16:40+0000","dateStarted":"2021-10-07T00:16:18+0000","dateFinished":"2021-10-07T00:16:18+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:52"},{"title":"Save the scikit-learn model object to the datastore","text":"%python\n\noml.ds.save(objs={'mod':mod}, \n name=\"ds_mod\", \n overwrite=True,\n description='scikit-learn model predicting petal length from IRIS') \n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:18+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","editorHide":false,"title":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[]},"interrupted":false,"jobName":"paragraph_1622762678316_645964554","id":"20210603-232438_1108952059","dateCreated":"2021-01-13T00:01:51+0000","dateStarted":"2021-10-07T00:16:18+0000","dateFinished":"2021-10-07T00:16:18+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:53"},{"title":"Check the contents of the datastore","text":"%python\n\nz.show(oml.ds.dir(name='ds_mod'))","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:18+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{"0":{"graph":{"mode":"table","height":300,"optionOpen":false,"setting":{"table":{"tableGridState":{"columns":[{"name":"datastore_name","visible":true,"width":"*","sort":{},"filters":[{}],"pinned":""},{"name":"object_count","visible":true,"width":"*","sort":{},"filters":[{}],"pinned":""},{"name":"size","visible":true,"width":"*","sort":{},"filters":[{}],"pinned":""},{"name":"date","visible":true,"width":"*","sort":{},"filters":[{}],"pinned":""},{"name":"description","visible":true,"width":"*","sort":{},"filters":[{}],"pinned":""}],"scrollFocus":{},"selection":[],"grouping":{"grouping":[],"aggregations":[],"rowExpandedStates":{}},"treeView":{},"pagination":{"paginationCurrentPage":1,"paginationPageSize":250}},"tableColumnTypeState":{"names":{"datastore_name":"string","object_count":"string","size":"string","date":"string","description":"string"},"updated":false},"tableOptionSpecHash":"[{\"name\":\"useFilter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable filter for columns\"},{\"name\":\"showPagination\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable pagination for better navigation\"},{\"name\":\"showAggregationFooter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable a footer for displaying aggregated values\"}]","tableOptionValue":{"useFilter":false,"showPagination":false,"showAggregationFooter":false},"updated":false,"initialized":false}},"commonSetting":{}}}},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","title":true,"editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TABLE","data":"datastore_name\tobject_count\tsize\tdate\tdescription\nds_mod\t1\t483\t2021-10-07 00:16:18\tscikit-learn model predicting petal length from IRIS\n"}]},"interrupted":false,"jobName":"paragraph_1622762678316_869730849","id":"20210603-232438_1150938339","dateCreated":"2021-01-13T00:39:00+0000","dateStarted":"2021-10-07T00:16:19+0000","dateFinished":"2021-10-07T00:16:19+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:54"},{"text":"%md\n\nDefine a scoring function named `score_mod`. The `score_mod` function loads the datastore containing the model and then peforms the scoring.","user":"OMLUSER02","dateUpdated":"2021-10-07T00:25:02+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

Define a scoring function named score_mod. The score_mod function loads the datastore containing the model and then peforms the scoring.

\n"}]},"interrupted":false,"jobName":"paragraph_1633119892048_2116171178","id":"20211001-202452_363232152","dateCreated":"2021-10-01T20:24:52+0000","dateStarted":"2021-10-07T00:16:20+0000","dateFinished":"2021-10-07T00:16:20+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:55"},{"text":"%python\n\ndef score_mod(dat):\n import pandas as pd\n import oml\n obj_dict = oml.ds.load(name=\"ds_mod\", to_globals=False) \n regr = obj_dict[\"mod\"] \n pred = regr.predict(dat[['PETAL_WIDTH']])\n return pd.concat([dat[['SPECIES', 'PETAL_LENGTH']],\n pd.DataFrame(pred,columns=['Pred_PETAL_LENGTH'])], axis=1)\n \n\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:20+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[]},"interrupted":false,"jobName":"paragraph_1633123246233_599511893","id":"20211001-212046_509912458","dateCreated":"2021-10-01T21:20:46+0000","dateStarted":"2021-10-07T00:16:20+0000","dateFinished":"2021-10-07T00:16:20+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:56"},{"text":"%md\n\nRun the scoring function `score_mod` with local data to ensure it returns petal length predictions as expected.\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:25:05+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

Run the scoring function score_mod with local data to ensure it returns petal length predictions as expected.

\n"}]},"interrupted":false,"jobName":"paragraph_1633278515723_-1003449724","id":"20211003-162835_1883945204","dateCreated":"2021-10-03T16:28:35+0000","dateStarted":"2021-10-07T00:16:21+0000","dateFinished":"2021-10-07T00:16:21+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:57"},{"text":"%python\n\nz.show(score_mod(iris_df))","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:21+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{"0":{"graph":{"mode":"table","height":300,"optionOpen":false,"setting":{"table":{"tableGridState":{},"tableColumnTypeState":{"names":{"SPECIES":"string","PETAL_LENGTH":"string","Pred_PETAL_LENGTH":"string"},"updated":false},"tableOptionSpecHash":"[{\"name\":\"useFilter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable filter for columns\"},{\"name\":\"showPagination\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable pagination for better navigation\"},{\"name\":\"showAggregationFooter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable a footer for displaying aggregated values\"}]","tableOptionValue":{"useFilter":false,"showPagination":false,"showAggregationFooter":false},"updated":false,"initialized":false}},"commonSetting":{}}}},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TABLE","data":"SPECIES\tPETAL_LENGTH\tPred_PETAL_LENGTH\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.3\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.7\t1.9755342308992567\nsetosa\t1.4\t1.7525401813870705\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.5\t1.3065520823626977\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.4\t1.3065520823626977\nsetosa\t1.1\t1.3065520823626977\nsetosa\t1.2\t1.529546131874884\nsetosa\t1.5\t1.9755342308992567\nsetosa\t1.3\t1.9755342308992567\nsetosa\t1.4\t1.7525401813870705\nsetosa\t1.7\t1.7525401813870705\nsetosa\t1.5\t1.7525401813870705\nsetosa\t1.7\t1.529546131874884\nsetosa\t1.5\t1.9755342308992567\nsetosa\t1.0\t1.529546131874884\nsetosa\t1.7\t2.198528280411443\nsetosa\t1.9\t1.529546131874884\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.6\t1.9755342308992567\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.5\t1.9755342308992567\nsetosa\t1.5\t1.3065520823626977\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.2\t1.529546131874884\nsetosa\t1.3\t1.529546131874884\nsetosa\t1.4\t1.3065520823626977\nsetosa\t1.3\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.3\t1.7525401813870705\nsetosa\t1.3\t1.7525401813870705\nsetosa\t1.3\t1.529546131874884\nsetosa\t1.6\t2.4215223299236293\nsetosa\t1.9\t1.9755342308992567\nsetosa\t1.4\t1.7525401813870705\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nversicolor\t4.7\t4.205474726021121\nversicolor\t4.5\t4.428468775533307\nversicolor\t4.9\t4.428468775533307\nversicolor\t4.0\t3.9824806765089344\nversicolor\t4.6\t4.428468775533307\nversicolor\t4.5\t3.9824806765089344\nversicolor\t4.7\t4.651462825045494\nversicolor\t3.3\t3.313498527972375\nversicolor\t4.6\t3.9824806765089344\nversicolor\t3.9\t4.205474726021121\nversicolor\t3.5\t3.313498527972375\nversicolor\t4.2\t4.428468775533307\nversicolor\t4.0\t3.313498527972375\nversicolor\t4.7\t4.205474726021121\nversicolor\t3.6\t3.9824806765089344\nversicolor\t4.4\t4.205474726021121\nversicolor\t4.5\t4.428468775533307\nversicolor\t4.1\t3.313498527972375\nversicolor\t4.5\t4.428468775533307\nversicolor\t3.9\t3.536492577484562\nversicolor\t4.8\t5.097450924069866\nversicolor\t4.0\t3.9824806765089344\nversicolor\t4.9\t4.428468775533307\nversicolor\t4.7\t3.7594866269967477\nversicolor\t4.3\t3.9824806765089344\nversicolor\t4.4\t4.205474726021121\nversicolor\t4.8\t4.205474726021121\nversicolor\t5.0\t4.87445687455768\nversicolor\t4.5\t4.428468775533307\nversicolor\t3.5\t3.313498527972375\nversicolor\t3.8\t3.536492577484562\nversicolor\t3.7\t3.313498527972375\nversicolor\t3.9\t3.7594866269967477\nversicolor\t5.1\t4.651462825045494\nversicolor\t4.5\t4.428468775533307\nversicolor\t4.5\t4.651462825045494\nversicolor\t4.7\t4.428468775533307\nversicolor\t4.4\t3.9824806765089344\nversicolor\t4.1\t3.9824806765089344\nversicolor\t4.0\t3.9824806765089344\nversicolor\t4.4\t3.7594866269967477\nversicolor\t4.6\t4.205474726021121\nversicolor\t4.0\t3.7594866269967477\nversicolor\t3.3\t3.313498527972375\nversicolor\t4.2\t3.9824806765089344\nversicolor\t4.2\t3.7594866269967477\nversicolor\t4.2\t3.9824806765089344\nversicolor\t4.3\t3.9824806765089344\nversicolor\t3.0\t3.536492577484562\nversicolor\t4.1\t3.9824806765089344\nvirginica\t6.0\t6.658409270655172\nvirginica\t5.1\t5.3204449735820525\nvirginica\t5.9\t5.766433072606425\nvirginica\t5.6\t5.097450924069866\nvirginica\t5.8\t5.989427122118613\nvirginica\t6.6\t5.766433072606425\nvirginica\t4.5\t4.87445687455768\nvirginica\t6.3\t5.097450924069866\nvirginica\t5.8\t5.097450924069866\nvirginica\t6.1\t6.658409270655172\nvirginica\t5.1\t5.543439023094239\nvirginica\t5.3\t5.3204449735820525\nvirginica\t5.5\t5.766433072606425\nvirginica\t5.0\t5.543439023094239\nvirginica\t5.1\t6.435415221142984\nvirginica\t5.3\t6.2124211716307975\nvirginica\t5.5\t5.097450924069866\nvirginica\t6.7\t5.989427122118613\nvirginica\t6.9\t6.2124211716307975\nvirginica\t5.0\t4.428468775533307\nvirginica\t5.7\t6.2124211716307975\nvirginica\t4.9\t5.543439023094239\nvirginica\t6.7\t5.543439023094239\nvirginica\t4.9\t5.097450924069866\nvirginica\t5.7\t5.766433072606425\nvirginica\t6.0\t5.097450924069866\nvirginica\t4.8\t5.097450924069866\nvirginica\t4.9\t5.097450924069866\nvirginica\t5.6\t5.766433072606425\nvirginica\t5.8\t4.651462825045494\nvirginica\t6.1\t5.3204449735820525\nvirginica\t6.4\t5.543439023094239\nvirginica\t5.6\t5.989427122118613\nvirginica\t5.1\t4.428468775533307\nvirginica\t5.6\t4.205474726021121\nvirginica\t6.1\t6.2124211716307975\nvirginica\t5.6\t6.435415221142984\nvirginica\t5.5\t5.097450924069866\nvirginica\t4.8\t5.097450924069866\nvirginica\t5.4\t5.766433072606425\nvirginica\t5.6\t6.435415221142984\nvirginica\t5.1\t6.2124211716307975\nvirginica\t5.1\t5.3204449735820525\nvirginica\t5.9\t6.2124211716307975\nvirginica\t5.7\t6.658409270655172\nvirginica\t5.2\t6.2124211716307975\nvirginica\t5.0\t5.3204449735820525\nvirginica\t5.2\t5.543439023094239\nvirginica\t5.4\t6.2124211716307975\nvirginica\t5.1\t5.097450924069866\n"}]},"interrupted":false,"jobName":"paragraph_1633210819429_1198893456","id":"20211002-214019_72309684","dateCreated":"2021-10-02T21:40:19+0000","dateStarted":"2021-10-07T00:16:21+0000","dateFinished":"2021-10-07T00:16:22+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:58"},{"title":"Check the output of the scoring in Python","text":"%md\n\nUse `row_apply` to score the model on the `IRIS` table from the Python interface. In this example, the `row_apply` function takes as arguments the proxy object `IRIS`, the user-defined function `score_mod`, that we want 10 rows scored at a time, and that we want the result to be returned as a single table.\n\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:25:10+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true,"title":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

Use row_apply to score the model on the IRIS table from the Python interface. In this example, the row_apply function takes as arguments the proxy object IRIS, the user-defined function score_mod, that we want 10 rows scored at a time, and that we want the result to be returned as a single table.

\n"}]},"interrupted":false,"jobName":"paragraph_1633119952369_1201623295","id":"20211001-202552_33008015","dateCreated":"2021-10-01T20:25:52+0000","dateStarted":"2021-10-07T00:16:22+0000","dateFinished":"2021-10-07T00:16:22+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:59"},{"title":"","text":"%python\n\noutput = oml.row_apply(IRIS, score_mod, rows=10, parallel=True,\n func_value=pd.DataFrame([('a', 1, 1)], \n columns=['SPECIES', 'PETAL_LENGTH', 'PRED_PETAL_LENGTH']))\nz.show(output)\n\n \n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:22+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{"0":{"graph":{"mode":"table","height":300,"optionOpen":false,"setting":{"table":{"tableGridState":{},"tableColumnTypeState":{"names":{"SPECIES":"string","PETAL_LENGTH":"string","PRED_PETAL_LENGTH":"string"},"updated":false},"tableOptionSpecHash":"[{\"name\":\"useFilter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable filter for columns\"},{\"name\":\"showPagination\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable pagination for better navigation\"},{\"name\":\"showAggregationFooter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable a footer for displaying aggregated values\"}]","tableOptionValue":{"useFilter":false,"showPagination":false,"showAggregationFooter":false},"updated":false,"initialized":false},"lineChart":{"rotate":{"degree":"-45"},"xLabelStatus":"default"}},"commonSetting":{},"keys":[{"name":"SPECIES","index":0,"aggr":"sum"}],"groups":[],"values":[{"name":"PETAL_WIDTH","index":1,"aggr":"sum"}]},"helium":{}}},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","title":false,"editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TABLE","data":"SPECIES\tPETAL_LENGTH\tPRED_PETAL_LENGTH\nvirginica\t4.5\t4.87445687455768\nversicolor\t5.0\t4.87445687455768\nsetosa\t1.1\t1.3065520823626977\nsetosa\t1.4\t1.3065520823626977\nsetosa\t1.4\t1.3065520823626977\nsetosa\t1.5\t1.3065520823626977\nsetosa\t1.5\t1.3065520823626977\nsetosa\t1.0\t1.529546131874884\nsetosa\t1.2\t1.529546131874884\nsetosa\t1.2\t1.529546131874884\nsetosa\t1.3\t1.529546131874884\nsetosa\t1.3\t1.529546131874884\nsetosa\t1.3\t1.529546131874884\nsetosa\t1.3\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.7\t1.529546131874884\nsetosa\t1.9\t1.529546131874884\nsetosa\t1.3\t1.7525401813870705\nsetosa\t1.3\t1.7525401813870705\nsetosa\t1.4\t1.7525401813870705\nsetosa\t1.4\t1.7525401813870705\nsetosa\t1.4\t1.7525401813870705\nsetosa\t1.5\t1.7525401813870705\nsetosa\t1.7\t1.7525401813870705\nsetosa\t1.3\t1.9755342308992567\nsetosa\t1.5\t1.9755342308992567\nsetosa\t1.5\t1.9755342308992567\nsetosa\t1.5\t1.9755342308992567\nsetosa\t1.6\t1.9755342308992567\nsetosa\t1.7\t1.9755342308992567\nsetosa\t1.9\t1.9755342308992567\nsetosa\t1.7\t2.198528280411443\nsetosa\t1.6\t2.4215223299236293\nversicolor\t4.0\t3.313498527972375\nversicolor\t3.3\t3.313498527972375\nversicolor\t3.3\t3.313498527972375\nversicolor\t3.5\t3.313498527972375\nversicolor\t3.5\t3.313498527972375\nversicolor\t3.7\t3.313498527972375\nversicolor\t4.1\t3.313498527972375\nversicolor\t3.0\t3.536492577484562\nversicolor\t3.8\t3.536492577484562\nversicolor\t3.9\t3.536492577484562\nversicolor\t4.0\t3.7594866269967477\nversicolor\t3.9\t3.7594866269967477\nversicolor\t4.2\t3.7594866269967477\nversicolor\t4.4\t3.7594866269967477\nversicolor\t4.7\t3.7594866269967477\nversicolor\t4.0\t3.9824806765089344\nversicolor\t4.0\t3.9824806765089344\nversicolor\t4.0\t3.9824806765089344\nversicolor\t3.6\t3.9824806765089344\nversicolor\t4.1\t3.9824806765089344\nversicolor\t4.1\t3.9824806765089344\nversicolor\t4.2\t3.9824806765089344\nversicolor\t4.2\t3.9824806765089344\nversicolor\t4.3\t3.9824806765089344\nversicolor\t4.3\t3.9824806765089344\nversicolor\t4.4\t3.9824806765089344\nversicolor\t4.5\t3.9824806765089344\nversicolor\t4.6\t3.9824806765089344\nvirginica\t5.6\t4.205474726021121\nversicolor\t3.9\t4.205474726021121\nversicolor\t4.4\t4.205474726021121\nversicolor\t4.4\t4.205474726021121\nversicolor\t4.6\t4.205474726021121\nversicolor\t4.7\t4.205474726021121\nversicolor\t4.7\t4.205474726021121\nversicolor\t4.8\t4.205474726021121\nvirginica\t5.0\t4.428468775533307\nvirginica\t5.1\t4.428468775533307\nversicolor\t4.2\t4.428468775533307\nversicolor\t4.5\t4.428468775533307\nversicolor\t4.5\t4.428468775533307\nversicolor\t4.5\t4.428468775533307\nversicolor\t4.5\t4.428468775533307\nversicolor\t4.5\t4.428468775533307\nversicolor\t4.6\t4.428468775533307\nversicolor\t4.7\t4.428468775533307\nversicolor\t4.9\t4.428468775533307\nversicolor\t4.9\t4.428468775533307\nvirginica\t5.8\t4.651462825045494\nversicolor\t4.5\t4.651462825045494\nversicolor\t4.7\t4.651462825045494\nversicolor\t5.1\t4.651462825045494\nvirginica\t6.0\t5.097450924069866\nvirginica\t4.8\t5.097450924069866\nvirginica\t4.8\t5.097450924069866\nvirginica\t4.9\t5.097450924069866\nvirginica\t4.9\t5.097450924069866\nvirginica\t5.1\t5.097450924069866\nvirginica\t5.5\t5.097450924069866\nvirginica\t5.5\t5.097450924069866\nvirginica\t5.6\t5.097450924069866\nvirginica\t5.8\t5.097450924069866\nvirginica\t6.3\t5.097450924069866\nversicolor\t4.8\t5.097450924069866\nvirginica\t5.0\t5.3204449735820525\nvirginica\t5.1\t5.3204449735820525\nvirginica\t5.1\t5.3204449735820525\nvirginica\t5.3\t5.3204449735820525\nvirginica\t6.1\t5.3204449735820525\nvirginica\t5.0\t5.543439023094239\nvirginica\t4.9\t5.543439023094239\nvirginica\t5.1\t5.543439023094239\nvirginica\t5.2\t5.543439023094239\nvirginica\t6.4\t5.543439023094239\nvirginica\t6.7\t5.543439023094239\nvirginica\t5.4\t5.766433072606425\nvirginica\t5.5\t5.766433072606425\nvirginica\t5.6\t5.766433072606425\nvirginica\t5.7\t5.766433072606425\nvirginica\t5.9\t5.766433072606425\nvirginica\t6.6\t5.766433072606425\nvirginica\t5.6\t5.989427122118613\nvirginica\t5.8\t5.989427122118613\nvirginica\t6.7\t5.989427122118613\nvirginica\t5.1\t6.2124211716307975\nvirginica\t5.2\t6.2124211716307975\nvirginica\t5.3\t6.2124211716307975\nvirginica\t5.4\t6.2124211716307975\nvirginica\t5.7\t6.2124211716307975\nvirginica\t5.9\t6.2124211716307975\nvirginica\t6.1\t6.2124211716307975\nvirginica\t6.9\t6.2124211716307975\nvirginica\t5.1\t6.435415221142984\nvirginica\t5.6\t6.435415221142984\nvirginica\t5.6\t6.435415221142984\nvirginica\t6.0\t6.658409270655172\nvirginica\t5.7\t6.658409270655172\nvirginica\t6.1\t6.658409270655172\n"}]},"interrupted":false,"jobName":"paragraph_1622762678316_412471403","id":"20210603-232438_1152606801","dateCreated":"2021-01-13T00:29:24+0000","dateStarted":"2021-10-07T00:16:23+0000","dateFinished":"2021-10-07T00:16:24+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:60"},{"text":"%md\n\nWe'll define the `score_mod` function as a string object, a requirement to save it to the OML4Py script repository. Run the string representation of the function from `row_apply` and notice \nthe output is the same.\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:25:13+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

We'll define the score_mod function as a string object, a requirement to save it to the OML4Py script repository. Run the string representation of the function from row_apply and notice\n
the output is the same.

\n"}]},"interrupted":false,"jobName":"paragraph_1633123263711_-783706123","id":"20211001-212103_507287251","dateCreated":"2021-10-01T21:21:03+0000","dateStarted":"2021-10-07T00:16:25+0000","dateFinished":"2021-10-07T00:16:25+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:61"},{"title":"","text":"%python\n\nscore_mod = \"\"\"def score_mod(dat):\n import pandas as pd\n import oml\n obj_dict = oml.ds.load(name=\"ds_mod\", to_globals=False) \n regr = obj_dict[\"mod\"] \n pred = regr.predict(dat[['PETAL_WIDTH']]) \n return pd.concat([dat[['SPECIES', 'PETAL_LENGTH']],\n pd.DataFrame(pred,columns=['Pred_PETAL_WIDTH'])], axis=1)\"\"\"\n\n ","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:25+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","title":false,"editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[]},"interrupted":false,"jobName":"paragraph_1633115213202_748173945","id":"20211001-190653_1400166624","dateCreated":"2021-10-01T19:06:53+0000","dateStarted":"2021-10-07T00:16:25+0000","dateFinished":"2021-10-07T00:16:25+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:62"},{"text":"%python\n\noutput = oml.row_apply(IRIS, score_mod, rows=10, parallel=True,\n func_value=pd.DataFrame([('a', 1, 1)], \n columns=['SPECIES', 'PETAL_LENGTH', 'PRED_PETAL_LENGTH']))\nz.show(output)","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:25+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{"0":{"graph":{"mode":"table","height":300,"optionOpen":false,"setting":{"table":{"tableGridState":{},"tableColumnTypeState":{"names":{"SPECIES":"string","PETAL_LENGTH":"string","PRED_PETAL_LENGTH":"string"},"updated":false},"tableOptionSpecHash":"[{\"name\":\"useFilter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable filter for columns\"},{\"name\":\"showPagination\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable pagination for better navigation\"},{\"name\":\"showAggregationFooter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable a footer for displaying aggregated values\"}]","tableOptionValue":{"useFilter":false,"showPagination":false,"showAggregationFooter":false},"updated":false,"initialized":false}},"commonSetting":{}}}},"editorSetting":{"language":"text","editOnDblClick":false},"editorMode":"ace/mode/undefined","editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TABLE","data":"SPECIES\tPETAL_LENGTH\tPRED_PETAL_LENGTH\nvirginica\t4.5\t4.87445687455768\nversicolor\t5.0\t4.87445687455768\nsetosa\t1.1\t1.3065520823626977\nsetosa\t1.4\t1.3065520823626977\nsetosa\t1.4\t1.3065520823626977\nsetosa\t1.5\t1.3065520823626977\nsetosa\t1.5\t1.3065520823626977\nsetosa\t1.0\t1.529546131874884\nsetosa\t1.2\t1.529546131874884\nsetosa\t1.2\t1.529546131874884\nsetosa\t1.3\t1.529546131874884\nsetosa\t1.3\t1.529546131874884\nsetosa\t1.3\t1.529546131874884\nsetosa\t1.3\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.4\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.5\t1.529546131874884\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.6\t1.529546131874884\nsetosa\t1.7\t1.529546131874884\nsetosa\t1.9\t1.529546131874884\nsetosa\t1.3\t1.7525401813870705\nsetosa\t1.3\t1.7525401813870705\nsetosa\t1.4\t1.7525401813870705\nsetosa\t1.4\t1.7525401813870705\nsetosa\t1.4\t1.7525401813870705\nsetosa\t1.5\t1.7525401813870705\nsetosa\t1.7\t1.7525401813870705\nsetosa\t1.3\t1.9755342308992567\nsetosa\t1.5\t1.9755342308992567\nsetosa\t1.5\t1.9755342308992567\nsetosa\t1.5\t1.9755342308992567\nsetosa\t1.6\t1.9755342308992567\nsetosa\t1.7\t1.9755342308992567\nsetosa\t1.9\t1.9755342308992567\nsetosa\t1.7\t2.198528280411443\nsetosa\t1.6\t2.4215223299236293\nversicolor\t4.0\t3.313498527972375\nversicolor\t3.3\t3.313498527972375\nversicolor\t3.3\t3.313498527972375\nversicolor\t3.5\t3.313498527972375\nversicolor\t3.5\t3.313498527972375\nversicolor\t3.7\t3.313498527972375\nversicolor\t4.1\t3.313498527972375\nversicolor\t3.0\t3.536492577484562\nversicolor\t3.8\t3.536492577484562\nversicolor\t3.9\t3.536492577484562\nversicolor\t4.0\t3.7594866269967477\nversicolor\t3.9\t3.7594866269967477\nversicolor\t4.2\t3.7594866269967477\nversicolor\t4.4\t3.7594866269967477\nversicolor\t4.7\t3.7594866269967477\nversicolor\t4.0\t3.9824806765089344\nversicolor\t4.0\t3.9824806765089344\nversicolor\t4.0\t3.9824806765089344\nversicolor\t3.6\t3.9824806765089344\nversicolor\t4.1\t3.9824806765089344\nversicolor\t4.1\t3.9824806765089344\nversicolor\t4.2\t3.9824806765089344\nversicolor\t4.2\t3.9824806765089344\nversicolor\t4.3\t3.9824806765089344\nversicolor\t4.3\t3.9824806765089344\nversicolor\t4.4\t3.9824806765089344\nversicolor\t4.5\t3.9824806765089344\nversicolor\t4.6\t3.9824806765089344\nvirginica\t5.6\t4.205474726021121\nversicolor\t3.9\t4.205474726021121\nversicolor\t4.4\t4.205474726021121\nversicolor\t4.4\t4.205474726021121\nversicolor\t4.6\t4.205474726021121\nversicolor\t4.7\t4.205474726021121\nversicolor\t4.7\t4.205474726021121\nversicolor\t4.8\t4.205474726021121\nvirginica\t5.0\t4.428468775533307\nvirginica\t5.1\t4.428468775533307\nversicolor\t4.2\t4.428468775533307\nversicolor\t4.5\t4.428468775533307\nversicolor\t4.5\t4.428468775533307\nversicolor\t4.5\t4.428468775533307\nversicolor\t4.5\t4.428468775533307\nversicolor\t4.5\t4.428468775533307\nversicolor\t4.6\t4.428468775533307\nversicolor\t4.7\t4.428468775533307\nversicolor\t4.9\t4.428468775533307\nversicolor\t4.9\t4.428468775533307\nvirginica\t5.8\t4.651462825045494\nversicolor\t4.5\t4.651462825045494\nversicolor\t4.7\t4.651462825045494\nversicolor\t5.1\t4.651462825045494\nvirginica\t6.0\t5.097450924069866\nvirginica\t4.8\t5.097450924069866\nvirginica\t4.8\t5.097450924069866\nvirginica\t4.9\t5.097450924069866\nvirginica\t4.9\t5.097450924069866\nvirginica\t5.1\t5.097450924069866\nvirginica\t5.5\t5.097450924069866\nvirginica\t5.5\t5.097450924069866\nvirginica\t5.6\t5.097450924069866\nvirginica\t5.8\t5.097450924069866\nvirginica\t6.3\t5.097450924069866\nversicolor\t4.8\t5.097450924069866\nvirginica\t5.0\t5.3204449735820525\nvirginica\t5.1\t5.3204449735820525\nvirginica\t5.1\t5.3204449735820525\nvirginica\t5.3\t5.3204449735820525\nvirginica\t6.1\t5.3204449735820525\nvirginica\t5.0\t5.543439023094239\nvirginica\t4.9\t5.543439023094239\nvirginica\t5.1\t5.543439023094239\nvirginica\t5.2\t5.543439023094239\nvirginica\t6.4\t5.543439023094239\nvirginica\t6.7\t5.543439023094239\nvirginica\t5.4\t5.766433072606425\nvirginica\t5.5\t5.766433072606425\nvirginica\t5.6\t5.766433072606425\nvirginica\t5.7\t5.766433072606425\nvirginica\t5.9\t5.766433072606425\nvirginica\t6.6\t5.766433072606425\nvirginica\t5.6\t5.989427122118613\nvirginica\t5.8\t5.989427122118613\nvirginica\t6.7\t5.989427122118613\nvirginica\t5.1\t6.2124211716307975\nvirginica\t5.2\t6.2124211716307975\nvirginica\t5.3\t6.2124211716307975\nvirginica\t5.4\t6.2124211716307975\nvirginica\t5.7\t6.2124211716307975\nvirginica\t5.9\t6.2124211716307975\nvirginica\t6.1\t6.2124211716307975\nvirginica\t6.9\t6.2124211716307975\nvirginica\t5.1\t6.435415221142984\nvirginica\t5.6\t6.435415221142984\nvirginica\t5.6\t6.435415221142984\nvirginica\t6.0\t6.658409270655172\nvirginica\t5.7\t6.658409270655172\nvirginica\t6.1\t6.658409270655172\n"}]},"interrupted":false,"jobName":"paragraph_1633125924379_-870276271","id":"20211001-220524_1145806372","dateCreated":"2021-10-01T22:05:24+0000","dateStarted":"2021-10-07T00:16:26+0000","dateFinished":"2021-10-07T00:16:27+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:63"},{"title":"Store the script into the OML Script repository as a Python script","text":"%python\n\noml.script.create(\"score_mod\", \n func=score_mod, \n overwrite=True,\n description='Prediction of petal length using scikit-learn')","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:28+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{"0":{"graph":{"mode":"table","height":300,"optionOpen":false,"setting":{"table":{"tableGridState":{},"tableColumnTypeState":{"names":{"PETAL_WIDTH":"string","PRED_PETAL_WIDTH":"string"},"updated":false},"tableOptionSpecHash":"[{\"name\":\"useFilter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable filter for columns\"},{\"name\":\"showPagination\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable pagination for better navigation\"},{\"name\":\"showAggregationFooter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable a footer for displaying aggregated values\"}]","tableOptionValue":{"useFilter":false,"showPagination":false,"showAggregationFooter":false},"updated":false,"initialized":false}},"commonSetting":{}}}},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","title":true,"editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[]},"interrupted":false,"jobName":"paragraph_1622762678316_577535870","id":"20210603-232438_1287518119","dateCreated":"2021-01-13T01:00:19+0000","dateStarted":"2021-10-07T00:16:28+0000","dateFinished":"2021-10-07T00:16:28+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:64"},{"title":"Check the contents of the script","text":"%python\n\nz.show(oml.script.dir(name=\"score_mod\", regex_match=True, sctype=\"all\"))","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:28+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{"0":{"graph":{"mode":"table","height":300,"optionOpen":false,"setting":{"table":{"tableGridState":{},"tableColumnTypeState":{"names":{"owner":"string","name":"string","script":"string","description":"string","date":"string"},"updated":false},"tableOptionSpecHash":"[{\"name\":\"useFilter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable filter for columns\"},{\"name\":\"showPagination\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable pagination for better navigation\"},{\"name\":\"showAggregationFooter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable a footer for displaying aggregated values\"}]","tableOptionValue":{"useFilter":false,"showPagination":false,"showAggregationFooter":false},"updated":false,"initialized":false}},"commonSetting":{}}}},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","title":true,"editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TABLE","data":"owner\tname\tscript\tdescription\tdate\nOMLUSER02\tscore_mod\tdef score_mod(dat): import pandas as pd import oml obj_dict = oml.ds.load(name=\"ds_mod\", to_globals=False) regr = obj_dict[\"mod\"] pred = regr.predict(dat[['PETAL_WIDTH']]) return pd.concat([dat[['SPECIES', 'PETAL_LENGTH']], pd.DataFrame(pred,columns=['Pred_PETAL_WIDTH'])], axis=1)\tPrediction of petal length using scikit-learn\t2021-10-07 00:16:28\n"}]},"interrupted":false,"jobName":"paragraph_1622762678316_-1082886493","id":"20210603-232438_1195963431","dateCreated":"2021-01-13T01:06:30+0000","dateStarted":"2021-10-07T00:16:29+0000","dateFinished":"2021-10-07T00:16:29+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:65"},{"text":"%md\n\nFinally, note that a function stored in the Python Script Repository can be loaded back in the Python client engine, we can view its source, and finally invoke the function.\n\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:25:20+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

Finally, note that a function stored in the Python Script Repository can be loaded back in the Python client engine, we can view its source, and finally invoke the function.

\n"}]},"interrupted":false,"jobName":"paragraph_1633547827587_-216053473","id":"20211006-191707_2114986886","dateCreated":"2021-10-06T19:17:07+0000","dateStarted":"2021-10-07T00:16:29+0000","dateFinished":"2021-10-07T00:16:29+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:66"},{"text":"%python\n\nscore_mod_load = oml.script.load('score_mod')\n\nprint(score_mod_load.get_source())\n\nscore_mod_load(iris_df)\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:16:29+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"text","editOnDblClick":false},"editorMode":"ace/mode/text","editorHide":false},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TEXT","data":"def score_mod(dat):\n import pandas as pd\n import oml\n obj_dict = oml.ds.load(name=\"ds_mod\", to_globals=False) \n regr = obj_dict[\"mod\"] \n pred = regr.predict(dat[['PETAL_WIDTH']]) \n return pd.concat([dat[['SPECIES', 'PETAL_LENGTH']],\n pd.DataFrame(pred,columns=['Pred_PETAL_WIDTH'])], axis=1)\n SPECIES PETAL_LENGTH Pred_PETAL_WIDTH\n0 setosa 1.4 1.529546\n1 setosa 1.4 1.529546\n2 setosa 1.3 1.529546\n3 setosa 1.5 1.529546\n4 setosa 1.4 1.529546\n.. ... ... ...\n145 virginica 5.2 6.212421\n146 virginica 5.0 5.320445\n147 virginica 5.2 5.543439\n148 virginica 5.4 6.212421\n149 virginica 5.1 5.097451\n\n[150 rows x 3 columns]\n"}]},"interrupted":false,"jobName":"paragraph_1633548195473_-1294207378","id":"20211006-192315_1528253304","dateCreated":"2021-10-06T19:23:15+0000","dateStarted":"2021-10-07T00:16:30+0000","dateFinished":"2021-10-07T00:16:30+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:67"},{"text":"%md\n\n# Score the model using the REST interface for Embedded Python Execution\n\nUsing any client that supports REST calls, such as cURL or Postman, you can invoke scripts in the OML4Py script repository from a REST client. The OML4Py REST API includes endpoints for listing and running user-defined Python functions, also referred to as scripts, saved in the OML4Py script respository.\n\nA typical workflow includes:\n\n- Authenticating to the Autonomous Database service \n- Creating a user-defined Python function and saving it as a named script in the OML4Py script repository\n- Invoking the saved script from the REST client\n\nThe result of the REST invocation is a JSON representation of the value returned from the Python script. Dataframes, lists, and dictionaries and PNG images are supported.\n\nFrom the REST API, you can specify the Autonomous Database service level to use with the optional service argument. The service names are `LOW`, `MEDIUM`, and `HIGH`. The service names provide different levels of performance and concurrency for an Autonomous Database. The default parallelism for service levels LOW/MEDIUM/HIGH are 2/4/8, respectively.\n\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:25:25+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

Score the model using the REST interface for Embedded Python Execution

\n

Using any client that supports REST calls, such as cURL or Postman, you can invoke scripts in the OML4Py script repository from a REST client. The OML4Py REST API includes endpoints for listing and running user-defined Python functions, also referred to as scripts, saved in the OML4Py script respository.

\n

A typical workflow includes:

\n
    \n
  • Authenticating to the Autonomous Database service
  • \n
  • Creating a user-defined Python function and saving it as a named script in the OML4Py script repository
  • \n
  • Invoking the saved script from the REST client
  • \n
\n

The result of the REST invocation is a JSON representation of the value returned from the Python script. Dataframes, lists, and dictionaries and PNG images are supported.

\n

From the REST API, you can specify the Autonomous Database service level to use with the optional service argument. The service names are LOW, MEDIUM, and HIGH. The service names provide different levels of performance and concurrency for an Autonomous Database. The default parallelism for service levels LOW/MEDIUM/HIGH are 2/4/8, respectively.

\n"}]},"interrupted":false,"jobName":"paragraph_1633120026104_891113088","id":"20211001-202706_161206126","dateCreated":"2021-10-01T20:27:06+0000","dateStarted":"2021-10-07T00:16:31+0000","dateFinished":"2021-10-07T00:16:31+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:68"},{"text":"%md\n\n### **REST API Authentication**\n\nTo authenticate and obtain a token, use `cURL` with the `-d` option to pass the credentials for your Oracle Machine Learning account against the Autonomous Database Cloud Service token endpoint */oauth2/v1/token*. \n\n $ curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{\"grant_type\":\"password\", \"username\":\"''\", \n \"password\":\"''\"}' \"/omlusers/tenants//databases//api/oauth2/v1/token\"\n \nwhere \n\n* _-X POST_ specifies to use a POST request when communicating with the HTTP server\n* _--header_ defines the headers required for the request (application/json)\n* _-d _ sends the username and password authentication credentials as data in a POST request to the HTTP server\n* _Content-Type_ and _Accept_ define the response format (JSON)\n* _yourusername_ is the user name of a Oracle Machine Learning user with the default OML_DEVELOPER role\n* _yourpassword_ is the password for the user name\n* _autonomous-database-url_ is the REST server portion of the Oracle Machine Learning user management cloud service instance\n* _tenant_ is the name of the tenancy\n* _database_ is the target database\n\nFor example, Oracle Machine Learning user ***OMLUSER*** with password ***OMLPASSWD*** and Database ***MYADB*** authenticates and obtain a REST token using the following approach:\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:25:32+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

REST API Authentication

\n

To authenticate and obtain a token, use cURL with the -d option to pass the credentials for your Oracle Machine Learning account against the Autonomous Database Cloud Service token endpoint /oauth2/v1/token.

\n
$ curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{\"grant_type\":\"password\", \"username\":\"'<yourusername>'\", \n\"password\":\"'<yourpassword>'\"}' \"<autonomous-database-url>/omlusers/tenants/<tenant>/databases/<database>/api/oauth2/v1/token\"\n
\n

where

\n
    \n
  • -X POST specifies to use a POST request when communicating with the HTTP server
  • \n
  • –header defines the headers required for the request (application/json)
  • \n
  • -d sends the username and password authentication credentials as data in a POST request to the HTTP server
  • \n
  • Content-Type and Accept define the response format (JSON)
  • \n
  • yourusername is the user name of a Oracle Machine Learning user with the default OML_DEVELOPER role
  • \n
  • yourpassword is the password for the user name
  • \n
  • autonomous-database-url is the REST server portion of the Oracle Machine Learning user management cloud service instance
  • \n
  • tenant is the name of the tenancy
  • \n
  • database is the target database
  • \n
\n

For example, Oracle Machine Learning user OMLUSER with password OMLPASSWD and Database MYADB authenticates and obtain a REST token using the following approach:

\n"}]},"interrupted":false,"jobName":"paragraph_1633126804984_-412165115","id":"20211001-222004_1393087411","dateCreated":"2021-10-01T22:20:04+0000","dateStarted":"2021-10-07T00:16:31+0000","dateFinished":"2021-10-07T00:16:31+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:69"},{"title":"Environment variables for REST invocation","text":"\n$ export omlserver=https://adb.us-sanjose-1.oraclecloud.com\n$ export tenant=OCID1.TENANCY.OC1..AAA....\n$ export username=OMLUSER\n$ export password=OMLPASSWD\n$ export database=MYADB","user":"OMLUSER02","dateUpdated":"2021-10-07T00:15:21+0000","config":{"colWidth":12,"fontSize":9,"enabled":false,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/osql","title":true,"editorHide":false},"settings":{"params":{},"forms":{}},"interrupted":false,"jobName":"paragraph_1622762678316_-446686942","id":"20210603-232438_216637348","dateCreated":"2021-01-13T02:44:28+0000","status":"READY","progressUpdateIntervalMs":500,"commited":false,"$$hashKey":"object:70"},{"title":"Token authorization","text":"$ curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' \n -d '{\"grant_type\":\"password\", \"username\":\"'${username}'\", \"password\":\"'${password}'\"}' \n \"${omlserver}/omlusers/tenants/${tenant}/databases/${database}/api/oauth2/v1/token\"","user":"OMLUSER02","dateUpdated":"2021-10-07T00:15:21+0000","config":{"colWidth":12,"fontSize":9,"enabled":false,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/osql","title":true,"editorHide":false},"settings":{"params":{},"forms":{}},"interrupted":false,"jobName":"paragraph_1633279073510_-1429462453","id":"20211003-163753_935806302","dateCreated":"2021-10-03T16:37:53+0000","status":"READY","progressUpdateIntervalMs":500,"commited":false,"$$hashKey":"object:71"},{"text":"%md\n\nCopy the `accessToken` field from the response and assign it to variable token, surrounded by single quotes.\n\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:25:39+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

Copy the accessToken field from the response and assign it to variable token, surrounded by single quotes.

\n"}]},"interrupted":false,"jobName":"paragraph_1633130041788_1415756282","id":"20211001-231401_1633883964","dateCreated":"2021-10-01T23:14:01+0000","dateStarted":"2021-10-07T00:16:32+0000","dateFinished":"2021-10-07T00:16:32+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:72"},{"text":"$ export token='eyJhbGciOiJ...'","user":"OMLUSER02","dateUpdated":"2021-10-07T00:15:21+0000","config":{"colWidth":12,"fontSize":9,"enabled":false,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/osql","editorHide":false},"settings":{"params":{},"forms":{}},"interrupted":false,"jobName":"paragraph_1633130301193_170627051","id":"20211001-231821_1203478551","dateCreated":"2021-10-01T23:18:21+0000","status":"READY","progressUpdateIntervalMs":500,"commited":false,"$$hashKey":"object:73"},{"text":"%md\n\nInvoke the `score_mod` function in the script repository from the REST API using a `POST` request via `cURL`. Set `parallelFlag` to `true` to leverage Database parallelism according to the \nAutonomous Database service level specfied in the `service` parameter. The default REST API execution mode is *synchronous*, so code execution will wait for the REST API call to return before additional calls may be initiated. Asynchronous mode is also supported.\n\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:20:42+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

Invoke the score_mod function in the script repository from the REST API using a POST request via cURL. Set parallelFlag to true to leverage Database parallelism according to the\n
Autonomous Database service level specfied in the service parameter. The default REST API execution mode is synchronous, so code execution will wait for the REST API call to return before additional calls may be initiated. Asynchronous mode is also supported.

\n"}]},"interrupted":false,"jobName":"paragraph_1633130129391_1525092180","id":"20211001-231529_1420162791","dateCreated":"2021-10-01T23:15:29+0000","dateStarted":"2021-10-07T00:16:33+0000","dateFinished":"2021-10-07T00:16:33+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:74"},{"title":"cURL command for REST API invocation","text":"$ curl -i -X POST --header \"Authorization: Bearer ${token}\" \\\n--header 'Content-Type: application/json' --header 'Accept: application/json' \\\n-d '{\"input\":\"select * from IRIS\", \"parameters\":\"{\\\"oml_input_type\\\":\\\"pandas.DataFrame\\\"}\", \"rows\":10, \"parallelFlag\":true, \"service\":\"MEDIUM\"}' \\\n\"${omlserver}/oml/tenants/${tenant}/databases/${database}/api/py-scripts/v1/row-apply/score_mod\"","user":"OMLUSER02","dateUpdated":"2021-10-07T00:15:21+0000","config":{"colWidth":12,"fontSize":9,"enabled":false,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/osql","title":true,"editorHide":false},"settings":{"params":{},"forms":{}},"interrupted":false,"jobName":"paragraph_1633203548837_-532059924","id":"20211002-193908_1323109359","dateCreated":"2021-10-02T19:39:08+0000","status":"READY","progressUpdateIntervalMs":500,"commited":false,"$$hashKey":"object:75"},{"text":"%md\n\nA portion of the returned value is below.\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:25:44+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

A portion of the returned value is below.

\n"}]},"interrupted":false,"jobName":"paragraph_1633222905341_-1467203208","id":"20211003-010145_924690300","dateCreated":"2021-10-03T01:01:45+0000","dateStarted":"2021-10-07T00:16:33+0000","dateFinished":"2021-10-07T00:16:33+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:76"},{"text":"%md\n\nHTTP/1.0 200 Connection established\n\nHTTP/1.1 200 OK\nDate: Sun, 03 Oct 2021 01:00:47 GMT\nContent-Type: application/json\nTransfer-Encoding: chunked\nConnection: keep-alive\nCache-Control: no-cache, no-store, must-revalidate\nPragma: no-cache\nX-Frame-Options: SAMEORIGIN\nX-XSS-Protection: 1;mode=block\nStrict-Transport-Security: max-age=31536000; includeSubDomains\nX-Content-Type-Options: nosniff\nContent-Security-Policy: frame-ancestors 'none'\nSet-Cookie: JSESSIONID=node0dktjr18l0u5q1n2sysibp685f26.node0; Path=/oml; Secure; HttpOnly\nExpires: Thu, 01 Jan 1970 00:00:00 GMT\n\n{\"result\":[{\"PETAL_LENGTH\":1,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.5295461319},{\"PETAL_LENGTH\":3,\"SPECIES\":\"versicolor\",\"Pred_PETAL_WIDTH\":3.5364925775},{\"PETAL_LENGTH\":4,\"SPECIES\":\"versicolor\",\"Pred_PETAL_WIDTH\":3.313498528},{\"PETAL_LENGTH\":4,\"SPECIES\":\"versicolor\",\"Pred_PETAL_WIDTH\":3.759486627},{\"PETAL_LENGTH\":4,\"SPECIES\":\"versicolor\",\"Pred_PETAL_WIDTH\":3.9824806765},{\"PETAL_LENGTH\":4,\"SPECIES\":\"versicolor\",\"Pred_PETAL_WIDTH\":3.9824806765},{\"PETAL_LENGTH\":4,\"SPECIES\":\"versicolor\",\"Pred_PETAL_WIDTH\":3.9824806765},{\"PETAL_LENGTH\":5,\"SPECIES\":\"virginica\",\"Pred_PETAL_WIDTH\":5.5434390231},{\"PETAL_LENGTH\":5,\"SPECIES\":\"virginica\",\"Pred_PETAL_WIDTH\":4.4284687755},{\"PETAL_LENGTH\":5,\"SPECIES\":\"virginica\",\"Pred_PETAL_WIDTH\":5.3204449736},{\"PETAL_LENGTH\":5,\"SPECIES\":\"versicolor\",\"Pred_PETAL_WIDTH\":4.8744568746},{\"PETAL_LENGTH\":6,\"SPECIES\":\"virginica\",\"Pred_PETAL_WIDTH\":5.0974509241},{\"PETAL_LENGTH\":6,\"SPECIES\":\"virginica\",\"Pred_PETAL_WIDTH\":6.6584092707},{\"PETAL_LENGTH\":1.1,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.3065520824},{\"PETAL_LENGTH\":1.2,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.5295461319},{\"PETAL_LENGTH\":1.2,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.5295461319},{\"PETAL_LENGTH\":1.3,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.5295461319},{\"PETAL_LENGTH\":1.3,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.5295461319},{\"PETAL_LENGTH\":1.3,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.5295461319},{\"PETAL_LENGTH\":1.3,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.5295461319},{\"PETAL_LENGTH\":1.3,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.7525401814},{\"PETAL_LENGTH\":1.3,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.7525401814},{\"PETAL_LENGTH\":1.3,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.9755342309},{\"PETAL_LENGTH\":1.4,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.3065520824},{\"PETAL_LENGTH\":1.4,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.3065520824},{\"PETAL_LENGTH\":1.4,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.5295461319},{\"PETAL_LENGTH\":1.4,\"SPECIES\":\"setosa\",\"Pred_PETAL_WIDTH\":1.5295461319},{\"PETAL_LENGTH\":1.4,\"SPECIES\":.......\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:15:21+0000","config":{"colWidth":12,"fontSize":9,"enabled":false,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":false},"settings":{"params":{},"forms":{}},"interrupted":false,"jobName":"paragraph_1633222863951_1127811903","id":"20211003-010103_1897246967","dateCreated":"2021-10-03T01:01:03+0000","status":"READY","progressUpdateIntervalMs":500,"commited":false,"$$hashKey":"object:77"},{"title":"The equivalent command for SQL interface invocation ","text":"%md\n\nThe OML4Py SQL interface equivalent to `row-apply` is `pyqRowEval`. The SQL interface enables interactive execution from any SQL interface, like SQL*Plus or SQL Developer. It enables returning structured Python results in a table. Results can also be returned as XML. The XML interface enables both structured data, such as DataFrames, Pythons objects, and images to be returned. The XML capability allows Python graphs and structured results to be displayed in dashboards, for example, in Oracle BI Publisher documents and OBIEE.\n\nIn a SQL Developer session, run a SELECT statement that invokes the `pyqRowEval` function to run the `score_mod` function on each chunk of rows in the table.\n\nThe function contains the following inputs:\n\n pyqRowEval (\n INP_QRY VARCHAR2 IN\n PAR_QRY VARCHAR2 IN\n OUT_QRY VARCHAR2 IN\n ROW_NUM NUMBER IN\n EXP_NAM VARCHAR2 IN)\n\n- The `INP_QRY` argument specifies the data in the *IRIS* table to pass to the Python function\n- The `PAR_QRY` argument specifies connecting to the OML4Py server with the special control argument `oml_connect`, passing the input data as a *pandas.DataFrame* with the special control argument *oml_input_type*, along with values for the function arguments modelName *mod* and datastoreName *ds_mod*\n- In the `OUT_QRY` argument, the JSON string specifies the column names and data types of the table returned by pyqRowEval\n- The `ROW_NUM` argument specifies that *10* rows are included in each invocation of the function specified by EXP_NAM\n- The `EXP_NAM` parameter specifies *score_mod*, which is the name in the script repository of the user-defined Python function to invoke\n\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:20:52+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","title":true,"editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

The OML4Py SQL interface equivalent to row-apply is pyqRowEval. The SQL interface enables interactive execution from any SQL interface, like SQL*Plus or SQL Developer. It enables returning structured Python results in a table. Results can also be returned as XML. The XML interface enables both structured data, such as DataFrames, Pythons objects, and images to be returned. The XML capability allows Python graphs and structured results to be displayed in dashboards, for example, in Oracle BI Publisher documents and OBIEE.

\n

In a SQL Developer session, run a SELECT statement that invokes the pyqRowEval function to run the score_mod function on each chunk of rows in the table.

\n

The function contains the following inputs:

\n
pyqRowEval (\n    INP_QRY     VARCHAR2       IN\n    PAR_QRY     VARCHAR2       IN\n    OUT_QRY     VARCHAR2       IN\n    ROW_NUM     NUMBER         IN\n    EXP_NAM     VARCHAR2       IN)\n
\n
    \n
  • The INP_QRY argument specifies the data in the IRIS table to pass to the Python function
  • \n
  • The PAR_QRY argument specifies connecting to the OML4Py server with the special control argument oml_connect, passing the input data as a pandas.DataFrame with the special control argument oml_input_type, along with values for the function arguments modelName mod and datastoreName ds_mod
  • \n
  • In the OUT_QRY argument, the JSON string specifies the column names and data types of the table returned by pyqRowEval
  • \n
  • The ROW_NUM argument specifies that 10 rows are included in each invocation of the function specified by EXP_NAM
  • \n
  • The EXP_NAM parameter specifies score_mod, which is the name in the script repository of the user-defined Python function to invoke
  • \n
\n"}]},"interrupted":false,"jobName":"paragraph_1633115626779_-249673526","id":"20211001-191346_1972847645","dateCreated":"2021-10-01T19:13:46+0000","dateStarted":"2021-10-07T00:16:34+0000","dateFinished":"2021-10-07T00:16:34+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:78"},{"title":"SQL invocation","text":"\r\nSQL> SELECT *\r\n FROM table(pyqRowEval(\r\n 'IRIS', # table or view\r\n '{\"oml_connect\":1,\"oml_input_type\":\"pandas.DataFrame\"}', # arguments\r\n '{\"SPECIES\":\"varchar2(10)\", \"PETAL_LENGTH\":\"number\", \r\n \"Pred_PETAL_LENGTH\":\"number\"}', # return format\r\n 10, # rows per invocation\r\n 'score_mod')) # function name","user":"OMLUSER02","dateUpdated":"2021-10-07T00:15:21+0000","config":{"colWidth":12,"fontSize":9,"enabled":false,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/osql","title":true,"editorHide":false},"settings":{"params":{},"forms":{}},"interrupted":false,"jobName":"paragraph_1633218936301_-655852794","id":"20211002-235536_296171964","dateCreated":"2021-10-02T23:55:36+0000","status":"READY","progressUpdateIntervalMs":500,"commited":false,"$$hashKey":"object:79"},{"text":"%md\n\nA portion of the output is below.\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:25:49+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

A portion of the output is below.

\n"}]},"interrupted":false,"jobName":"paragraph_1633415459760_2088072397","id":"20211005-063059_1334606037","dateCreated":"2021-10-05T06:30:59+0000","dateStarted":"2021-10-07T00:16:34+0000","dateFinished":"2021-10-07T00:16:34+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:80"},{"text":"SPECIES PETAL_LENGTH Pred_PETAL_LENGTH\n---------- ------------ -----------------\nsetosa 1.4 1.52954613\nsetosa 1.4 1.52954613\nsetosa 1.3 1.52954613\nsetosa 1.5 1.52954613\nsetosa 1.4 1.52954613\nsetosa 1.7 1.97553423\nsetosa 1.4 1.75254018\nsetosa 1.5 1.52954613\nsetosa 1.4 1.52954613\nsetosa 1.5 1.30655208\nsetosa 1.5 1.52954613\n\n\n ","user":"OMLUSER02","dateUpdated":"2021-10-07T00:15:21+0000","config":{"colWidth":12,"fontSize":9,"enabled":false,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/osql","editorHide":false},"settings":{"params":{},"forms":{}},"interrupted":false,"jobName":"paragraph_1633284788413_-963032193","id":"20211003-181308_792463037","dateCreated":"2021-10-03T18:13:08+0000","dateStarted":"2021-10-05T06:25:32+0000","dateFinished":"2021-10-05T06:25:35+0000","status":"FINISHED","errorMessage":"","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:81"},{"text":"%md\n\n# End of Script\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:20:58+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"

End of Script

\n"}]},"interrupted":false,"jobName":"paragraph_1622762678316_-397919138","id":"20210603-232438_1402455426","dateCreated":"2021-01-13T03:33:34+0000","dateStarted":"2021-10-07T00:16:35+0000","dateFinished":"2021-10-07T00:16:35+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:82"},{"text":"%md\n","user":"OMLUSER02","dateUpdated":"2021-10-07T00:15:21+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":false},"settings":{"params":{},"forms":{}},"interrupted":false,"jobName":"paragraph_1622762745489_-366825338","id":"20210603-232545_1066677248","dateCreated":"2021-06-03T23:25:45+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:83"}],"name":"OML4Py: Embedded execution using third-party packages","id":"58951","noteParams":{},"noteForms":{},"angularObjects":{"ORA96849F3DDA:OMLUSER02:58951":[],"ORA7A60DC9B32:OMLUSER02:58951":[],"ORA7CC90ACC73:OMLUSER02:58951":[],"MDW381939C745:shared_process":[]},"config":{"looknfeel":"default","personalizedMode":"false"},"info":{}}