Skip to content

Keras Train

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
        {
            type: keras_train
            component: trainer
            publish: [
                {
                    stream: model
                }
            ]
        }

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
{
  type: pyspark
  job: [ 
        {
            type: keras_train
            component: trainer
            publish: [
                {
                    stream: model
                }
            ]
        }
        {
            type: keras_save_model
            component: model_save
            settings:{
                path: my_model.h5
            }
            subscribe:[
                {
                    component: trainer
                    stream: model
                }
            ]
        }
    ]
}