[
https://issues.apache.org/jira/browse/MADLIB-1359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16908309#comment-16908309
]
Frank McQuillan commented on MADLIB-1359:
-----------------------------------------
{code}
DROP TABLE IF EXISTS iris_predict_byom;
SELECT madlib.madlib_keras_predict_byom('model_arch_library', -- model arch
table
1, -- model arch id
'iris_test', -- test_table
'id', -- id column
'attributes', -- independent
var
'iris_predict_byom', -- output table
'response', -- prediction
type
0, -- gpus per host
ARRAY['Iris-setosa',
'Iris-versicolor', 'Iris-virginica'], -- class values
1.0 -- normalizing
const
);
SELECT * FROM iris_predict_byom ORDER BY id;
id | estimated_dependent_var
-----+-------------------------
1 | Iris-setosa
18 | Iris-setosa
20 | Iris-setosa
24 | Iris-setosa
26 | Iris-setosa
27 | Iris-setosa
28 | Iris-setosa
30 | Iris-setosa
32 | Iris-setosa
46 | Iris-setosa
47 | Iris-setosa
51 | Iris-versicolor
52 | Iris-versicolor
59 | Iris-versicolor
60 | Iris-versicolor
61 | Iris-versicolor
64 | Iris-virginica
65 | Iris-versicolor
66 | Iris-versicolor
68 | Iris-versicolor
76 | Iris-versicolor
78 | Iris-virginica
81 | Iris-versicolor
84 | Iris-virginica
91 | Iris-virginica
98 | Iris-versicolor
101 | Iris-virginica
125 | Iris-virginica
130 | Iris-virginica
133 | Iris-virginica
(30 rows)
{code}
{code}
DROP TABLE IF EXISTS iris_predict_byom;
SELECT madlib.madlib_keras_predict_byom('model_arch_library', -- model arch
table
1, -- model arch id
'iris_test', -- test_table
'id', -- id column
'attributes', -- independent
var
'iris_predict_byom' -- output table
);
SELECT * FROM iris_predict_byom ORDER BY id;
id | estimated_dependent_var
-----+-------------------------
1 | 0
18 | 0
20 | 0
24 | 0
26 | 0
27 | 0
28 | 0
30 | 0
32 | 0
46 | 0
47 | 0
51 | 1
52 | 1
59 | 1
60 | 1
61 | 1
64 | 2
65 | 1
66 | 1
68 | 1
76 | 1
78 | 2
81 | 1
84 | 2
91 | 2
98 | 1
101 | 2
125 | 2
130 | 2
133 | 2
(30 rows)
{code}
{code}
DROP TABLE IF EXISTS iris_predict_byom;
SELECT madlib.madlib_keras_predict_byom('model_arch_library', -- model arch
table
1, -- model arch id
'iris_test', -- test_table
'id', -- id column
'attributes', -- independent
var
'iris_predict_byom', -- output table
'prob', -- prediction type
0, -- gpus per host
ARRAY['Iris-setosa',
'Iris-versicolor', 'Iris-virginica'], -- class values
1.0 -- normalizing
const
);
SELECT * FROM iris_predict_byom ORDER BY id;
id | prob_Iris-setosa | prob_Iris-versicolor | prob_Iris-virginica
-----+------------------+----------------------+---------------------
1 | 0.97138274 | 0.025224565 | 0.0033927
18 | 0.97197604 | 0.024838978 | 0.0031850387
20 | 0.97796774 | 0.019109258 | 0.0029231268
24 | 0.934748 | 0.0579517 | 0.0073003164
26 | 0.91712886 | 0.073093824 | 0.009777269
27 | 0.9523869 | 0.041732516 | 0.0058805626
28 | 0.96662986 | 0.02945035 | 0.003919784
30 | 0.93458587 | 0.05538236 | 0.010031806
32 | 0.9622423 | 0.034357797 | 0.003399921
46 | 0.9392291 | 0.053777166 | 0.00699376
47 | 0.97205293 | 0.02391402 | 0.0040329834
51 | 0.047419224 | 0.6513861 | 0.3011947
52 | 0.05720685 | 0.63326347 | 0.3095297
59 | 0.036483206 | 0.56527764 | 0.39823908
60 | 0.06647456 | 0.56254363 | 0.37098172
61 | 0.0603336 | 0.52332056 | 0.4163458
64 | 0.027475674 | 0.44579932 | 0.52672493
65 | 0.15933721 | 0.65316516 | 0.18749759
66 | 0.06711763 | 0.67913276 | 0.2537496
68 | 0.052709933 | 0.57759637 | 0.36969376
76 | 0.05880547 | 0.6522814 | 0.2889131
78 | 0.022371378 | 0.44756117 | 0.53006744
81 | 0.061154667 | 0.5778742 | 0.36097106
84 | 0.010076913 | 0.2382943 | 0.7516287
91 | 0.028012346 | 0.39615962 | 0.5758281
98 | 0.05417811 | 0.61200374 | 0.33381817
101 | 0.0039304136 | 0.14118098 | 0.8548886
125 | 0.008380276 | 0.25236616 | 0.7392536
130 | 0.0060693217 | 0.23190267 | 0.76202804
133 | 0.0049104625 | 0.16266319 | 0.8324263
(30 rows)
{code}
{code}
DROP TABLE IF EXISTS iris_predict_byom;
SELECT madlib.madlib_keras_predict_byom('model_arch_library', -- model arch
table
1, -- model arch id
'iris_test', -- test_table
'id', -- id column
'attributes', -- independent
var
'iris_predict_byom', -- output table
'prob' -- prediction
type
);
SELECT * FROM iris_predict_byom ORDER BY id;
id | prob
-----+---------------------------------------
1 | {0.97138274,0.025224565,0.0033927}
18 | {0.97197604,0.024838978,0.0031850387}
20 | {0.97796774,0.019109258,0.0029231268}
24 | {0.934748,0.0579517,0.0073003164}
26 | {0.91712886,0.073093824,0.009777269}
27 | {0.9523869,0.041732516,0.0058805626}
28 | {0.96662986,0.02945035,0.003919784}
30 | {0.93458587,0.05538236,0.010031806}
32 | {0.9622423,0.034357797,0.003399921}
46 | {0.9392291,0.053777166,0.00699376}
47 | {0.97205293,0.02391402,0.0040329834}
51 | {0.047419224,0.6513861,0.3011947}
52 | {0.05720685,0.63326347,0.3095297}
59 | {0.036483206,0.56527764,0.39823908}
60 | {0.06647456,0.56254363,0.37098172}
61 | {0.0603336,0.52332056,0.4163458}
64 | {0.027475674,0.44579932,0.52672493}
65 | {0.15933721,0.65316516,0.18749759}
66 | {0.06711763,0.67913276,0.2537496}
68 | {0.052709933,0.57759637,0.36969376}
76 | {0.05880547,0.6522814,0.2889131}
78 | {0.022371378,0.44756117,0.53006744}
81 | {0.061154667,0.5778742,0.36097106}
84 | {0.010076913,0.2382943,0.7516287}
91 | {0.028012346,0.39615962,0.5758281}
98 | {0.05417811,0.61200374,0.33381817}
101 | {0.0039304136,0.14118098,0.8548886}
125 | {0.008380276,0.25236616,0.7392536}
130 | {0.0060693217,0.23190267,0.76202804}
133 | {0.0049104625,0.16266319,0.8324263}
(30 rows)
{code}
LGTM
> Support DL predict without training on MADlib
> ---------------------------------------------
>
> Key: MADLIB-1359
> URL: https://issues.apache.org/jira/browse/MADLIB-1359
> Project: Apache MADlib
> Issue Type: New Feature
> Components: Module: Neural Networks
> Reporter: Frank McQuillan
> Priority: Major
> Fix For: v1.17
>
>
> Story
> As a data scientist,
> I want to download a model architecture and weights from an external source
> and run predict with MADlib (without training on MADlib)
> so that
> I can use models designed trained elsewhere without having to do all that
> work myself
> Acceptance
> 1. Download a simple model for MNIST and load into model arch table using
> helper functions. Run predict on test examples and get predictions.
> 2. Same as #1 with Places 10 (?) using VGG16 weights.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)