Custom Runtime Scorers enables you to score against any data using DAI Model in runtime.
Packages
DB Scorer Guide
Hive Scorer Guide
Rest Scorer Guide
DB Scorer
Requirements
- 1. Driverless AI Mojo
- -- copy the mojo file in the models/ directory
- 2. Driverless AI License
- -- provided via the partnership portal
- -- copy the license to the license.sig file in the license/ directory
- -- run export DRIVERLESS_AI_LICENSE_FILE=/path/to/license.sig
- 3. Java JDK 1.8
- -- execute “java -version” to verify the available JVM on your platform has JDK 1.8 installed. The output of the command should indicate JDK 1.8
- 4. Properties File
- -- create one or use the default properties file under properties/ directory
- 5. JAR File
- -- DAI-Mojo-DB jar file in scorer/ directory
Execution
java -Derrors=true -Dverbose=true -Dthreads=2 -Dcapacity=4000 -Dpropertiesfilename=DAIMojoRunner_DB.properties -jar DAI-Mojo-DB-2.30.jar
Result
-- The DB scorer stores the score/prediction for each row from the given dataset in a file called results.csv in the main directory.
-- Create a results.csv file in the main directory (if it doesn't exist already). It is important for the execution command to have a results.csv file in the main dir to save the data processed by the scorer as the code will not create the file itself if it doesn't exist.
Note:
- Set
-Dthreads=200
and -Xms10g
for faster processing
- You must have a DAI license to score, add the license in one of the standard ways, as a parameter, as a environment variable
-Dai.h2o.mojos.runtime.license.file=/Driverless-AI/license/license.sig
Hive Scorer
Requirements
- 1. Driverless AI Mojo
- -- copy the mojo file in the models/ directory
- 2. Driverless AI License
- -- provided via the partnership portal
- -- copy the license to the license.sig file in the license/ directory
- -- run export DRIVERLESS_AI_LICENSE_FILE=/path/to/license.sig
- 3. Java JDK 1.8
- -- execute “java -version” to verify the available JVM on your platform has JDK 1.8 installed. The output of the command should indicate JDK 1.8
- 4. H2O Runtime Drivers
- -- runtime drivers in lib/ directory
- 5. JAR File
- -- DAI-Mojo-Hive jar file in scorer/ directory
Execution
In hive environment run:
hive> add jar /path/to/mojo2-runtime.jar;
Added [/home/munish/DAI-Mojo-Hive/lib/mojo2-runtime.jar] to class path
Added resources: [/home/munish/DAI-Mojo-Hive/lib/mojo2-runtime.jar]
hive> add jar /path/to/DAI-Mojo-Hive-.jar;
Added [/home/munish/DAI-Mojo-Hive/scorer/DAI-Mojo-Hive-.jar] to class path
Added resources: [/home/munish/DAI-Mojo-Hive/scorer/DAI-Mojo-Hive-.jar]
hive> list jar;
/home/munish/DAI-Mojo-Hive/lib/mojo2-runtime.jar
/home/munish/DAI-Mojo-Hive/scorer/DAI-Mojo-Hive-.jar
hive> create temporary function daiPredict as 'ai.h2o.mojos.hive.daiPredict';
OK
Time taken: 0.75 seconds
hive> set DRIVERLESS_AI_LICENSE_FILE=/path/to/license.sig;
select id, daiPredict("DRIVERLESS_AI_MODELNAME=/path/to/mojo/pipeline.mojo verbose",loan_amnt, term, int_rate, installment, emp_length, home_ownership, annual_inc, verification_status, addr_state, dti, delinq_2yrs, inq_last_6mths, pub_rec, revol_bal, revol_util, total_acc) from lcdata where addr_state='CA' and loan_amnt>34000 limit 1;
calling load
returned load
1068159 0.8994684115021625 0.10053158849783754
Time taken: 1.389 seconds, Fetched: 1 row(s)
hive> describe function extended daiPredict;
Call a Driverless AI Mojo for scoring prediction
Synonyms: daipredict
Rest Scorer
Requirements
- 1. Driverless AI Mojo
- -- copy the mojo file in the models/ directory
- 2. Driverless AI License
- -- provided via the partnership portal
- -- copy the license to the license.sig file in the license/ directory
- -- run export DRIVERLESS_AI_LICENSE_FILE=/path/to/license.sig
- 3. Java JDK 1.8
- -- execute “java -version” to verify the available JVM on your platform has JDK 1.8 installed. The output of the command should indicate JDK 1.8
- 5. JAR File
- -- DAI-Mojo2-RestServer jar file in scorer/ directory
Execution
java -DModelDirectory=models/pipeline.mojo -jar scorer/DAI-Mojo2-RestServer-1.0.jar
Results
curl "http://127.0.0.1:8080/model?name=pipeline.mojo&verbose=true&row=5000,36months,10.65,162.87,10,RENT,24000,VERIFIED-income,AZ,27.65,0,1,0,13648,83.7,0"