Oracle Analytics Server (OAS) enables you to use custom scripts to train machine learning (ML) models. This capability isn’t enabled by default, so you must do it manually. The process takes approximately 15 minutes. That’s time well spent, because it helps expand your data exploration possibilities, increasing your insights and the value you can derive from your data. This blog lists the steps to enable custom scripts, and you can also check the Oracle Help Center for more details about machine learning in OAS.
Prerequisites
- Access to the OAS file system
- A restart of your Oracle Analytics Server instance
Step 1: Deploy your public scripts directory
- Deploy the public scripts directory to your OAS instance. Download the provided oracle.bi.publicscripts.zip to any location on the file system of your OAS instance.
- Unzip the .zip file using the following command:
- unzip oracle.bi.publicscripts.zip
This creates a folder called oracle.bi.publicscripts.
- unzip oracle.bi.publicscripts.zip
- Move the folder to the final location by entering the following command:
- mv oracle.bi.publicscripts /ORACLE_HOME/bi/modules
- Example command with full path: mv oracle.bi.publicscripts /scratch/oas_server/Oracle/Middleware/Oracle_Home/bi/modules/
- On a Linux system, execute the following script to set the proper permissions: chmod -R 750 oracle.bi.publicscripts
- After completing steps a through c, navigate to the folder location (cd /ORACLE_HOME/bi/modules/oracle.bi.publicscripts) and see the following files and folders:

Step 2: Run custom deploy scripts
With your directory and required files deployed, execute the script that enables the “ML Script” functionality in OAS. Following is an example of a final functioning script. The green text indicates your ORACLE_HOME, and yellow indicates your MW_HOME. You can build this script in any text editor and then copy and paste it into your OAS command window.
Have at hand the values of the following parameters:
- ORACLE_HOME
- MW_HOME
Skeleton script
/ORACLE_HOME/oracle_common/common/bin/wlst.sh /MW_HOME/bi/modules/oracle.bi.publicscripts/internal/wlst/updateCustomScriptsProperty.py true /ORACLE_HOME/user_projects/domains/bi /MW_HOME
Final completed script example for a custom or manual installation
/scratch/oas_server/Oracle/Middleware/Oracle_Home/oracle_common/common/bin/wlst.sh /scratch/oas_server/Oracle/Middleware/Oracle_Home/bi/modules/oracle.bi.publicscripts/internal/wlst/updateCustomScriptsProperty.py true /scratch/oas_server/Oracle/Middleware/Oracle_Home/user_projects/domains/bi /scratch/oas_server/Oracle/Middleware/Oracle_Home
Final completed script example for an OAS Marketplace instance
/u01/app/Oracle/Middleware/Oracle_Home/oracle_common/common/bin/wlst.sh /u01/app/Oracle/Middleware/Oracle_Home/bi/modules/oracle.bi.publicscripts/internal/wlst/updateCustomScriptsProperty.py true /u01/data/domains/bi /u01/app/Oracle/Middleware/Oracle_Home
After creating your script, run it inside a terminal window on your Oracle Analytics Server instance. The script takes less than 10 seconds to complete and produces outputs similar to those in the following figure.

Step 3: Restart the system
Navigate to your MW_HOME to stop and start OAS. Enter this command:
cd /MW_HOME/user_projects/domains/bi/bitools/bin ./stop.sh
Services can require as many as 2 minutes to fully stop. When services are stopped, run this command from the same directory:
run ./start.sh
Services can require as many as 5 minutes to start.
Step 4 Confirm that the Script option is available
Log in to your OAS instance and from the top right of your screen, click Create. The Script option is now available. Click Script and upload custom XML machine learning models directly into OAS.

Once the script is uploaded, navigate to the Machine Learning > Scripts section to further inspect the script.

Step 5 Build a data flow with your custom script
With the script uploaded, create a data flow and leverage the machine learning script.
- Click Create, then Data Flow.
- Select the data source and add the Apply Custom Script option.

- Select the desired custom script and then continue to build the data flow by mapping the appropriate columns. Save and execute the data flow.

Try these Oracle Analytics Server capabilities on your instance. View all Oracle Analytics blogs at https://blogs.oracle.com/analytics/
Resources
- For more information about Oracle Analytics Server, visit the Oracle Help Center
- See the Oracle Support FAQ on this topic
- For downloadable OAC + OAS content, visit the Oracle Analytics Public Library
- Stay up to date on all the latest OAC + OAS features on YouTube
