-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtable_classification_creditcard.sql
More file actions
27 lines (22 loc) · 1.36 KB
/
table_classification_creditcard.sql
File metadata and controls
27 lines (22 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-- Copyright (c) 2022, Oracle and/or its affiliates.
-- Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
\sql
SET GLOBAL local_infile = 1;
DROP DATABASE IF EXISTS heatwaveml_bench;
CREATE DATABASE heatwaveml_bench;
USE heatwaveml_bench;
CREATE TABLE creditcard_train ( Time INT, V1 FLOAT, V2 FLOAT, V3 FLOAT, V4 FLOAT, V5 FLOAT, V6 FLOAT, V7 FLOAT, V8 FLOAT, V9 FLOAT, V10 FLOAT, V11 FLOAT, V12 FLOAT, V13 FLOAT, V14 FLOAT, V15 FLOAT, V16 FLOAT, V17 FLOAT, V18 FLOAT, V19 FLOAT, V20 FLOAT, V21 FLOAT, V22 FLOAT, V23 FLOAT, V24 FLOAT, V25 FLOAT, V26 FLOAT, V27 FLOAT, V28 FLOAT, Amount FLOAT, Class INT);
CREATE TABLE creditcard_test LIKE creditcard_train;
\js
util.importTable("creditcard_train.csv",{table: "creditcard_train", dialect: "csv-unix", skipRows:1})
util.importTable("creditcard_test.csv",{table: "creditcard_test", dialect: "csv-unix", skipRows:1})
\sql
-- Train the model
CALL sys.ML_TRAIN('heatwaveml_bench.creditcard_train', 'Class', JSON_OBJECT('task', 'classification'), @model_creditcard);
-- Load the model into HeatWave
CALL sys.ML_MODEL_LOAD(@model_creditcard, NULL);
-- Score the model on the test data
CALL sys.ML_SCORE('heatwaveml_bench.creditcard_test', 'Class', @model_creditcard, 'balanced_accuracy', @score_creditcard, null);
-- Print the score
SELECT @score_creditcard;
DROP DATABASE heatwaveml_bench;