4.9 Use the Python Interpreter in a Notebook Paragraph
An Oracle Machine Learning notebook supports multiple languages. Each paragraph is associated with a specific interpreter. To run Python commands in a notebook, you must first connect to the Python interpreter. To use OML4Py, you must import the oml
module.
In an Oracle Machine Learning UI notebook, you can add multiple paragraphs, and each paragraph can be connected to different interpreters such as SQL or Python. You identify which interpreter to use by specifying %
followed by the interpreter to use: sql
, script
, r
, python
, conda
, markdown
.
- Connect to a Python interpreter to run Python commands in a notebook
- Import the Python modules -
oml
,matplotlib
, andnumpy
- Check if the
oml
module is connected to the Oracle Database
Note:
z
is a reserved keyword and must not be used as a variable in %python
paragraphs in Oracle Machine Learning UI notebooks.
Example to demonstrate the use of the Python modules - matplotlib
and numpy
, and use random data to plot two histograms.
- About Oracle Machine Learning for Python
Oracle Machine Learning for Python (OML4Py) is a component of Oracle Autonomous Database, which includes Oracle Autonomous Data Warehouse (ADW), Oracle Autonomous Transaction Processing (ATP), and Oracle Autonomous JSON Database (AJD). By using Oracle Machine Learning UI notebooks, you can run Python functions on data for data exploration and preparation while leveraging Oracle Database as a high-performance computing environment. Oracle Machine Learning User Interface (UI) is available through Autonomous Data Warehouse (ADW) , Autonomous Transaction Processing (ATP) and Autonomous JSON Database (AJD) services.
Parent topic: OML Notebooks