入力
- InputTable: svm_iris_input_test
- モデル: svm_iris_model、ML Engine SVMSparse関数により出力
モデルはバイナリ形式です。その読み取り可能なコンテンツを表示するには、ML EngineSVMSparseSummary関数を使用します。
| id | species | attribute | value |
|---|---|---|---|
| 5 | setosa | sepal_length | 5.0 |
| 5 | setosa | sepal_width | 3.6 |
| 5 | setosa | petal_length | 1.4 |
| 5 | setosa | petal_width | 0.2 |
| 10 | setosa | sepal_length | 4.9 |
| 10 | setosa | sepal_width | 3.1 |
| 10 | setosa | petal_length | 1.5 |
| 10 | setosa | petal_width | 0.1 |
| 15 | setosa | sepal_length | 5.8 |
| 15 | setosa | sepal_width | 4.0 |
| 15 | setosa | petal_length | 1.2 |
| 15 | setosa | petal_width | 0.2 |
| ..。 | ..。 | ..。 | ..。 |
SQL呼び出し
CREATE MULTISET TABLE svm_iris_predict_out AS (
SELECT * FROM SVMSparsePredict (
ON svm_iris_input_test AS InputTable PARTITION BY id
ON svm_iris_model AS Model DIMENSION
USING
IDColumn ('id')
AttributeNameColumn ('attribute')
AttributeValueColumn ('value')
Accumulate ('species')
) AS dt
) WITH DATA;
出力
このクエリーは、以下のテーブルを返します。
SELECT * FROM svm_iris_predict_out ORDER BY id;
| id | predict_value | predict_confidence | species |
|---|---|---|---|
| 5 | setosa | 0.878736053291771 | setosa |
| 10 | setosa | 0.827684323576856 | setosa |
| 15 | setosa | 0.933727152238982 | setosa |
| ..。 | ..。 | ..。 | ..。 |
予測精度
このクエリーは予測精度を返します。
SELECT (SELECT count(id) FROM svm_iris_predict_out WHERE predict_value = species)/( SELECT count(id) FROM svm_iris_predict_out) AS prediction_accuracy;
| prediction_accuracy |
|---|
| 0.946666666666667 |