Using Oracle Machine Learning
Using Oracle Machine Learning
Using Oracle Machine Learning
E78525-25
July 2020
Oracle Cloud Using Oracle Machine Learning,
E78525-25
Contributors: Mark Hornick, Denny Wong, Eros Espinola, Francisco Noriega, Gloria Castillo, Jim Dadashev,
Marat Spivak, Mark Kelly, Pedro Reta, Zabdiel Jaramillo Roman
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse
engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is
prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it on
behalf of the U.S. Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software,
any programs embedded, installed or activated on delivered hardware, and modifications of such programs)
and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government
end users are "commercial computer software" or “commercial computer software documentation” pursuant
to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such,
the use, reproduction, duplication, release, display, disclosure, modification, preparation of derivative works,
and/or adaptation of i) Oracle programs (including any operating system, integrated software, any programs
embedded, installed or activated on delivered hardware, and modifications of such programs), ii) Oracle
computer documentation and/or iii) other Oracle data, is subject to the rights and limitations specified in the
license contained in the applicable contract. The terms governing the U.S. Government’s use of Oracle cloud
services are defined by the applicable contract for such services. No other rights are granted to the U.S.
Government.
This software or hardware is developed for general use in a variety of information management applications.
It is not developed or intended for use in any inherently dangerous applications, including applications that
may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you
shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its
safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this
software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of
their respective owners.
Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are
used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc,
and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered
trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content, products,
and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly
disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise
set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not
be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content,
products, or services, except as set forth in an applicable agreement between you and Oracle.
Contents
Preface
Audience vi
Conventions vi
Documentation Accessibility vi
Related Resources vii
iii
Run a Notebook 3-4
Export a Notebook 3-7
Import a Notebook 3-7
Create Check Box Forms in Notebooks 3-8
Create Select Forms in Notebooks 3-9
Create Text Input Forms in Notebooks 3-9
Version a Notebook 3-10
Save Notebooks as Templates 3-11
Set Output Format in Notebooks 3-11
Output Formats Supported by SET SQLFORMAT Command 3-12
Use the Scratchpad 3-13
Run SQL Scripts 3-14
Run SQL Statements 3-15
About Interpreter Bindings and Notebooks 3-16
Set Interpreter Bindings for Notebooks 3-17
Change Interpreter Bindings for Specific Paragraphs in a Notebook 3-18
Validate Interpreter Bindings 3-20
Collaborate in Oracle Machine Learning 3-21
iv
Edit Oracle Database Interpreter Connection 6-2
v
Preface
Preface
This document describes how to use Oracle Machine Learning and provides
references to related documentation.
• Audience
This document is intended for data scientists, developers, and business users.
• Conventions
• Documentation Accessibility
• Related Resources
For more information, see these related resources.
Audience
This document is intended for data scientists, developers, and business users.
Conventions
The following text conventions are used in this document:
Convention Meaning
boldface Boldface type indicates graphical user interface elements associated
with an action, or terms defined in text or the glossary.
italic Italic type indicates book titles, emphasis, or placeholder variables for
which you supply particular values.
monospace Monospace type indicates commands within a paragraph, URLs, code
in examples, text that appears on the screen, or text that you enter.
Documentation Accessibility
For information about Oracle's commitment to accessibility, visit the Oracle
Accessibility Program website at http://www.oracle.com/pls/topic/lookup?
ctx=acc&id=docacc.
vi
Preface
Related Resources
For more information, see these related resources.
• Getting Started with Oracle Cloud Getting Started with Oracle Cloud
• Accessibility Guide for Oracle Cloud Services Accessibility Guide for Oracle Cloud
Services
vii
1
Get Started with Oracle Machine Learning
Notebooks
This section discusses how to get started with Oracle Machine Learning notebooks,
and use Apache Zeppelin-based data mining notebooks where you can perform data
exploration and data visualization, data preparation and machine learning.
• About Oracle Machine Learning Notebooks
Oracle Machine Learning Notebooks is an Apache Zeppelin-based collaborative
web-based interface that provides a development environment to create data
mining notebooks where you can perform data exploration and visualizations, data
preparation and machine learning.
• Oracle Machine Learning Notebooks Home Page
The Oracle Machine Learning Notebooks home page is the default landing page
when you log in to Oracle Machine Learning. The home page provides you quick
links to important interfaces, and the log of your high-level recent activities.
• Get Started with Oracle Machine Learning
Here is how you can get started with Oracle Machine Learning.
• Access Oracle Machine Learning User Management Page
From Autonomous Data Warehouse you can access the Oracle Machine Learning
Manage Oracle ML Users page.
• Typical Workflow For Using Notebooks
To begin with Oracle Machine Learning, refer to the tasks listed in the table as a
guide.
• Quickstart Tutorial: Creating Projects and Workspaces in Oracle Machine Learning
This tutorial shows you the steps to create projects and workspaces in Oracle
Machine Learning.
• Quickstart Tutorial: Creating and Running Notebooks in Oracle Machine Learning
This tutorial shows you how to create a notebook and run it in Oracle Machine
Learning.
• Quickstart Tutorial: Collaborating in Oracle Machine Learning
This tutorial shows you how to collaborate and share notebooks with other users in
Oracle Machine Learning.
• Quickstart Tutorial: Creating SQL Scripts in Oracle Machine Learning
This tutorial shows you how to create a SQL script and share it with other users in
Oracle Machine Learning.
• Quickstart Tutorial: Running SQL Statements in Oracle Machine Learning
This tutorial shows you how to run SQL statements in Oracle Machine Learning.
Related Topics
• Data Mining Algorithms
1-1
Chapter 1
About Oracle Machine Learning Notebooks
1-2
Chapter 1
Get Started with Oracle Machine Learning
– Manage Permissions
– Try It
• The Quick Actions links to:
– Run SQL Statements
– Run SQL Scripts
– Notebooks
– Jobs
– Examples
• The log of your Recent Activities.
• The application navigation by clicking on the top left corner of the home page.
• The options to select and create new projects, access recent projects, manage
workspace, and set workspace permissions by clicking on the top right corner
of the home page.
• The Recent Notebooks on the right pane of the home page.
Related Topics
• Run SQL Statements
SQL or Structured Query Language is the standard language for relational
database management systems. You can use SQL statements to perform tasks
such as retrieving data from a database, updating data on a database, and so
on. Some examples of SQL statements are SELECT, INSERT, UPDATE, DELETE,
CREATE, and DROP.
• Run SQL Scripts
A SQL script is a set of SQL statements. You can create SQL scripts in Oracle
Machine Learning Notebooks, save them as .json files in your system. You can
share the notebook.json files with other users as well.
• Notebooks
The Notebooks page lists all the notebooks associated with the selected project.
You can create, edit, and run your notebooks here.
• Jobs
Jobs allow you to create schedules to run notebooks. In the Jobs page, you
can create and schedule jobs, monitor job status, and view job logs as read-only
notebooks.
• Examples
The Example Templates page lists the pre-populated Oracle Machine Learning
notebook templates. You can view and use these templates to create your
notebooks.
1-3
Chapter 1
Access Oracle Machine Learning User Management Page
2. Access the Oracle Machine Learning account by using your credentials. In case
you forget your password, then request the Administrator to reset it.
Note:
Once you receive your new password, you must change it immediately.
Refer to the Oracle Machine Learning password policy for more
information.
3. Once you log in for the first time, a workspace and project will be created for
you. You can start creating your notebook and assign it to the default project and
workspace. You can also create your own project and workspace.
Related Topics
• About Oracle Machine Learning Password Policy
All Oracle Machine Learning users must follow the password policy to create a
strong and secured password.
3. From the Oracle Cloud Infrastructure page click in the top corner of the page
and then click Autonomous Data Warehouse from the left navigation pane, and
select a Compartment.
4. Select an Autonomous Data Warehouse instance and on the details page click
Service Console.
1-4
Chapter 1
Access Oracle Machine Learning User Management Page
5. Click Administration.
6. On the Administration page click Manage Oracle ML Users.
• About Oracle Machine Learning Password Policy
All Oracle Machine Learning users must follow the password policy to create a
strong and secured password.
1-5
Chapter 1
Typical Workflow For Using Notebooks
Related Topics
• Grant Workspace Permissions
You can collaborate with other users in Oracle Machine Learning by granting
permissions to access your workspace. Your workspace contains your projects
and notebooks.
1-6
Chapter 1
Quickstart Tutorial: Creating SQL Scripts in Oracle Machine Learning
1-7
2
Get Started with Project and Workspaces
A project is a container for storing your notebooks and other objects such as
dashboards and so on. A workspace is a virtual space where your projects reside,
and multiple users with the appropriate permission type can work on different projects.
• Create Projects and Workspace
A project is a container for your notebooks, and a workspace is a container for
your projects. You can own multiple projects in a workspace.
• Grant Workspace Permissions
You can collaborate with other users in Oracle Machine Learning by granting
permissions to access your workspace. Your workspace contains your projects
and notebooks.
Note:
The last project that you have worked on is stored in the browser cache
and is the default project. If you clear the cache, then no default exists
and you must select a project.
2-1
Chapter 2
Create Projects and Workspace
2-2
Chapter 2
Create Projects and Workspace
4. To create a new workspace, click next to the Workspace field in the Create
Project dialog. The Create Workspace dialog opens.
Note:
You can also create a workspace by clicking Create in the Select Project
dialog.
2-3
Chapter 2
Grant Workspace Permissions
The Select Project dialog lists the workspace and all the projects in it, along with
the following information:
• Name
• Created By
• Type
• Created on
• Updated By
• Last Update
• Comments
You can sort, edit, and delete projects here.
Note:
To delete workspaces, click Manage Workspaces in the project
workspace drop-down list.
Related Topics
• Manage Workspaces
You can provide access to your workspace, manage permissions for users, and
edit and delete workspace.
2-4
Chapter 2
Grant Workspace Permissions
your projects and notebooks such as edit, create, update, delete, run, view notebooks
and so on. For more information about the permission types, see About Workspace
Permission Types.
Caution:
If you grant the permission type Manager or Developer, then the user
can also drop tables, create tables, and run any scripts at any time on
your account. The user with Viewer permission type can only view your
notebooks, and is not authorized to run or make any changes to your
notebooks.
3. In the Permissions drop-down list, select the permission type you want to grant to
the selected user.
• Manager
• Developer
• Viewer
2-5
Chapter 2
Grant Workspace Permissions
4. Click Add.
The selected user is granted the assigned permission. The user name is displayed
in the Permissions dialog box, along with the permission type.
5. Click OK. This completes the task of granting permission to a user. To delete a
user and the associated permission, select the user and click Delete.
• About Workspace Permission Types
Oracle Machine Learning allows three types of permissions. Depending on the
permission type, you can allow the user to view or perform different tasks in your
workspace, projects, and notebooks.
• Manage Workspaces
You can provide access to your workspace, manage permissions for users, and
edit and delete workspace.
Note:
A user with the Manager permission type can
also drop tables and run any script at any time
on the owner’s account.
2-6
Chapter 2
Grant Workspace Permissions
Note:
A user with the Developer permission type
can also drop tables and run any script at any
time on the owner’s account.
Manage Workspaces
You can provide access to your workspace, manage permissions for users, and edit
and delete workspace.
To manage workspaces:
1. On the top right corner of your home page, click the Project Workspace drop-down
list.
2. Click Manage Workspaces.
The Manage Workspaces dialog box opens.
3. In the Manage Workspace dialog, you can perform the following tasks:
2-7
Chapter 2
Grant Workspace Permissions
2-8
3
Get Started with Notebooks for Data
Analysis and Data Visualization
Oracle Machine Learning Notebooks is based on Apache Zeppelin technology. You
can write code, text, create visualizations, and perform data analytics including
machine learning. Notebooks work with interpreters in the back-end. In Oracle
Machine Learning, notebooks are available in a project, where you can create, edit,
delete, and even save notebooks as templates.
• About Notebooks
The Notebooks page lists all the notebooks associated with the selected project.
You can create, edit, and run your notebooks here.
• About Interpreter Bindings and Notebooks
An interpreter is a plug-in that allows you to use a specific data processing
language at the backend. For the Zeppelin Notebooks in Oracle Machine
Learning, you use the sql and pl/sql interpreters within an Oracle Database
interpreter group and the md (MarkDown) interpreter for plain text formatting syntax
so that it can be converted to HTML.
• Collaborate in Oracle Machine Learning
Two or more users can collaborate and share Oracle Machine Learning notebooks
with other users.
About Notebooks
The Notebooks page lists all the notebooks associated with the selected project. You
can create, edit, and run your notebooks here.
You can perform the following tasks in the Notebooks page:
• To create a new notebook, select a project and click Create.
• To edit a notebook, select the notebook and click Edit. You can edit the notebook
name, and add comments in the Edit Notebook dialog box.
• To create a copy of a notebook, select the notebook and click Duplicate. The
duplicate copy of the selected notebook is created, and listed in the Notebooks
page with the suffix _1 in the notebook name.
• To save a notebook as a template, select the notebook and click Save as
Template. You can save the template in Personal or Shared under Templates.
• To delete a notebook, select it and click Delete.
• To import a notebook as .json files, click Import. Select the project and
workspace in which to import the notebook.
• To create versions of a notebook, select it and click Version. You can experiment
with your notebook by creating versions of it, and revert to an older version by
clicking Revert Version.
3-1
Chapter 3
About Notebooks
• To open a notebook and run it, click the notebook. The notebook opens in the edit
mode.
• Create a Notebook
A notebook is a web-based interface for data analysis, data discovery, data
visualization and collaboration.
• Edit Your Notebook
After creating a notebook, you must open the notebook and write commands
to fetch data from the data source, and run it for data discovery and data
visualization.
• Version a Notebook
You can version or create a backup a notebook, experiment on it, and revert to the
original notebook, if required.
• Save Notebooks as Templates
You can save an existing notebook as a template in Personal or in Shared.
• Set Output Format in Notebooks
Oracle Machine Learning Notebooks allow you to preformat query output in
notebooks.
• Use the Scratchpad
You can use the SQL scratchpad to run your SQL statements and SQL script
without opening or creating a notebook.
Related Topics
• About Interpreter Bindings and Notebooks
An interpreter is a plug-in that allows you to use a specific data processing
language at the backend. For the Zeppelin Notebooks in Oracle Machine
Learning, you use the sql and pl/sql interpreters within an Oracle Database
interpreter group and the md (MarkDown) interpreter for plain text formatting syntax
so that it can be converted to HTML.
Create a Notebook
A notebook is a web-based interface for data analysis, data discovery, data
visualization and collaboration.
Before you create a notebook, you must assign it to a project, which resides inside a
workspace.
Whenever you create a notebook, it has an interpreter settings specification. The
notebook contains an internal list of bindings that determines the order of the
interpreter bindings. To create a notebook:
1. In the Oracle Machine Learning home page, click Notebooks. The Notebooks
page opens.
2. In the Notebooks page, click Create.
The Create Notebook window appears.
3. In the Name field, provide a name for the notebook.
4. In the Comments field, enter comments, if any.
5. In the Connections field, select a connection in the drop-down list. By default, the
Global Connection Group is assigned.
6. Click OK.
3-2
Chapter 3
About Notebooks
Your notebook is created. You can now use the notebook to fetch data for data
discovery and data analysis.
Related Topics
• Set Output Format in Notebooks
Oracle Machine Learning Notebooks allow you to preformat query output in
notebooks.
• Edit your Notebook
After creating a notebook, you must open the notebook and write commands
to fetch data from the data source, and run it for data discovery and data
visualization.
• About Interpreter Bindings and Notebooks
An interpreter is a plug-in that allows you to use a specific data processing
language at the backend. For the Zeppelin Notebooks in Oracle Machine
Learning, you use the sql and pl/sql interpreters within an Oracle Database
interpreter group and the md (MarkDown) interpreter for plain text formatting syntax
so that it can be converted to HTML.
• Run paragraphs. Click the run icon to run one or all paragraphs in the
notebook.
• Export notebooks. Click the export icon to export the notebook.
• Set order for interpreter bindings. Click the gear icon to set the order for
interpreter bindings for the notebook.
• View list of shortcut keys. Click the keyboard shortcut icon to view the list
of keyboard shortcuts.
• Add dynamic forms such as the Text Input form, Select form, Check box form
for easy selection of inputs and easy filtering of data in your notebook. Oracle
Machine Learning supports the following Apache Zeppelin dynamic forms:
– Text Input form — Allows you to create a simple form for text input.
3-3
Chapter 3
About Notebooks
Note:
The Apache Zeppelin dynamic forms are supported only on SQL
interpreter notebooks.
Run a Notebook
A notebook can contain many paragraphs. You can run one or all the paragraphs in a
notebook.
There are two types of notebook paragraphs:
• %sql - Supports standard SQL statements. In %sql the results of a SELECT
statement are directly displayed in a Zeppelin table viewer, with access to other
visualization options. Use the options in the chart settings to perform groupings,
summation, and other operations.
• %script - Supports both SQL statements and PL/SQL. In %script, the results of a
SELECT statement are provided as text string output.
3-4
Chapter 3
About Notebooks
Note:
To run a Group By on all your data, then it is recommended to use
SQL scripts to do the grouping in the database, and return the summary
information for charting in the notebook. Grouping at the notebook level
works well for small sets of data. If you pull too much data to the notebook,
you may encounter issues due to insufficient memory. You can set the
row limit for your notebook by using the option Render Row Limit in the
Connections Group page.
Note:
Notebooks must be opened as a regular user, that is, a non-
administrator user. The Run notebook option is not available to the
Administrator.
3-5
Chapter 3
About Notebooks
To visualize the tabular data, click the respective icons for each of the each
graphical representation, as shown here:
Related Topics
• Edit Oracle Database Interpreter Connection
When defining an Oracle Database interpreter connection, a reference to a
compute resource is created. This reference contains all connection-related
information about the interpreter.
3-6
Chapter 3
About Notebooks
Export a Notebook
You can export a notebook as a .json (JavaScript Object Notation) file, and later
import it in to the same or a different environment.
To export a notebook:
1. In the Notebooks page, click the notebook that you want to export.
The notebook opens in the notebook editor.
2. In the top panel of the notebook editor, click . The notebook is saved to your
local folder as a .json file.
Related Topics
• About Interpreter Bindings and Notebooks
An interpreter is a plug-in that allows you to use a specific data processing
language at the backend. For the Zeppelin Notebooks in Oracle Machine
Learning, you use the sql and pl/sql interpreters within an Oracle Database
interpreter group and the md (MarkDown) interpreter for plain text formatting syntax
so that it can be converted to HTML.
Import a Notebook
You can import notebooks across Pluggable Databases (PDBs) into your workspace.
Note:
Starting in Oracle Database 20c,"database" refers specifically to the data
files of a multitenant container database (CDB), pluggable database (PDB),
or application container.
To import a notebook:
1. In Oracle Machine Learning home page, click Notebooks.
2. In the Notebooks page, click Import.
This opens the File Upload dialog. Browse and select the notebook that you want
to import.
Note:
You must have the notebook saved as a .json file to import it.
You can import notebooks exported from non-Oracle Apache Zeppelin
environments, but only paragraphs types that are supported may be run.
3. In the File Upload dialog, browse and select the .json file and click Open.
This imports the notebook file into your workspace.
3-7
Chapter 3
About Notebooks
4. Click the imported notebook to open it. In the notebook page, click the gear icon to
view the interpreter bindings.
Related Topics
• About Interpreter Bindings and Notebooks
An interpreter is a plug-in that allows you to use a specific data processing
language at the backend. For the Zeppelin Notebooks in Oracle Machine
Learning, you use the sql and pl/sql interpreters within an Oracle Database
interpreter group and the md (MarkDown) interpreter for plain text formatting syntax
so that it can be converted to HTML.
• Database and Instance
3-8
Chapter 3
About Notebooks
In this example,
• The form name is obj
• The list of available values are INDEX, TABLE, VIEW, SYNONYM.
• The table name is ALL_OBJECTS
• The column name is OBJECT_TYPE
Select any values from the drop-down list in the obj form. The selected value will
be retrieved in the OBJECT_TYPE column in the ALL_OBJECTS table.
3-9
Chapter 3
About Notebooks
Here, the text form obj is created for the column OBJECT_TYPE in the table
ALL_OBJECTS. You can enter different values in the form field obj and run the
notebook to retrieve the corresponding values in the column OBJECT_TYPE.
3. Run the paragraph. The notebook now displays the text input form field obj,
as shown in the screenshot. You can enter values in the obj field, and run the
notebook to retrieve the corresponding values for the column OBJECT_TYPE in
the table ALL_OBJECTS.
• If you enter TABLE in the obj field, and run the notebook, then the notebook
retrieves TABLE in the column OBJECT_TYPE, as shown in the screenshot.
• If you enter VIEW in the obj form field and run the
notebook, then the notebook retrieves the value VIEW in
the column OBJECT_TYPE, as shown in the screenshot.
4. You can also assign default values in the form by using the syntax:
${formName=defaultValue}
To assign a default value to the Text Input form, modify the SQL statement to:
SELECT * FROM ALL_OBJECTS WHERE OBJECT_TYPE = '${obj=TABLE}'
Here, the default value assigned to the form is TABLE. Once you run
the paragraph, the default value TABLE will be retrieved in the column
OBJECT_TYPE, as shown in the screenshot.
Version a Notebook
You can version or create a backup a notebook, experiment on it, and revert to the
original notebook, if required.
To version a notebook:
3-10
Chapter 3
About Notebooks
1. In the Notebooks page, select the notebook that you want to version and click
Version.
The Versions page opens.
2. In the Versions page for the selected notebook, click + Version.
The Create Versions dialog box opens.
3. In the Create Versions dialog box, enter comments for the specific version of your
notebook, and click OK.
4. The versioned notebook is now listed in the Versions page. You can perform the
following tasks:
• Click Revert Version to restore the older version of your notebook.
• Click Delete to delete the selected version of your notebook.
• Click New Notebook to create a new notebook from the selected notebook
version.
3-11
Chapter 3
About Notebooks
Here, the output format is ansiconsole, and the table name is HR.EMPLOYEES.
Note:
This formatting is available for the Script interpreter. Therefore, you must
add the prefix %script as shown in this example.
Note:
These output formats are available for the Script interpreter. Therefore, you
must include the prefix %script.
3-12
Chapter 3
About Notebooks
Note:
You can also execute this command without the format name DEFAULT by
simply typing SET SQLFORMAT.
• DELIMITED — The DELIMITED format allows you to manually define the delimiter
string, and the characters that are enclosed in the string values. The syntax is:
%script
SQLFORMAT DELIMITED delimiter left_enclosure right_enclosure
For example,
%script
SET SQLFORMAT DELIMITED ~del~ " "
SELECT * FROM emp WHERE deptno = 20;
Output:
"EMPNO"~del~"ENAME"~del~"JOB"~del~"MGR"~del~"HIREDATE"~del~"SAL"~del~"
COMM"~del~"DEPTNO"
In this example, the delimiter string is ~del~ and string values such as EMPNO,
ENAME, JOB and so on, are enclosed in double quotes.
3-13
Chapter 3
About Notebooks
• The first part of the script contains the SQL statement CREATE TABLE to create
a table named small_table. It defines the table name, table column, data
3-14
Chapter 3
About Notebooks
types, and size. In this example, the column names are NAME, ID1, ID2, ID3,
ID4, and TEXT.
• The second part of the script begins with the keyword BEGIN. It inserts 100
rows in to the table small_table.
Note:
When using the CREATE statement with a primary key, it fails and displays
the error message
Insufficient privileges.
5. Once you have finished writing the SQL script, click Run.
6. After you have created the SQL script, you can share it with other users:
• Export SQL script: In the SQL Query Scratchpad, click the export icon to
save it as a .json file in your system.
• Import SQL script: In the Notebooks page, click Import to import the SQL file
saved as a .json file in to your notebook.
After the SQL script is successfully imported, it is listed in the Notebooks page. Click
the SQL script that is listed here to open and edit it in the Notebook editor. You can
also save the SQL script as a notebook template in Personal Templates, Shared, or in
the Examples.
Related Topics
• Restrictions on SQL Commands
• Restrictions for Database Options
• Restrictions for Database Initialization Parameters
3-15
Chapter 3
About Interpreter Bindings and Notebooks
SELECT * FROM SH.SALES; where, SH is the schema name and SALES is the table
that contains the data about product sales in the database.
4. To run the SQL statement, click or press Shift+Enter. Once the statement runs
successfully, Oracle Machine Learning fetches the data from the database and
displays it in a tabular format.
5. If you want to visualize the data in a different graphical output, then click the icon
for the corresponding graph.
3-16
Chapter 3
About Interpreter Bindings and Notebooks
• Notebook creation from templates: When you create a notebook from templates,
the notebook inherits the default order of interpreter bindings.
• Set Interpreter Bindings for Notebooks
You must bind a notebook to an interpreter to fetch data from the database or any
data source. A default set of interpreter bindings is available.
• Change Interpreter Bindings for Specific Paragraphs in a Notebook
The interpreter binding order that is set for a notebook applies to all the
paragraphs in that notebook. However, you can change the interpreter binding
order for any specific paragraph in the notebook.
• Validate Interpreter Bindings
You can use a SQL statement to fetch the information about interpreter binding.
The Settings pane opens listing the interpreter bindings for the notebook.
3. Drag and drop the interpreters to reorder the interpreter bindings. The first
interpreter on the list is the default. The order of interpreter bindings is:
• Low (Default): It provides the least level of resources to each SQL statement,
but supports the maximum number of concurrent SQL statements. The
interpreter with low priority is listed on the top of the interpreter list, and hence,
is the default.
• Medium: It provides a lower level of resources to each SQL statement
potentially resulting in a lower level of performance, but supports more
concurrent SQL statements.
• High: It provides the highest level of resources to each SQL statement
resulting in the highest performance, but supports the minimum number of
concurrent SQL statements.
This is the initial binding order of the interpreters. You can change the order of the
interpreter bindings.
4. Click Save.
Related Topics
• Manage Concurrency and Priorities on Autonomous Data Warehouse Cloud
• Predefined Database Service Names for Autonomous Data Warehouse
3-17
Chapter 3
About Interpreter Bindings and Notebooks
In this example, all the three SQL interpreters are bound to the notebook, and
the interpreter with low resource allocation adwpcwdp_low %sql is the default, as
it is the first interpreter on the list. The MarkDown interpreter is not bound to the
notebook
Note:
The names of the interpreters are in the format databasename_low,
databasename_medium and databasename_high which is the same as
the interpreter binding order name. In this example, the interpreter
names are adwp_low % sql(default),%script , adwp_medium %
sql(default),%script , adwp_high % sql(default), %script. and md
%md(default)
3-18
Chapter 3
About Interpreter Bindings and Notebooks
Notice that the first paragraph runs without any error after changing the interpreter
binding. The second paragraph in this notebook has the default binding.
3. Validate the interpreter binding for first paragraph of this notebook by typing
the SQL statement SELECT SYS_CONTEXT ('USERENV', 'SERVICE_NAME')
FROM DUAL;
The SQL statement returns the following information about the interpreter with
medium binding:
3-19
Chapter 3
About Interpreter Bindings and Notebooks
LGKFDTOOBOQK48I_CWDP_medium.adwc.oraclecloud.com
Note:
For the rest of the paragraphs in this notebook, the interpreter binding is
the default. You may validate the bindings for each paragraph by running
step 3.
This completes the task of changing the interpreter binding for a particular
paragraph in the notebook. The rest of the paragraphs in the notebook have the
default binding for the interpreter.
3-20
Chapter 3
Collaborate in Oracle Machine Learning
The SQL statement queries the service name that is used to run the query.
3. Click Run.
The query returns the information about the interpreter, the priority of the
binding, and the service name. The result is displayed in the following format
tenantname__databasename_ servicename.domain as shown in the screenshot.
Here, HDY7RUSKGDMPHN2 is the tenant name, PDB2 is the database name, low is the
service name, and adwc.oraclecloud.com is the domain name.
3-21
4
Use Templates to Collaborate with Users
In the Oracle Machine Learning Templates UI, you can collaborate with other users by
sharing your work, publishing your work as reports, and by creating notebooks from
templates. You can store your notebooks as templates, share notebooks, and provide
sample templates to other users.
Note:
You can also collaborate with other Oracle Machine Learning Notebook
users by providing access to your workspace. The authenticated user can
then access the projects in your workspace, and access your notebooks.
The access level depends on the permission type granted - Manager,
Developer, or Viewer. For more information about collaboration among users,
see Quickstart Tutorial: Collaborating in Oracle Machine Learning
4-1
Chapter 4
Use the Personal Templates
4-2
Chapter 4
Use the Shared Templates
4-3
Chapter 4
Use the Example Templates
4-4
Chapter 4
Use the Example Templates
4. In the Comment field, if any comment is available for the template, then it is
displayed. You can edit the comment.
4-5
Chapter 4
Use the Example Templates
Example Templates
Oracle Machine Learning Notebooks provide you the following notebook Example
templates that are based on different machine learning algorithms. The Example
templates are processed in Oracle Autonomous Database.
You can create your notebook based on any of these templates:
4-6
Chapter 4
Use the Example Templates
4-7
5
Get Started with Jobs
Jobs allow you to create schedules to run notebooks. In the Jobs page, you can create
and schedule jobs, monitor job status, and view job logs as read-only notebooks.
• About Jobs
The Jobs page lists all the jobs created, along with the job name, notebook, owner
of the job, last start date, next run date, status, and schedule.
• Create Jobs to Schedule Notebooks
You can create jobs to schedule your notebook with preferred scheduling settings.
• View Job Logs
You can view the historical logs of any particular job in the Job Log interface.
About Jobs
The Jobs page lists all the jobs created, along with the job name, notebook, owner of
the job, last start date, next run date, status, and schedule.
You can perform the following tasks:
• Edit jobs: You can edit the metadata of any job listed in the Jobs page. Click Edit
to edit the selected job.
• Create jobs. Click Create to create a new job to schedule your Notebook.
• Duplicate jobs: You can create a copy of an existing job listed in the Jobs page.
Click Duplicate to make a copy of the selected job.
• Stop jobs: Click Stop to terminate a job that is currently running.
• Start jobs: The Start button is enabled only for jobs that are in Scheduled status.
Click Start to start a scheduled job. The Start option is not applicable for the
following conditions:
– Jobs that have already completed its scheduled run cannot be re-started.
– Jobs that have failed more than the allowed number of times, and are currently
in Broken status, cannot be re-started.
• Delete jobs: Click Delete to delete any job listed in the Jobs page.
5-1
Chapter 5
Create Jobs to Schedule Notebooks
2. In the Name field, enter a name for the job. The number of characters in the job
name must not exceed 128 bytes.
3. In the Notebook field, click the search icon to select a notebook to create a job.
5-2
Chapter 5
View Job Logs
Note:
Only notebooks that are owned by the user or shared are available for
selection.
4. In the Start Date field, click the date-time editor to set the date and time for your
job to commence. Based on the selected date and time, the next run date is
computed.
5. Optionally, in the Repeat section, select:
• Frequency: To set the repeat settings and frequency. You can set the
frequency in minutes, hours, days, week, and month.
• Custom: To customize the job settings.
6. Optionally, in Advanced Settings, select one or more of the following options:
• Maximum Number of Runs: To specify the maximum number of times the job
must run before it is stopped. When the job reaches the maximum run limit, it
will stop.
• Maximum Failures Allowed: To specify the maximum number of times a
job can fail on consecutive scheduled runs. When the maximum number of
failures is reached, the next run date column in the Jobs UI will show an empty
value to indicate the job is no longer scheduled to run. The Status column may
show the status as Failed.
• Timeout in Minutes: To specify the maximum amount of time a job should be
allowed to run.
7. Click OK.
5-3
6
Get Started with Connection Groups
A connection group, also known as a Zeppelin interpreter set, is a collection of
database connections.
• About Connection Groups
In the Connection Group page, a user with Administrator role can manage your
connections that constitute the connection group.
• About Global Connection Group
The Global Connection Group is created automatically when a new database is
provisioned.
• Edit Oracle Database Interpreter Connection
When defining an Oracle Database interpreter connection, a reference to a
compute resource is created. This reference contains all connection-related
information about the interpreter.
Note:
Only an Administrator user can manage connection groups.
6-1
Chapter 6
About Global Connection Group
Note:
The Compute Resource definition can be edited by the Administrator
only.
Note:
A Global Connection Group can be edited by the Administrator only.
Reset: To reset the interpreter connection, click the connection group name. The
connection group opens in a separate page, listing all the interpreter connections
in the group. Select the connection you want to reset and click Reset. When you
click Reset, then all connections supported by the interpreter are closed, and all
notebooks using that connection are cancelled.
Note:
The Reset option is available only to the Administrator.
6-2
Chapter 6
Edit Oracle Database Interpreter Connection
Note:
You must have the Administrator role to edit these fields.
1. Name: You can edit the name of the interpreter editor here. This is useful if you
have several definitions of the same interpreter type in the same interpreter set. By
specifying a name, you can turn on or turn off the specific binding to a notebook.
2. Type: This is a non-editable field. It indicates the connection type
3. Binding Mode: This is a non-editable field. It defines the behavior of the
interpreter instance in memory, and how the resources are shared. By default,
the Binding Mode of the Global Connection Group is set to Scoped. It ensures that
each notebook creates a new interpreter instance in the same interpreter process.
4. Row Render Limit: This determines the number of rows to be displayed in the
paragraph results when fetching a data structure that can be presented as a table
or graph using the Zeppelin built-in plotting service. You must consider the browser
capabilities when modifying this setting. The default limit is 1000.
Note:
Zeppelin plotting service works with data that is fetched previously to the
client-side for a snapper UI.
5. Comments: Enter any information related to the interpreter not exceeding 1000
characters.
Note:
You must have Administrator role to edit this field.
6. In the Compute Resource section, the Resources field indicates the priority of the
compute resource. This is a non-editable field.
7. In the Database section, you can specify additional settings related to PL/SQL
DBMS output. Select Enabled to allow the PL/SQL interpreter to display the
messages sent to the DBMS_OUTPUT in the paragraph results.
8. Click Save.
6-3
7
Use Notebook Sessions
The Notebook Sessions page provides you with an overview of your notebooks, and
allows you to manage notebook sessions from your workspace or in a workspace
where you have collaboration rights.
• About Notebook Sessions
The Notebook Sessions page provides you with an overview of your notebooks,
and allows you to manage notebook sessions from your workspace or in a
workspace where you have collaboration rights.
7-1
8
Administer Oracle Machine Learning
Oracle Machine Learning is managed at the system level and at the application level
by an administrator.
• Administrator — Creates, edits, and deletes Oracle Machine Learning user
accounts. The Administrator reassigns user workspace.
Note:
The Administrator is not authorized to run notebooks. The Administrator
can only read notebooks.
• Developer — This is the default user role that allows you to create, and run
notebooks, run SQL Statements, create SQL scripts, create jobs to schedule and
run notebooks.
8-1
Chapter 8
Typical Workflow for Managing Oracle Machine Learning
8-2
Chapter 8
Manage OML Users
Note:
The tasks listed here can be performed by an administrator only.
Create User
An administrator creates a new user account and user credentials for Oracle Machine
Learning in the User Management interface.
Note:
You must have the administrator role to access the Oracle Machine Learning
User Management interface.
8-3
Chapter 8
Manage OML Users
5. In the Username field, enter a username for the account. Using the username, the
user will log in to an Oracle Machine Learning instance.
6. Enter a name in the First Name field.
7. Enter a name in the Last Name field.
8. In the Email Address field, enter the email ID of the user.
9. Select the option Generate password and email account details to user. User
will be required to reset the password on first sign in. to auto generate a
temporary password and send an email with the account credentials to the user.
If you select this option, you need not enter values in the Password and Confirm
Password fields; the fields are grayed out.
10. In the Password field, enter a password for the user, if you choose to create a
password for the user.
This option is disabled if you select the Generate password... option to auto
generate a temporary password for the user.
11. In the Confirm Password field, enter a password to confirm the value that you
entered in the Password field.
By doing so, you create the password for the user. The user can change the
password when first logging in.
12. Click Create.
This creates a new database user and grants the required privileges to use Oracle
Machine Learning.
Note:
With a new database user, an administrator needs to issue grant commands
on the database to grant table access to the new user for the tables
associated with the user's Oracle Machine Learning notebooks.
Note:
You must have the administrator role to access the Oracle Machine Learning
User Management interface.
8-4
Chapter 8
About User Data
Note:
Initially, the Role field shows the role None for existing database users.
After adding a user the role Developer is assigned to the user.
5. Select a user. To select a user select a name in the User Name column. For
example, select ANALYST1.
Selecting the user shows the Oracle Machine Learning Edit User page.
6. Enter a name in the First Name field. (Optional)
7. Enter the last name of the user in the Last Name field. (Optional)
8. In the Email Address field, enter the email ID of the user.
Making any change on this page adds the existing database user with the required
privileges as a Oracle Machine Learning user.
9. Click Save.
This grants the required privileges to use the Oracle Machine Learning application. In
Oracle Machine Learning this user can then access any tables the user has privileges
to access in the database.
8-5
Chapter 8
About Compute Resource
Reassign
The Reassign option allows you to reassign workspaces, along with templates, from
one user to another.
To reassign workspaces:
1. On the User Data page, select the user from whom you want to reassign
workspace and click Reassign.
The Reassign page opens.
2. In the Target User field, select the user to whom you want to reassign workspace.
3. Select All Templates if you want to reassign all the templates associated with the
user selected in the User Data page.
4. Select:
• Reassign all workspaces: To reassign all the workspaces associated with
the selected user.
• Select workspaces to reassign: To reassign particular workspaces
associated with the selected user.
5. Click Reassign.
After the templates and workspaces are reassigned successfully, a notification
message is displayed on the User Data page with the number of templates and
workspaces reassigned.
Note:
You must have the Administrator role to access the Compute Resources
page.
The Compute Resources page displays the list of compute resources along with
the name of each resource, its type, comments, and last updated details. To view
details of each Compute Resource, click the Compute Resource name. The following
connection details are displayed:
• Name
• Comment
• Host
• Port
8-6