Skip to content

Keras Eval Stream

Overview

Compatible Pyspark only

Python node : launch with punchplatform-pyspark.sh or the punch UI job-editor with environment pyspark.

This node define and train a small demonstrative keras model to recognise digits from the mnist database. It publish the trained keras model to the output stream.

The model created is a feed-forward neural network with one hidden layer of 128 neurons. The training is done over 5 epoch with a batch size of 50.

Since it's mostly a specific demo node, it don't have any settings.

Example configuration :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
        {
            type: keras_eval_stream
            component: my_keras

            subscribe: [
                {
                    component: data_input
                    stream: x_test
                }

                {
                    component: model_load
                    stream: model
                }
            ]
            publish: [
                {
                    stream: predicts
                }
            ]
        }

Example of complete pipeline :

 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
  type: pyspark
  runtime_id: simpleJob
  job: [
        {
            type: keras_data_input
            component: data_input
            publish: [
                {
                    stream: x_test
                }
            ]
        }

        {
            type: keras_load_model
            component: model_load
            settings:{
                path: my_model.h5
            }
            publish: [
                {
                    stream: model
                }
            ]
        }

        {
            type: keras_eval_stream
            component: my_keras

            subscribe: [
                {
                    component: data_input
                    stream: x_test
                }

                {
                    component: model_load
                    stream: model
                }
            ]
            publish: [
                {
                    stream: predicts
                }
            ]
        }

        {
            type: show
            component: show,
            subscribe: [
              {
                component: my_keras
                stream: predicts
              }
            ]
        }
  ]
}