Skip to content

Commit fb1d93c

Browse files
authored
New Notebook and Updated Read.me on OML4Py Labs (#146)
* Update to OML4Py Labs with a Run Me First Update to OML4Py Labs with a Run Me First notebook needed to setup all Labs * Updated the Read.me file Updated the Read.me file with more details on the notebooks
1 parent d7aa982 commit fb1d93c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"paragraphs":[{"text":"%md\n# Run Me First - Oracle Machine Learning for Python (OML4Py)\n\n***Oracle Machine Learning for Python*** (OML4Py) makes the open source Python scripting language and environment ready for the enterprise and big data. Designed for problems involving both large and small data volumes, OML4Py integrates Python with Oracle Autonomous Database, allowing users to run Python commands and scripts for statistical, machine learning, and visualization analyses on database tables and views using Python syntax. Many familiar Python functions are overloaded that translate Python behavior into SQL for running in-database, as well as new automatic machine learning capabilities.\n\n### The following commands should be executed before running the Labs, since it creates some tables and grants access to any users of the PDB.\n\nCopyright (c) 2021 Oracle Corporation \n###### [The Universal Permissive License (UPL), Version 1.0](https://oss.oracle.com/licenses/upl/)","user":"OMLUSER","dateUpdated":"2021-02-23T04:54:33+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":"<h1>Run Me First - Oracle Machine Learning for Python (OML4Py)</h1>\n<p><strong><em>Oracle Machine Learning for Python</em></strong> (OML4Py) makes the open source Python scripting language and environment ready for the enterprise and big data. Designed for problems involving both large and small data volumes, OML4Py integrates Python with Oracle Autonomous Database, allowing users to run Python commands and scripts for statistical, machine learning, and visualization analyses on database tables and views using Python syntax. Many familiar Python functions are overloaded that translate Python behavior into SQL for running in-database, as well as new automatic machine learning capabilities.</p>\n<h3>The following commands should be executed before running the Labs, since it creates some tables and grants access to any users of the PDB.</h3>\n<p>Copyright (c) 2021 Oracle Corporation</p>\n<h6><a href=\"https://oss.oracle.com/licenses/upl/\">The Universal Permissive License (UPL), Version 1.0</a></h6>\n"}]},"interrupted":false,"jobName":"paragraph_1614055277204_1429993038","id":"20210223-044117_1084738104","dateCreated":"2021-02-23T04:41:17+0000","dateStarted":"2021-02-23T04:54:27+0000","dateFinished":"2021-02-23T04:54:29+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"focus":true,"$$hashKey":"object:296"},{"text":"%python\n\nimport oml\n\nfrom sklearn import datasets\nfrom sklearn import linear_model\nimport pandas as pd\n\niris = datasets.load_iris()\nx = pd.DataFrame(iris.data, 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)), columns = ['SPECIES'])\n\ntry:\n oml.drop(table='IRIS')\nexcept:\n pass\n\nIRIS = oml.create(pd.concat([x, y], axis=1), table = 'IRIS')\niris_df = pd.concat([x, y], axis=1)\nprint(IRIS.columns)","user":"OMLUSER","dateUpdated":"2021-02-23T04:55:34+0000","config":{"colWidth":12,"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}},"enabled":true,"editorMode":"ace/mode/undefined","fontSize":9,"results":{},"editorSetting":{"language":"text","editOnDblClick":false},"title":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TEXT","data":"['SEPAL_LENGTH', 'SEPAL_WIDTH', 'PETAL_LENGTH', 'PETAL_WIDTH', 'SPECIES']\n"}]},"interrupted":false,"jobName":"paragraph_1611446871281_-527856967","id":"20210124-000751_741842202","dateCreated":"2021-01-21T00:08:49+0000","dateStarted":"2021-01-24T00:08:34+0000","dateFinished":"2021-01-24T00:08:45+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:297","title":"Pushes the IRIS Table from SciKit Learn to Oracle Database"},{"text":"%python\n\nimport oml\nimport pandas as pd\nimport matplotlib.pyplot as plt\nfrom sklearn.datasets import load_wine\n\ntry:\n oml.drop(table=\"WINE\")\nexcept:\n pass\n\nwine = load_wine()\n\nx = pd.DataFrame(wine.data, columns = wine[\"feature_names\"])\ny = pd.DataFrame(list(map(lambda x: {0:'class_0', 1: 'class_1', 2:'class_2'}[x], wine.target)), columns = ['target'])\n\nwine_df = pd.concat([x,y], axis=1)\nWINE = oml.create(wine_df, table = \"WINE\")","user":"OMLUSER","dateUpdated":"2021-02-23T04:56:29+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","title":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[]},"interrupted":false,"jobName":"paragraph_1611446871281_773455953","id":"20210124-000751_749705619","dateCreated":"2021-01-21T08:15:26+0000","dateStarted":"2021-01-24T00:08:48+0000","dateFinished":"2021-01-24T00:08:49+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:298","title":"Pushes the WINE Table from SciKit Learn to Oracle Database"},{"text":"%python\n\nimport pandas as pd\nfrom sklearn.datasets import load_digits\n\ndigits = load_digits()\npd_digits = pd.DataFrame(digits.data, columns=['IMG'+str(i) for i in range(digits['data'].shape[1])])\npd_digits = pd.concat([pd_digits, pd.Series(digits.target,name = 'target')], axis = 1)\n\ntry:\n oml.drop(table=\"DIGITS\")\nexcept:\n pass\n \nDIGITS = oml.create(pd_digits, table = \"DIGITS\")","user":"OMLUSER","dateUpdated":"2021-02-23T04:56:50+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/undefined","title":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[]},"interrupted":false,"jobName":"paragraph_1611446871281_-1345502953","id":"20210124-000751_1744051901","dateCreated":"2021-01-23T23:04:32+0000","dateStarted":"2021-01-24T00:08:52+0000","dateFinished":"2021-01-24T00:08:53+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:299","title":"Pushes the DIGITS Table from SciKit Learn to Oracle Database"},{"text":"%md\n## Create VIEWS for the TABLES\n---\n","user":"OMLUSER","dateUpdated":"2021-02-23T04:57:14+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"interrupted":false,"jobName":"paragraph_1614056210891_-698601155","id":"20210223-045650_1224491736","dateCreated":"2021-02-23T04:56:50+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":false,"focus":true,"$$hashKey":"object:594","dateFinished":"2021-02-23T04:57:10+0000","dateStarted":"2021-02-23T04:57:10+0000","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<h2>Create VIEWS for the TABLES</h2>\n<hr />\n"}]}},{"text":"%sql\n\nCREATE OR REPLACE view IRIS_VIEW as select * from IRIS;\n","user":"OMLUSER","dateUpdated":"2021-01-24T00:08:53+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/osql"},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[]},"interrupted":false,"jobName":"paragraph_1611446871282_-2008565406","id":"20210124-000751_193809375","dateCreated":"2021-01-21T08:04:34+0000","dateStarted":"2021-01-24T00:08:56+0000","dateFinished":"2021-01-24T00:09:07+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:300"},{"text":"%sql\n\nCREATE OR REPLACE view WINE_VIEW as select * from WINE;\n","user":"OMLUSER","dateUpdated":"2021-01-24T00:09:07+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/osql"},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[]},"interrupted":false,"jobName":"paragraph_1611446871282_-1530685919","id":"20210124-000751_465754361","dateCreated":"2021-01-23T22:54:41+0000","dateStarted":"2021-01-24T00:09:09+0000","dateFinished":"2021-01-24T00:09:09+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:301"},{"text":"%sql\n\nCREATE OR REPLACE view DIGITS_VIEW as select * from DIGITS;","user":"OMLUSER","dateUpdated":"2021-01-24T00:09:10+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"sql","editOnDblClick":false},"editorMode":"ace/mode/osql"},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[]},"interrupted":false,"jobName":"paragraph_1611446871282_-1168055607","id":"20210124-000751_1274128659","dateCreated":"2021-01-23T23:05:12+0000","dateStarted":"2021-01-24T00:09:13+0000","dateFinished":"2021-01-24T00:09:13+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:302"},{"user":"OMLUSER","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"md","editOnDblClick":false},"editorMode":"ace/mode/markdown","editorHide":true},"settings":{"params":{},"forms":{}},"interrupted":false,"jobName":"paragraph_1614056558796_646905158","id":"20210223-050238_2143109820","dateCreated":"2021-02-23T05:02:38+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":false,"focus":true,"$$hashKey":"object:6668","text":"%md\n## Grants all users of the PDB access to the tables and Views\n---","dateUpdated":"2021-02-23T05:03:15+0000","dateFinished":"2021-02-23T05:03:11+0000","dateStarted":"2021-02-23T05:03:11+0000","results":{"code":"SUCCESS","msg":[{"type":"HTML","data":"<h2>Grants all users of the PDB access to the tables and Views</h2>\n<hr />\n"}]}},{"text":"%script\n\n\nBEGIN\n FOR t IN (SELECT * FROM user_tables where TABLE_NAME IN ('IRIS','WINE','DIGITS') )\n LOOP \n EXECUTE IMMEDIATE 'GRANT SELECT ON ' || t.table_name || ' TO PUBLIC'; \n END LOOP;\nEND;\n/\n","user":"OMLUSER","dateUpdated":"2021-02-23T05:05:04+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"plsql","editOnDblClick":false},"editorMode":"ace/mode/plsql","title":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TEXT","data":"\nPL/SQL procedure successfully completed.\n\n\n---------------------------\n"}]},"interrupted":false,"jobName":"paragraph_1611446871282_958179893","id":"20210124-000751_213337894","dateCreated":"2021-01-21T00:09:01+0000","dateStarted":"2021-02-23T05:02:24+0000","dateFinished":"2021-02-23T05:02:24+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:303","title":"Grants access to the Tables"},{"text":"%script\n\nBEGIN\n FOR t IN (SELECT * FROM user_views where VIEW_NAME IN ('IRIS_VIEW','WINE_VIEW','DIGITS_VIEW') ) \n LOOP \n EXECUTE IMMEDIATE 'GRANT SELECT ON ' || t.view_name || ' TO PUBLIC'; \n END LOOP;\nEND;\n/\n\n","user":"OMLUSER","dateUpdated":"2021-02-23T05:05:16+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"plsql","editOnDblClick":false},"editorMode":"ace/mode/plsql","title":true},"settings":{"params":{},"forms":{}},"results":{"code":"SUCCESS","msg":[{"type":"TEXT","data":"\nPL/SQL procedure successfully completed.\n\n\n---------------------------\n"}]},"interrupted":false,"jobName":"paragraph_1611446871282_-173431534","id":"20210124-000751_1829058268","dateCreated":"2021-01-21T00:09:40+0000","dateStarted":"2021-02-23T05:04:58+0000","dateFinished":"2021-02-23T05:04:58+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:304","title":"Grants access to the Views"},{"text":"%script\n","user":"OMLUSER","dateUpdated":"2021-01-24T00:09:20+0000","config":{"colWidth":12,"fontSize":9,"enabled":true,"results":{},"editorSetting":{"language":"plsql","editOnDblClick":false},"editorMode":"ace/mode/plsql"},"settings":{"params":{},"forms":{}},"interrupted":false,"jobName":"paragraph_1611446871282_-1161368599","id":"20210124-000751_1619869333","dateCreated":"2021-01-23T23:05:55+0000","status":"FINISHED","progressUpdateIntervalMs":500,"commited":true,"$$hashKey":"object:305"}],"name":"Lab 0: Run Me First - OML4Py table creation and grants","id":"466369","noteParams":{},"noteForms":{},"angularObjects":{"ORA96849F3DDA:shared_process":[],"ORA7A60DC9B32:shared_process":[],"ORA7CC90ACC73:shared_process":[],"MDWA0063E96A6:shared_process":[]},"config":{"looknfeel":"default","personalizedMode":"false"},"info":{}}

machine-learning/labs/oml4py-live-labs/README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ Key Features:
1313
* Python, SQL and PL/SQL scripting language supported
1414
* Enables and supports deployments of enterprise machine learning methodologies in Autonomous Data Warehouse (ADW), Autonomous Transactional Database (ATP) and Autonomous JSON Database (AJD)
1515

16-
This current folder contains the examples based on Oracle Machine Learning for Python (OML4Py) used for the Developer Live Labs from January 2021
16+
This current folder contains the examples based on Oracle Machine Learning for Python (OML4Py) used for the Developer Live Labs from January 2021:
17+
18+
* Lab 0 Run Me First OML4Py table creation and grants - please execute this notebook first, since it contains tables and views used by the Labs
19+
* Lab 1 Getting Started with OML4Py - Basic Introduction to the OML Notebooks environment and layout
20+
* Lab 2 OML4Py Transparency Layer - Examples on how to use Transparency Layer from Python
21+
* Lab 3 OML4Py Algorithms - Examples of using Oracle Machine Learning Algorithms from Python
22+
* Lab 4 OML4Py Datastore - Examples of storing Python scripts and objects into Oracle Database (OML4Py Datastore)
23+
* Lab 5 OML4Py Embedded Python Execution - Examples of using open-source Python scripts and algorithms (like SciKit-Learn) with OML4Py
24+
* Lab 6 OML4Py AutoML - Examples of how to execute OML AutoML processes to identify the ideal algorithms and tune the models.
25+
* OML4Py Try It Yourself Answers - Solutions to the "Try It Yourself" sections of the Labs
1726

1827
More information on the site [Oracle Developer Live - AI and ML for Your Enterprise](https://developer.oracle.com/developer-live/ai-ml-enterprise/)
1928

0 commit comments

Comments
 (0)
close